|
| 1 | +"""Third Reality temperature and humidity sensor devices.""" |
| 2 | + |
| 3 | +from typing import Final |
| 4 | + |
| 5 | +from zigpy.quirks import CustomCluster |
| 6 | +from zigpy.quirks.v2 import QuirkBuilder |
| 7 | +import zigpy.types as t |
| 8 | +from zigpy.zcl.clusters.general import PollControl |
| 9 | +from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef |
| 10 | +from zigpy.quirks.v2.homeassistant import UnitOfTemperature, PERCENTAGE |
| 11 | + |
| 12 | +class ThirdRealityTemperatureAndHumidityCluster(CustomCluster): |
| 13 | + """Third Reality's temperature and humidity sensor lite private cluster.""" |
| 14 | + |
| 15 | + cluster_id = 0xFF01 |
| 16 | + |
| 17 | + class AttributeDefs(BaseAttributeDefs): |
| 18 | + """Define the attributes of a private cluster.""" |
| 19 | + |
| 20 | + temperature_correction_fahrenheit: Final = ZCLAttributeDef( |
| 21 | + id=0x0033, |
| 22 | + type=t.int16s, |
| 23 | + is_manufacturer_specific=True, |
| 24 | + ) |
| 25 | + |
| 26 | + temperature_correction_celsius: Final = ZCLAttributeDef( |
| 27 | + id=0x0031, |
| 28 | + type=t.int16s, |
| 29 | + is_manufacturer_specific=True, |
| 30 | + ) |
| 31 | + |
| 32 | + humidity_correction: Final = ZCLAttributeDef( |
| 33 | + id=0x0032, |
| 34 | + type=t.int16s, |
| 35 | + is_manufacturer_specific=True, |
| 36 | + ) |
| 37 | + |
| 38 | + |
| 39 | +( |
| 40 | + QuirkBuilder("Third Reality, Inc", "3RTHS0224Z") |
| 41 | + .replaces(ThirdRealityTemperatureAndHumidityCluster) |
| 42 | + .removes(PollControl.cluster_id) |
| 43 | + .number( |
| 44 | + attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_celsius.name, |
| 45 | + min_value=-10000, |
| 46 | + max_value=10000, |
| 47 | + multiplier=0.01, |
| 48 | + step=0.1, |
| 49 | + unit=UnitOfTemperature.CELSIUS, |
| 50 | + cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, |
| 51 | + translation_key="temperature_correction_celsius", |
| 52 | + fallback_name="Celsius correction", |
| 53 | + ) |
| 54 | + .number( |
| 55 | + attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_fahrenheit.name, |
| 56 | + min_value=-10000, |
| 57 | + max_value=10000, |
| 58 | + multiplier=0.01, |
| 59 | + step=0.1, |
| 60 | + unit=UnitOfTemperature.FAHRENHEIT, |
| 61 | + cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, |
| 62 | + translation_key="temperature_correction_fahrenheit", |
| 63 | + fallback_name="Fahrenheit correction", |
| 64 | + ) |
| 65 | + .number( |
| 66 | + attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.humidity_correction.name, |
| 67 | + min_value=-10000, |
| 68 | + max_value=10000, |
| 69 | + multiplier=0.01, |
| 70 | + step=0.1, |
| 71 | + unit=PERCENTAGE, |
| 72 | + cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, |
| 73 | + translation_key="humidity_correction", |
| 74 | + fallback_name="Humidity Correction", |
| 75 | + ) |
| 76 | + .add_to_registry() |
| 77 | +) |
0 commit comments