|
| 1 | +"""Tuya TY0201 temperature and humidity sensor.""" |
| 2 | + |
| 3 | +from zigpy.profiles import zha |
| 4 | +from zigpy.profiles.zha import DeviceType |
| 5 | +from zigpy.quirks import CustomDevice |
| 6 | +from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration |
| 7 | +from zigpy.zcl.clusters.measurement import RelativeHumidity, TemperatureMeasurement |
| 8 | + |
| 9 | +from zhaquirks.const import ( |
| 10 | + DEVICE_TYPE, |
| 11 | + ENDPOINTS, |
| 12 | + INPUT_CLUSTERS, |
| 13 | + MODELS_INFO, |
| 14 | + OUTPUT_CLUSTERS, |
| 15 | + PROFILE_ID, |
| 16 | +) |
| 17 | +from zhaquirks.tuya.air import TuyaAirQualityHumidity, TuyaAirQualityTemperature |
| 18 | + |
| 19 | + |
| 20 | +class TuyaTempHumiditySensor(CustomDevice): |
| 21 | + """Temu/Aliexpress temperature and humidity sensor.""" |
| 22 | + |
| 23 | + signature = { |
| 24 | + # <SimpleDescriptor endpoint=1, profile=260, device_type="0x0302" |
| 25 | + # input_clusters=["0x000", "0x0001", "0x0003", "0x0402", "0x0405"] |
| 26 | + # output_clusters=["0x0019"]> |
| 27 | + MODELS_INFO: [("_TZ3000_bjawzodf", "TY0201"), |
| 28 | + ("_TZ3000_zl1kmjqx", "TY0201")], |
| 29 | + ENDPOINTS: { |
| 30 | + 1: { |
| 31 | + PROFILE_ID: zha.PROFILE_ID, |
| 32 | + DEVICE_TYPE: DeviceType.TEMPERATURE_SENSOR, |
| 33 | + INPUT_CLUSTERS: [ |
| 34 | + Basic.cluster_id, |
| 35 | + PowerConfiguration.cluster_id, |
| 36 | + Identify.cluster_id, |
| 37 | + TemperatureMeasurement.cluster_id, |
| 38 | + RelativeHumidity.cluster_id, |
| 39 | + ], |
| 40 | + OUTPUT_CLUSTERS: [ |
| 41 | + Ota.cluster_id, |
| 42 | + ], |
| 43 | + }, |
| 44 | + }, |
| 45 | + } |
| 46 | + |
| 47 | + replacement = { |
| 48 | + ENDPOINTS: { |
| 49 | + 1: { |
| 50 | + INPUT_CLUSTERS: [ |
| 51 | + Basic.cluster_id, |
| 52 | + PowerConfiguration.cluster_id, |
| 53 | + Identify.cluster_id, |
| 54 | + TuyaAirQualityTemperature, |
| 55 | + TuyaAirQualityHumidity, |
| 56 | + ], |
| 57 | + OUTPUT_CLUSTERS: [ |
| 58 | + Ota.cluster_id, |
| 59 | + ], |
| 60 | + }, |
| 61 | + }, |
| 62 | + } |
0 commit comments