- 积分
- 110
- 金钱
- 105
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
注册会员
- 积分
- 110
- 金钱
- 105
- HASS币
- 0
|
楼主 |
发表于 2024-10-16 10:26:08
|
显示全部楼层
本帖最后由 js_brains 于 2024-10-16 10:29 编辑
涂鸦Zigbee版本接入HA(云端模式)
注意: 使用涂鸦云项目接入的方式需要先去云项目中打开设备的透传模式
sensor.py 全局搜索"hps",并修改成以下代码
"hps": (
TuyaSensorEntityDescription(
key=DPCode.CUSTOM_PRESSURE_STATE,
translation_key="custom_presence_state",
name="人体传感器状态(自定义)",
device_class=SensorDeviceClass.ENUM,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement = "",
),
TuyaSensorEntityDescription(
key=DPCode.ILLUMINANCE_VALUE,
name="光照强度",
translation_key="illuminance_value",
icon="mdi:sun-wireless",
state_class=SensorStateClass.MEASUREMENT,
# entity_category=EntityCategory.CONFIG,
),
TuyaSensorEntityDescription(
key=DPCode.TARGET_DISTANCE,
name="目标距离",
translation_key="target_distance",
icon="mdi:signal-distance-variant",
# entity_category=EntityCategory.CONFIG,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.LDR_LINKAGE_OPERATOR,
name="光敏联动比较符",
translation_key="ldr_linkage_operator",
icon="mdi:sun-wireless",
entity_category=EntityCategory.CONFIG,
),
TuyaSensorEntityDescription(
key=DPCode.PRESENCE_SWITCH_ACTION,
name="有人时开关动作",
translation_key="presence_switch_action",
icon="mdi:clock-time-eight",
device_class=SensorDeviceClass.ENUM,
entity_category=EntityCategory.CONFIG,
),
TuyaSensorEntityDescription(
key=DPCode.SWITCH_MODE,
name="开关模式",
translation_key="switch_mode",
icon="mdi:signal-distance-variant",
device_class=SensorDeviceClass.ENUM,
entity_category=EntityCategory.CONFIG,
),
TuyaSensorEntityDescription(
key=DPCode.HAS_BREAKER,
name="是否有通断器",
translation_key="switch_mode",
icon="mdi:signal-distance-variant",
device_class=SensorDeviceClass.ENUM,
entity_category=EntityCategory.CONFIG,
),
),
number.py 搜索"hps" 并修改成以下代码
"hps": (
NumberEntityDescription(
key=DPCode.SENSITIVITY,
translation_key="sensitivity",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.NEAR_DETECTION,
translation_key="near_detection",
icon="mdi:signal-distance-variant",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.FAR_DETECTION,
translation_key="far_detection",
icon="mdi:signal-distance-variant",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.LDR_LINKAGE_VALUE,
name="光敏联动阈值",
translation_key="ldr_linkage_value",
icon="mdi:sun-wireless",
mode = "box",
native_unit_of_measurement = "lux",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.PRESENCE_DELAY,
name="有人确定时间",
translation_key="presence_delay",
icon="mdi:clock-time-eight",
mode = "slider",
native_unit_of_measurement = "s",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.NOBODY_JUDGE_TIME,
name="无人判断时间",
translation_key="nobody_judge_time",
icon="mdi:clock-time-eight",
mode = "slider",
native_unit_of_measurement = "s",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.DETECTION_NUMBER,
name="探测点数量",
translation_key="detection_number",
icon="mdi:clock-time-eight",
mode = "slider",
entity_category=EntityCategory.CONFIG,
),
),
|
|