-
Notifications
You must be signed in to change notification settings - Fork 908
Add Third Reality temperature and humidity sensor lite settings #4387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| """Third Reality temperature and humidity sensor devices.""" | ||
|
|
||
| from typing import Final | ||
|
|
||
| from zigpy.quirks import CustomCluster | ||
| from zigpy.quirks.v2 import NumberDeviceClass, QuirkBuilder | ||
| from zigpy.quirks.v2.homeassistant import PERCENTAGE, UnitOfTemperature | ||
| import zigpy.types as t | ||
| from zigpy.zcl.clusters.general import PollControl | ||
| from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef | ||
|
|
||
|
|
||
| class ThirdRealityTemperatureAndHumidityCluster(CustomCluster): | ||
| """Third Reality's temperature and humidity sensor lite private cluster.""" | ||
|
|
||
| cluster_id = 0xFF01 | ||
|
|
||
| class AttributeDefs(BaseAttributeDefs): | ||
| """Define the attributes of a private cluster.""" | ||
|
|
||
| temperature_correction_fahrenheit: Final = ZCLAttributeDef( | ||
| id=0x0033, | ||
| type=t.int16s, | ||
| is_manufacturer_specific=True, | ||
| ) | ||
|
|
||
| temperature_correction_celsius: Final = ZCLAttributeDef( | ||
| id=0x0031, | ||
| type=t.int16s, | ||
| is_manufacturer_specific=True, | ||
| ) | ||
|
|
||
| humidity_correction: Final = ZCLAttributeDef( | ||
| id=0x0032, | ||
| type=t.int16s, | ||
| is_manufacturer_specific=True, | ||
| ) | ||
|
|
||
|
|
||
| ( | ||
| QuirkBuilder("Third Reality, Inc", "3RTHS0224Z") | ||
| .replaces(ThirdRealityTemperatureAndHumidityCluster) | ||
| .removes(PollControl.cluster_id) | ||
| .number( | ||
| attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_celsius.name, | ||
| cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, | ||
| min_value=-10000, | ||
| max_value=10000, | ||
|
Comment on lines
+47
to
+48
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this a bit much to allow for?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just use
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't notice the |
||
| multiplier=0.01, | ||
| step=0.1, | ||
| device_class=NumberDeviceClass.TEMPERATURE, | ||
| unit=UnitOfTemperature.CELSIUS, | ||
| translation_key="temperature_offset_celsius", | ||
| fallback_name="Celsius offset", | ||
| ) | ||
| .number( | ||
| attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.temperature_correction_fahrenheit.name, | ||
| cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, | ||
| min_value=-10000, | ||
| max_value=10000, | ||
| multiplier=0.01, | ||
| step=0.1, | ||
| device_class=NumberDeviceClass.TEMPERATURE, | ||
| unit=UnitOfTemperature.FAHRENHEIT, | ||
| translation_key="temperature_offset_fahrenheit", | ||
| fallback_name="Fahrenheit offset", | ||
| ) | ||
| .number( | ||
| attribute_name=ThirdRealityTemperatureAndHumidityCluster.AttributeDefs.humidity_correction.name, | ||
| cluster_id=ThirdRealityTemperatureAndHumidityCluster.cluster_id, | ||
| min_value=-10000, | ||
| max_value=10000, | ||
| multiplier=0.01, | ||
| step=0.1, | ||
| device_class=NumberDeviceClass.HUMIDITY, | ||
| unit=PERCENTAGE, | ||
| translation_key="humidity_offset", | ||
| fallback_name="Humidity offset", | ||
| ) | ||
| .add_to_registry() | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll likely shorten this class name a bit in a follow-up PR, where I can go over all of the added Third Reality quirks.