-
Notifications
You must be signed in to change notification settings - Fork 729
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
Add Tuya pool sensor quirk _TZE200_v1jqz5cy
#3673
base: dev
Are you sure you want to change the base?
Add Tuya pool sensor quirk _TZE200_v1jqz5cy
#3673
Conversation
Fixing pre-commit failures |
zhaquirks/tuya/ts0601_pool_sensor.py
Outdated
# Create a quirks v2 of Tuya's EnchantedDevice as we need Tuya spells | ||
EnchantedDevice.__bases__ = (CustomDeviceV2,) | ||
|
||
|
||
class EnchantedDeviceV2(EnchantedDevice): | ||
"""Updated version of EnchantedDevice based on CustomDeviceV2.""" | ||
|
||
tuya_spell_data_query: bool = True # Enable data query spell |
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.
This can be done properly when #3661 is implemented. (Although I'd like to avoid duplicating the spell code in that PR if that's possible in a clean way.)
I think this implementation might cause the other tests to break at the moment(?)
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 changed the implementation so it doesn't conflict with the tests.
_TZE200_v1jqz5cy
Regarding unit validation, we're also working on fixing this: zigpy/zha#327 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3673 +/- ##
==========================================
+ Coverage 90.40% 90.44% +0.04%
==========================================
Files 320 321 +1
Lines 10490 10534 +44
==========================================
+ Hits 9483 9527 +44
Misses 1007 1007 ☔ View full report in Codecov by Sentry. |
02075aa
to
b657708
Compare
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.
You should be able to set custom units now for the sensors you couldn't add previously.
|
||
( | ||
TuyaQuirkBuilder("_TZE200_v1jqz5cy", "TS0601") | ||
.device_class(EnchantedDeviceV2) |
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.
Use .tuya_enchantment()
instead.
( | ||
TuyaQuirkBuilder("_TZE200_v1jqz5cy", "TS0601") | ||
.device_class(EnchantedDeviceV2) | ||
.replaces(TuyaPoolManufCluster) |
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.
Use .add_to_registry(replacement_cluster=TuyaPoolManufCluster)
TuyaQuirkBuilder("_TZE200_v1jqz5cy", "TS0601") | ||
.device_class(EnchantedDeviceV2) | ||
.replaces(TuyaPoolManufCluster) | ||
.tuya_battery(dp_id=7, power_cfg=TuyaPowerConfigurationCluster, scale=1) |
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.
We can use the newer style here, .tuya_battery(dp_id=7, battery_type=BatterySize.Other, battery_qty=1, battery_voltage=30, scale=1)
Or whatever the real values are.
b657708
to
7120144
Compare
type=t.uint16_t, | ||
state_class=SensorStateClass.MEASUREMENT, | ||
translation_key="total_dissolved_solids", | ||
fallback_name="Total Dissolved Solids", |
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.
HA naming requires all names to be like this: "Total dissolved solids"
So only the first word can start with a capital letter, abbreviations and "brand names" excluded.
Proposed change
This is an initial implementation of a standalone v2 quirk for _TZE200_v1jqz5cy Tuya Pool Sensor that works without HA or other modifications.
Additional information
What it does:
What it does not do:
All sensors look pretty good to me, and the device on battery runs great. My only concern is chlorine seems to not change, but my CL pool levels are super low.
Suggested next steps:
Checklist
pre-commit
checks pass / the code has been formatted using Black