| 
 | 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 NumberDeviceClass, QuirkBuilder  | 
 | 7 | +from zigpy.quirks.v2.homeassistant import PERCENTAGE, UnitOfTemperature  | 
 | 8 | +import zigpy.types as t  | 
 | 9 | +from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef  | 
 | 10 | + | 
 | 11 | + | 
 | 12 | +class ThirdRealityTemperatureAndHumidityCluster(CustomCluster):  | 
 | 13 | +    """Third Reality's temperature and humidity sensor 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", "3RTHS24BZ")  | 
 | 41 | +    .replaces(ThirdRealityTemperatureAndHumidityCluster)  | 
 | 42 | +    .number(  | 
 | 43 | +        attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_celsius.name,  | 
 | 44 | +        cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id,  | 
 | 45 | +        min_value=-10000,  | 
 | 46 | +        max_value=10000,  | 
 | 47 | +        multiplier=0.01,  | 
 | 48 | +        step=0.1,  | 
 | 49 | +        device_class=NumberDeviceClass.TEMPERATURE,  | 
 | 50 | +        unit=UnitOfTemperature.CELSIUS,  | 
 | 51 | +        translation_key="temperature_offset_celsius",  | 
 | 52 | +        fallback_name="Celsius offset",  | 
 | 53 | +    )  | 
 | 54 | +    .number(  | 
 | 55 | +        attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_fahrenheit.name,  | 
 | 56 | +        cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id,  | 
 | 57 | +        min_value=-10000,  | 
 | 58 | +        max_value=10000,  | 
 | 59 | +        multiplier=0.01,  | 
 | 60 | +        step=0.1,  | 
 | 61 | +        device_class=NumberDeviceClass.TEMPERATURE,  | 
 | 62 | +        unit=UnitOfTemperature.FAHRENHEIT,  | 
 | 63 | +        translation_key="temperature_offset_fahrenheit",  | 
 | 64 | +        fallback_name="Fahrenheit offset",  | 
 | 65 | +    )  | 
 | 66 | +    .number(  | 
 | 67 | +        attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.humidity_correction.name,  | 
 | 68 | +        cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id,  | 
 | 69 | +        min_value=-10000,  | 
 | 70 | +        max_value=10000,  | 
 | 71 | +        multiplier=0.01,  | 
 | 72 | +        step=0.1,  | 
 | 73 | +        device_class=NumberDeviceClass.HUMIDITY,  | 
 | 74 | +        unit=PERCENTAGE,  | 
 | 75 | +        translation_key="humidity_offset",  | 
 | 76 | +        fallback_name="Humidity offset",  | 
 | 77 | +    )  | 
 | 78 | +    .add_to_registry()  | 
 | 79 | +)  | 
0 commit comments