diff --git a/zhaquirks/thirdreality/garage.py b/zhaquirks/thirdreality/garage.py new file mode 100644 index 0000000000..61305a6dec --- /dev/null +++ b/zhaquirks/thirdreality/garage.py @@ -0,0 +1,95 @@ +"""Third Reality garage sensor devices.""" + +from typing import Final + +from zigpy.profiles import zha +from zigpy.quirks import CustomDevice +import zigpy.types as t +from zigpy.zcl.clusters.general import Basic, Ota, PowerConfiguration +from zigpy.zcl.clusters.security import IasZone +from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef + +from zhaquirks import CustomCluster +from zhaquirks.const import ( + DEVICE_TYPE, + ENDPOINTS, + INPUT_CLUSTERS, + MODELS_INFO, + OUTPUT_CLUSTERS, + PROFILE_ID, +) +from zhaquirks.thirdreality import THIRD_REALITY + +THIRD_REALITY_GARAGE_CLUSTER_ID = 0xFF01 +DELAY_OPEN_ATTR_ID = 0x0000 +ZCL_CABRATION_ATTR_ID = 0x0003 + + +class ControlMode(t.uint16_t): + """Reset mode for not clear and clear.""" + + pass + +class ThirdRealityGarageCluster(CustomCluster): + """ThirdReality Acceleration Cluster.""" + + cluster_id = THIRD_REALITY_GARAGE_CLUSTER_ID + + class AttributeDefs(BaseAttributeDefs): + """ThirdReality Acceleration Cluster.""" + + delay_open: Final = ZCLAttributeDef( + id=DELAY_OPEN_ATTR_ID, + type=ControlMode, + is_manufacturer_specific=True + ) + + zcl_cabration: Final = ZCLAttributeDef( + id=ZCL_CABRATION_ATTR_ID, + type=ControlMode, + is_manufacturer_specific=True + ) + + zcl_cabration: Final = ZCLAttributeDef( + id=ZCL_CABRATION_ATTR_ID, type=ControlMode, is_manufacturer_specific=True + ) + + +class Garage(CustomDevice): + """ThirdReality garage device.""" + + signature = { + MODELS_INFO: [(THIRD_REALITY, "3RDTS01056Z")], + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.IAS_ZONE, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + IasZone.cluster_id, + ThirdRealityGarageCluster.cluster_id, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.IAS_ZONE, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + IasZone.cluster_id, + ThirdRealityGarageCluster, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } diff --git a/zhaquirks/thirdreality/temperature_humidity_and_soil.py b/zhaquirks/thirdreality/temperature_humidity_and_soil.py new file mode 100644 index 0000000000..538fe87848 --- /dev/null +++ b/zhaquirks/thirdreality/temperature_humidity_and_soil.py @@ -0,0 +1,184 @@ +"""Third Reality Temperature humidity devices.""" + +from typing import Final + +from zigpy.profiles import zha +from zigpy.quirks import CustomDevice +import zigpy.types as t +from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration +from zigpy.zcl.clusters.measurement import RelativeHumidity, TemperatureMeasurement +from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef + +from zhaquirks import CustomCluster +from zhaquirks.const import ( + DEVICE_TYPE, + ENDPOINTS, + INPUT_CLUSTERS, + MODELS_INFO, + OUTPUT_CLUSTERS, + PROFILE_ID, +) +from zhaquirks.thirdreality import THIRD_REALITY + +THIRDREALITY_CLUSTER_ID = 0xFF01 + + +class ControlMode(t.int16s): + """ThirdReality Temperature humidity Cluster.""" + + pass + + +class ThirdRealityCluster(CustomCluster): + """ThirdReality Temperature humidity Cluster.""" + + cluster_id = THIRDREALITY_CLUSTER_ID + + class AttributeDefs(BaseAttributeDefs): + """Attribute definitions.""" + + Celsius_degree_calibration: Final = ZCLAttributeDef( + id=0x0031, + type=ControlMode, + is_manufacturer_specific=True, + ) + + humidity_calibration: Final = ZCLAttributeDef( + id=0x0032, + type=ControlMode, + is_manufacturer_specific=True, + ) + + Fahrenheit_degree_calibration: Final = ZCLAttributeDef( + id=0x0033, + type=ControlMode, + is_manufacturer_specific=True, + ) + + +class Temperature_humidity(CustomDevice): + """ThirdReality Temperature humidity device.""" + + signature = { + MODELS_INFO: [(THIRD_REALITY, "3RTHS24BZ")], + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster.cluster_id, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + + +class Temperature_humidity_lite(CustomDevice): + """ThirdReality Temperature humidity lite device.""" + + signature = { + MODELS_INFO: [(THIRD_REALITY, "3RTHS0224Z")], + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + Identify.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster.cluster_id, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + Identify.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + + +class Soil_Moisture_Sensor(CustomDevice): + """ThirdReality Soil Moisture Sensor device.""" + + signature = { + MODELS_INFO: [(THIRD_REALITY, "3RSM0147Z")], + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster.cluster_id, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + } + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR, + INPUT_CLUSTERS: [ + Basic.cluster_id, + PowerConfiguration.cluster_id, + TemperatureMeasurement.cluster_id, + RelativeHumidity.cluster_id, + ThirdRealityCluster, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + } + }, + }