diff --git a/custom_zha_quirks/__pycache__/ts0207_rain.cpython-312.pyc b/custom_zha_quirks/__pycache__/ts0207_rain.cpython-312.pyc new file mode 100644 index 0000000..44dae3f Binary files /dev/null and b/custom_zha_quirks/__pycache__/ts0207_rain.cpython-312.pyc differ diff --git a/custom_zha_quirks/__pycache__/ts0207_rain.cpython-313.pyc b/custom_zha_quirks/__pycache__/ts0207_rain.cpython-313.pyc new file mode 100644 index 0000000..49b3488 Binary files /dev/null and b/custom_zha_quirks/__pycache__/ts0207_rain.cpython-313.pyc differ diff --git a/custom_zha_quirks/__pycache__/ts0601_motion.cpython-313.pyc b/custom_zha_quirks/__pycache__/ts0601_motion.cpython-313.pyc new file mode 100644 index 0000000..d387918 Binary files /dev/null and b/custom_zha_quirks/__pycache__/ts0601_motion.cpython-313.pyc differ diff --git a/custom_zha_quirks/__pycache__/ts0601_smoke.cpython-313.pyc b/custom_zha_quirks/__pycache__/ts0601_smoke.cpython-313.pyc new file mode 100644 index 0000000..55cb734 Binary files /dev/null and b/custom_zha_quirks/__pycache__/ts0601_smoke.cpython-313.pyc differ diff --git a/custom_zha_quirks/__pycache__/ts0601_valve_garden.cpython-313.pyc b/custom_zha_quirks/__pycache__/ts0601_valve_garden.cpython-313.pyc new file mode 100644 index 0000000..fa461d9 Binary files /dev/null and b/custom_zha_quirks/__pycache__/ts0601_valve_garden.cpython-313.pyc differ diff --git a/custom_zha_quirks/ts0207_rain.py.old b/custom_zha_quirks/ts0207_rain.py.old new file mode 100644 index 0000000..63dee78 --- /dev/null +++ b/custom_zha_quirks/ts0207_rain.py.old @@ -0,0 +1,137 @@ +"""Quirk for TS0207 rain sensors.""" + +import zigpy.types as t +from typing import Any, Type +from zigpy.profiles import zha +from zigpy.quirks import CustomDevice, CustomCluster +from zigpy.zcl.clusters.general import ( + Basic, + Groups, + Identify, + OnOff, + Ota, + PowerConfiguration, + Scenes, + Time, +) +from zigpy.zcl.clusters.lightlink import LightLink +from zigpy.zcl.clusters.security import IasZone +from zhaquirks.const import ( + DEVICE_TYPE, + ENDPOINTS, + INPUT_CLUSTERS, + MODELS_INFO, + OUTPUT_CLUSTERS, + PROFILE_ID, +) +from zhaquirks.tuya.mcu import TuyaMCUCluster +from zhaquirks.tuya import ( + TuyaManufCluster, + DPToAttributeMapping, + EnchantedDevice, + TuyaNoBindPowerConfigurationCluster, +) + +ZONE_TYPE = 0x0001 + +class TuyaSolarRainSensorCluster(TuyaMCUCluster): + """Tuya manufacturer cluster.""" + + attributes = TuyaMCUCluster.attributes.copy() + attributes.update( + { + 0xEF65: ("light_intensity", t.uint32_t, True), + 0xEF66: ("average_light_intensity_20mins", t.uint32_t, True), + 0xEF67: ("todays_max_light_intensity", t.uint32_t, True), + 0xEF68: ("cleaning_reminder", t.Bool, True), + 0xEF69: ("rain_sensor_voltage", t.uint32_t, True), + } + ) + + dp_to_attribute: dict[int, DPToAttributeMapping] = { + 101: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "light_intensity", + ), + 102: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "average_light_intensity_20mins", + ), + 103: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "todays_max_light_intensity", + ), + 104: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "cleaning_reminder", + ), + 105: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "rain_sensor_voltage", + ), + } + + data_point_handlers = { + 101: "_dp_2_attr_update", + 102: "_dp_2_attr_update", + 103: "_dp_2_attr_update", + 104: "_dp_2_attr_update", + 105: "_dp_2_attr_update", + } + + +class TuyaIasZone(CustomCluster, IasZone): + """IAS Zone for rain sensors.""" + + _CONSTANT_ATTRIBUTES = {ZONE_TYPE: IasZone.ZoneType.Water_Sensor} + + +class TuyaSolarRainSensor(EnchantedDevice): + """TS0207 Rain sensor quirk.""" + + signature = { + MODELS_INFO: [("_TZ3210_tgvtvdoc", "TS0207")], + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.IAS_ZONE, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + Groups.cluster_id, + Scenes.cluster_id, + IasZone.cluster_id, + TuyaMCUCluster.cluster_id, + ], + OUTPUT_CLUSTERS: [ + Identify.cluster_id, + Groups.cluster_id, + OnOff.cluster_id, + Time.cluster_id, + Ota.cluster_id, + LightLink.cluster_id, + ], + }, + }, + } + + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.IAS_ZONE, + INPUT_CLUSTERS: [ + Basic.cluster_id, + Groups.cluster_id, + Scenes.cluster_id, + TuyaNoBindPowerConfigurationCluster, + TuyaIasZone, + TuyaSolarRainSensorCluster, + ], + OUTPUT_CLUSTERS: [ + Time.cluster_id, + Ota.cluster_id, + ], + }, + }, + } \ No newline at end of file diff --git a/custom_zha_quirks/ts0601_motion copy.py.old b/custom_zha_quirks/ts0601_motion copy.py.old new file mode 100644 index 0000000..2fb2d54 --- /dev/null +++ b/custom_zha_quirks/ts0601_motion copy.py.old @@ -0,0 +1,358 @@ +# rivsc https://blog.rivsc.ovh +import logging +from typing import Final + +from zigpy.quirks.v2 import QuirkBuilder, BinarySensorDeviceClass + +import zigpy.types as t +from zigpy.zcl.foundation import ZCLAttributeDef +from zigpy.zcl.clusters.measurement import ( + IlluminanceMeasurement, + OccupancySensing, +) +from zigpy.zcl.clusters.security import IasZone +from zigpy.quirks.v2.homeassistant import EntityPlatform, EntityType + +from zhaquirks.tuya import ( + TuyaLocalCluster, + TuyaPowerConfigurationCluster2AAA, +) +from zhaquirks.tuya.mcu import TuyaMCUCluster, DPToAttributeMapping + +class PresenceState(t.enum8): + """Presence State values""" + none = 0x00 + presence = 0x01 + peaceful = 0x02 + small_movement = 0x03 + large_movement = 0x04 + +class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster): + """Tuya local OccupancySensing cluster.""" + +class TuyaIlluminanceMeasurement(IlluminanceMeasurement, TuyaLocalCluster): + """Tuya local IlluminanceMeasurement cluster.""" + +class HumanPresenceSensorManufCluster(TuyaMCUCluster): + """Human Presence Sensor ZG-205Z (5.8GHz)""" + + class AttributeDefs(TuyaMCUCluster.AttributeDefs): + """Tuya DataPoints attributes""" + + # Presence state + presence_state: Final = ZCLAttributeDef( + id=0x0001, # DP 1 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # Target distance + target_distance: Final = ZCLAttributeDef( + id=0x0101, # DP 101 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # Illuminance value + illuminance_lux: Final = ZCLAttributeDef( + id=0x0102, # DP 102 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # None delay time (presence keep time) + none_delay_time: Final = ZCLAttributeDef( + id=0x0103, # DP 103 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Indicator + indicator: Final = ZCLAttributeDef( + id=0x0104, # DP 104 + type=t.Bool, + is_manufacturer_specific=True, + ) + # Move detection max distance + move_detection_max: Final = ZCLAttributeDef( + id=0x0107, # DP 107 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Move detection min distance + move_detection_min: Final = ZCLAttributeDef( + id=0x0108, # DP 108 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Breath detection max distance + breath_detection_max: Final = ZCLAttributeDef( + id=0x0109, # DP 109 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Breath detection min distance + breath_detection_min: Final = ZCLAttributeDef( + id=0x0110, # DP 110 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Small move detection max distance + small_move_detection_max: Final = ZCLAttributeDef( + id=0x0114, # DP 114 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Small move detection min distance + small_move_detection_min: Final = ZCLAttributeDef( + id=0x0115, # DP 115 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Move sensitivity + move_sensitivity: Final = ZCLAttributeDef( + id=0x0116, # DP 116 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + # Small move sensitivity + small_move_sensitivity: Final = ZCLAttributeDef( + id=0x0117, # DP 117 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + # Breath sensitivity + breath_sensitivity: Final = ZCLAttributeDef( + id=0x0118, # DP 118 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + + dp_to_attribute: dict[int, DPToAttributeMapping] = { + 1: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "presence_state", + converter=PresenceState + ), + 101: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "target_distance", + converter=lambda x: x / 100 if x is not None else 0 + ), + 102: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "illuminance_lux", + ), + 103: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "none_delay_time", + converter=lambda x: x if x is not None else 30 + ), + 104: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "indicator", + ), + 107: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_detection_max", + converter=lambda x: x / 100 if x is not None else 10 + ), + 108: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 109: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_detection_max", + converter=lambda x: x / 100 if x is not None else 6 + ), + 110: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 114: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_detection_max", + converter=lambda x: x / 100 if x is not None else 6 + ), + 115: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 116: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + 117: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + 118: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + } + + data_point_handlers = { + 1: "_dp_2_attr_update", + 101: "_dp_2_attr_update", + 102: "_dp_2_attr_update", + 103: "_dp_2_attr_update", + 104: "_dp_2_attr_update", + 107: "_dp_2_attr_update", + 108: "_dp_2_attr_update", + 109: "_dp_2_attr_update", + 110: "_dp_2_attr_update", + 114: "_dp_2_attr_update", + 115: "_dp_2_attr_update", + 116: "_dp_2_attr_update", + 117: "_dp_2_attr_update", + 118: "_dp_2_attr_update", + } + +( + QuirkBuilder("_TZE204_dapwryy7", "TS0601") + .skip_configuration() + .removes(IasZone.cluster_id) + .adds(HumanPresenceSensorManufCluster) + #.adds(TuyaOccupancySensing) + .replaces(TuyaPowerConfigurationCluster2AAA) + .replaces(TuyaIlluminanceMeasurement) + .binary_sensor( + "presence_state", + HumanPresenceSensorManufCluster.cluster_id, + endpoint_id=1, + #entity_type=EntityType.STANDARD, # very soon (zigpy channel #dev on github + device_class=BinarySensorDeviceClass.OCCUPANCY, + fallback_name="Presence" + ) + .enum( + HumanPresenceSensorManufCluster.AttributeDefs.presence_state.name, + PresenceState, + HumanPresenceSensorManufCluster.cluster_id, + entity_platform=EntityPlatform.SENSOR, + entity_type=EntityType.STANDARD, + fallback_name="Presence State", + translation_key="presence_state" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.target_distance.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + #unit="m", # fail :/ + fallback_name="Target Distance (m)", + translation_key="target_distance", + #entity_type=EntityType.STANDARD # not yet :/ + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.none_delay_time.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=28800, + unit="s", + fallback_name="Hold Delay Time", + translation_key="none_delay_time" + ) + .switch( + HumanPresenceSensorManufCluster.AttributeDefs.indicator.name, + HumanPresenceSensorManufCluster.cluster_id, + fallback_name="LED Indicator", + translation_key="indicator" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + #unit="m", + fallback_name="Move Detection Max Distance (m)", + translation_key="move_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + #unit="m", + fallback_name="Move Detection Min Distance (m)", + translation_key="move_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + #unit="m", + fallback_name="Small Move Detection Max Distance (m)", + translation_key="small_move_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + #unit="m", + fallback_name="Small Move Detection Min Distance (m)", + translation_key="small_move_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + #unit="m", + fallback_name="Breath Detection Max Distance (m)", + translation_key="breath_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + #unit="m", + fallback_name="Breath Detection Min Distance (m)", + translation_key="breath_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Move Sensitivity", + translation_key="move_sensitivity" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Small Move Sensitivity", + translation_key="small_move_sensitivity" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Breath Sensitivity", + translation_key="breath_sensitivity" + ) + .add_to_registry() +) \ No newline at end of file diff --git a/custom_zha_quirks/ts0601_motion.py b/custom_zha_quirks/ts0601_motion.py new file mode 100644 index 0000000..97b66cb --- /dev/null +++ b/custom_zha_quirks/ts0601_motion.py @@ -0,0 +1,361 @@ +import logging +from typing import Final + +from zigpy.quirks.v2 import QuirkBuilder, BinarySensorDeviceClass + +import zigpy.types as t +from zigpy.zcl.foundation import ZCLAttributeDef +from zigpy.zcl.clusters.measurement import ( + IlluminanceMeasurement, + OccupancySensing, +) +from zigpy.zcl.clusters.security import IasZone +from zigpy.quirks.v2.homeassistant import EntityPlatform, EntityType + +from zhaquirks.tuya import ( + TuyaLocalCluster, + TuyaPowerConfigurationCluster2AAA, +) +from zhaquirks.tuya.mcu import TuyaMCUCluster, DPToAttributeMapping + +class PresenceState(t.enum8): + """Presence State values""" + none = 0x00 + presence = 0x01 + peaceful = 0x02 + small_movement = 0x03 + large_movement = 0x04 + +class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster): + """Tuya local OccupancySensing cluster.""" + +class TuyaIlluminanceMeasurement(IlluminanceMeasurement, TuyaLocalCluster): + """Tuya local IlluminanceMeasurement cluster.""" + +class HumanPresenceSensorManufCluster(TuyaMCUCluster): + """Human Presence Sensor ZG-205Z (5.8GHz)""" + + class AttributeDefs(TuyaMCUCluster.AttributeDefs): + """Tuya DataPoints attributes""" + + # Presence state + presence_state: Final = ZCLAttributeDef( + id=0x0001, # DP 1 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # Target distance + target_distance: Final = ZCLAttributeDef( + id=0x0101, # DP 101 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # Illuminance value + illuminance_lux: Final = ZCLAttributeDef( + id=0x0102, # DP 102 + type=t.uint16_t, + access="rp", + is_manufacturer_specific=True, + ) + # None delay time (presence keep time) + none_delay_time: Final = ZCLAttributeDef( + id=0x0103, # DP 103 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Indicator + indicator: Final = ZCLAttributeDef( + id=0x0104, # DP 104 + type=t.Bool, + is_manufacturer_specific=True, + ) + # Move detection max distance + move_detection_max: Final = ZCLAttributeDef( + id=0x0107, # DP 107 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Move detection min distance + move_detection_min: Final = ZCLAttributeDef( + id=0x0108, # DP 108 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Breath detection max distance + breath_detection_max: Final = ZCLAttributeDef( + id=0x0109, # DP 109 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Breath detection min distance + breath_detection_min: Final = ZCLAttributeDef( + id=0x0110, # DP 110 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Small move detection max distance + small_move_detection_max: Final = ZCLAttributeDef( + id=0x0114, # DP 114 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Small move detection min distance + small_move_detection_min: Final = ZCLAttributeDef( + id=0x0115, # DP 115 + type=t.uint16_t, + is_manufacturer_specific=True, + ) + # Move sensitivity (1 is higher, 9 is lower) + move_sensitivity: Final = ZCLAttributeDef( + id=0x0116, # DP 116 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + # Small move sensitivity + small_move_sensitivity: Final = ZCLAttributeDef( + id=0x0117, # DP 117 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + # Breath sensitivity + breath_sensitivity: Final = ZCLAttributeDef( + id=0x0118, # DP 118 + type=t.uint8_t, + is_manufacturer_specific=True, + ) + + dp_to_attribute: dict[int, DPToAttributeMapping] = { + 1: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "presence_state", + converter=PresenceState + ), + 101: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "target_distance", + converter=lambda x: x / 100 if x is not None else 0 + ), + 102: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "illuminance_lux", + ), + 103: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "none_delay_time", + # Value in Tuya App is 30 after Factory reset + #converter=lambda x: x if x is not None else 30 + ), + 104: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "indicator", + ), + 107: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_detection_max", + converter=lambda x: x / 100 if x is not None else 10 + ), + 108: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 109: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_detection_max", + converter=lambda x: x / 100 if x is not None else 6 + ), + 110: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 114: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_detection_max", + converter=lambda x: x / 100 if x is not None else 6 + ), + 115: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_detection_min", + converter=lambda x: x / 100 if x is not None else 0 + ), + 116: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "move_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + 117: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "small_move_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + 118: DPToAttributeMapping( + TuyaMCUCluster.ep_attribute, + "breath_sensitivity", + converter=lambda x: x if x is not None else 5 + ), + } + + data_point_handlers = { + 1: "_dp_2_attr_update", + 101: "_dp_2_attr_update", + 102: "_dp_2_attr_update", + 103: "_dp_2_attr_update", + 104: "_dp_2_attr_update", + 107: "_dp_2_attr_update", + 108: "_dp_2_attr_update", + 109: "_dp_2_attr_update", + 110: "_dp_2_attr_update", + 114: "_dp_2_attr_update", + 115: "_dp_2_attr_update", + 116: "_dp_2_attr_update", + 117: "_dp_2_attr_update", + 118: "_dp_2_attr_update", + } + +( + QuirkBuilder("_TZE204_dapwryy7", "TS0601") + .skip_configuration() + .removes(IasZone.cluster_id) + .adds(HumanPresenceSensorManufCluster) + #.adds(TuyaOccupancySensing) + .replaces(TuyaPowerConfigurationCluster2AAA) + .replaces(TuyaIlluminanceMeasurement) + .binary_sensor( + "presence_state", + HumanPresenceSensorManufCluster.cluster_id, + endpoint_id=1, + #entity_type=EntityType.STANDARD, # very soon (zigpy channel #dev on github + device_class=BinarySensorDeviceClass.OCCUPANCY, + fallback_name="Presence" + ) + .enum( + HumanPresenceSensorManufCluster.AttributeDefs.presence_state.name, + PresenceState, + HumanPresenceSensorManufCluster.cluster_id, + entity_platform=EntityPlatform.SENSOR, + entity_type=EntityType.STANDARD, + fallback_name="Presence State", + translation_key="presence_state" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.illuminance_lux.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=2500, + fallback_name="Illuminance (lx)", + translation_key="illuminance_lux", + #entity_type=EntityType.STANDARD # not yet :/ + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.target_distance.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + fallback_name="Target Distance (m)", + translation_key="target_distance", + #entity_type=EntityType.STANDARD # not yet :/ + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.none_delay_time.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=28800, + #unit="s", + fallback_name="Hold Delay Time", + translation_key="none_delay_time" + ) + .switch( + HumanPresenceSensorManufCluster.AttributeDefs.indicator.name, + HumanPresenceSensorManufCluster.cluster_id, + fallback_name="LED Indicator", + translation_key="indicator" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + fallback_name="Move Detection Max Distance (m)", + translation_key="move_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=10, + fallback_name="Move Detection Min Distance (m)", + translation_key="move_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + fallback_name="Small Move Detection Max Distance (m)", + translation_key="small_move_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + fallback_name="Small Move Detection Min Distance (m)", + translation_key="small_move_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_detection_max.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + fallback_name="Breath Detection Max Distance (m)", + translation_key="breath_detection_max" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_detection_min.name, + HumanPresenceSensorManufCluster.cluster_id, + step=0.01, + min_value=0, + max_value=6, + fallback_name="Breath Detection Min Distance (m)", + translation_key="breath_detection_min" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.move_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Move Sensitivity", + translation_key="move_sensitivity" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.small_move_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Small Move Sensitivity", + translation_key="small_move_sensitivity" + ) + .number( + HumanPresenceSensorManufCluster.AttributeDefs.breath_sensitivity.name, + HumanPresenceSensorManufCluster.cluster_id, + step=1, + min_value=0, + max_value=10, + fallback_name="Breath Sensitivity", + translation_key="breath_sensitivity" + ) + .add_to_registry() +) \ No newline at end of file diff --git a/custom_zha_quirks/ts0601_smoke.py b/custom_zha_quirks/ts0601_smoke.py.old similarity index 98% rename from custom_zha_quirks/ts0601_smoke.py rename to custom_zha_quirks/ts0601_smoke.py.old index 50c1fb5..5650bdc 100644 --- a/custom_zha_quirks/ts0601_smoke.py +++ b/custom_zha_quirks/ts0601_smoke.py.old @@ -131,7 +131,8 @@ class TuyaSmokeDetector0601(CustomDevice): signature = { MODELS_INFO: [ - ("_TZE200_uebojraa", "TS0601"), + """("_TZE200_uebojraa", "TS0601"),""" + ("_TZE200_uebojraa"), ], ENDPOINTS: { 1: { diff --git a/custom_zha_quirks/ts0601_valve_garden.py b/custom_zha_quirks/ts0601_valve_garden.py.old similarity index 97% rename from custom_zha_quirks/ts0601_valve_garden.py rename to custom_zha_quirks/ts0601_valve_garden.py.old index 02f86a2..40c7430 100644 --- a/custom_zha_quirks/ts0601_valve_garden.py +++ b/custom_zha_quirks/ts0601_valve_garden.py.old @@ -111,7 +111,9 @@ class TuyaValve(CustomDevice): """Tuya valve device.""" signature = { - MODELS_INFO: [("_TZE200_sh1btabb", "TS0601")], + """MODELS_INFO: [("_TZE200_sh1btabb", "TS0601")],""" + MODELS_INFO: [("_TZE200_sh1btabb")], + ENDPOINTS: { # - - {{ is_state('input_boolean.quiet_time', 'off') }} - #device_class: None - friendly_name: Quiet Time (Inverted) diff --git a/packages/nspanel_keepawake.yaml b/packages/nspanel_keepawake.yaml new file mode 100644 index 0000000..cf6d5d0 --- /dev/null +++ b/packages/nspanel_keepawake.yaml @@ -0,0 +1,45 @@ +#nspanel_keepawake: +# name: Entities to keep NSPanel Awake +# unique_id: Entities_to_keep_NSPanel_Awake +# # Keeps the bedroom NSPanel Bright if any of these are true +# If 'all' is set to true, they are 'ANDed' otherwise 'ORd' +#all: true +# entities: +# - binary_sensor.inverted_quiet_time_sensor +# - light.tasmo_arlecrgb_3522_bulb_3 +# - light.tasmo_ifan02_3793_bedrm1_1 +# - light.tasmo_ks811t_3647_bedrm1_1b + +#light: +# - platform: template +# sensors: +# inverted_quiet_time_sensor: +# value_template: >- +# {{ is_state('input_boolean.quiet_time', 'off') }} +# #device_class: None +# friendly_name: Quiet Time (Inverted) + +light: + - platform: template + lights: + inverted_quiet_time_as_light: + friendly_name: "Inverted Quiet time as light" + unique_id: "inverted quiet time as light" + value_template: "{{ is_state('input_boolean.quiet_time', 'off') }}" + turn_on: + service: light.turn_on + target: + entity_id: light.inverted_quiet_time_light + turn_off: + service: light.turn_off + target: + entity_id: light.inverted_quiet_time_as_light + + - platform: group + name: "Entities to keep NSPanel Awake" + unique_id: "Entities to keep NSPanel Awake" + entities: + - light.inverted_quiet_time_as_light + - light.tasmo_arlecrgb_3522_bulb_3 + - light.tasmo_ifan02_3793_bedrm1_1 + - light.tasmo_ks811t_3647_bedrm1_1b diff --git a/packages/simulation_lights.yaml b/packages/simulation_lights.yaml new file mode 100644 index 0000000..9f1d76f --- /dev/null +++ b/packages/simulation_lights.yaml @@ -0,0 +1,44 @@ +#simulation_lights: +# name: Simulation Lights +# # Lights included in 'away from home' random patterns +# entities: +# - switch.tasmo_ks811d_1242_entrance_a # Entranceway Main Lights +# - switch.tasmo_ks811d_0302_entrybath_a # Entranceway Guest Bathroom Lights +# - switch.tasmo_ks811d_6110_kitchen_a # Main Kitchen, Main Lights +# - switch.tasmo_ks811d_6110_kitchen_b # Main Kitchen, Bench Lights +# - switch.tasmo_ks811s_2940_hallway_1a # Hallway Main Lights +# - switch.tasmo_ks811d_1701_stairs_2a # Stairs, Lower ceiling lights +# - switch.tasmo_ks811t_0702_lounge_3a # Lounge Main, South +# - switch.tasmo_ks811t_0702_lounge_3b # Lounge Main, Middle +# - switch.tasmo_ks811t_0702_lounge_3c # Lounge Main, North (above stairs) +# - switch.tasmo_ks811t_0707_downstloun_2a # Foxhole Lounge Main Lights +# - switch.tasmo_ks811t_0707_downstloun_2b # Foxhole Lounge Wall Lights +# - switch.tasmo_ks811s_3136_downstbed2_1a # Foxhole Craft Room Lights +# - switch.tasmo_ks811t_3642_downstbed1_1a # Foxhole Main Bedroom, Main Lights +# - switch.tasmo_ks811t_2192_downstkitch_1a # Foxhole Kitchen Entry Lights +# - switch.tasmo_ks811t_2192_downstkitch_1b # Foxhole Kitchen Main Lights +# - switch.tasmo_ks811t_1181_downstbath_a # Foxhole Downstairs Bathroom Main Lights +# - switch.tasmo_s4chan_4231_underhouselights_b # Underhouse Main Lights + +switch: + - platform: group + name: Simulation Lights + # Lights included in 'away from home' random patternsentities: + entities: + - switch.tasmo_ks811d_1242_entrance_a # Entranceway Main Lights + - switch.tasmo_ks811d_0302_entrybath_a # Entranceway Guest Bathroom Lights + - switch.tasmo_ks811d_6110_kitchen_a # Main Kitchen, Main Lights + - switch.tasmo_ks811d_6110_kitchen_b # Main Kitchen, Bench Lights + - switch.main_hallway_lightswitch_tasmo_ks811s_2940_hallway_1a # Hallway Main Lights + - switch.tasmo_ks811d_1701_stairs_2a # Stairs, Lower ceiling lights + - switch.tasmo_ks811t_0702_lounge_3a # Lounge Main, South + - switch.tasmo_ks811t_0702_lounge_3b # Lounge Main, Middle + - switch.tasmo_ks811t_0702_lounge_3c # Lounge Main, North (above stairs) + - switch.tasmo_ks811t_0707_downstloun_2a # Foxhole Lounge Main Lights + - switch.tasmo_ks811t_0707_downstloun_2b # Foxhole Lounge Wall Lights + - switch.tasmo_ks811s_3136_downstbed2_1a # Foxhole Craft Room Lights + - switch.tasmo_ks811t_3642_downstbed1_1a # Foxhole Main Bedroom, Main Lights + - switch.tasmo_ks811t_2192_downstkitch_1a # Foxhole Kitchen Entry Lights + - switch.tasmo_ks811t_2192_downstkitch_1b # Foxhole Kitchen Main Lights + - switch.tasmo_ks811t_1181_downstbath_a # Foxhole Downstairs Bathroom Main Lights + - switch.tasmo_s4chan_4231_underhouselights_b # Underhouse Main Lights diff --git a/packages/total_power_sum_template.yaml b/packages/total_power_sum_template.yaml deleted file mode 100644 index 8b13789..0000000 --- a/packages/total_power_sum_template.yaml +++ /dev/null @@ -1 +0,0 @@ -