-
Notifications
You must be signed in to change notification settings - Fork 807
Add Senoro door sensor _TZE200_ytx9fudw
#4086
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
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #4086 +/- ##
=======================================
Coverage 91.20% 91.20%
=======================================
Files 335 336 +1
Lines 10889 10898 +9
=======================================
+ Hits 9931 9940 +9
Misses 958 958 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…oro Window Sensor code
… class definitions for improved clarity
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.
Thanks for the PR. I've added some comments.
attribute_name="alarm", | ||
entity_type=EntityType.STANDARD, | ||
translation_key="alarm", | ||
fallback_name="Tamper Alarm", |
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.
To follow HA naming conventions, only the first word can start with an uppercase character (excluding abbreviations). So, this should be "Tamper alarm".
fallback_name="Tamper Alarm", | |
fallback_name="Tamper alarm", |
.tuya_switch( | ||
dp_id=16, | ||
attribute_name="alarm", | ||
entity_type=EntityType.STANDARD, | ||
translation_key="alarm", | ||
fallback_name="Tamper Alarm", |
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.
Since the "Tamper alarm" is a switch (and not a binary sensor), what's the difference in device behavior when the switch is on or off?
.tuya_switch( | ||
dp_id=16, | ||
attribute_name="alarm", | ||
entity_type=EntityType.STANDARD, |
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.
Also, should the "Tamper alarm" not be a configuration entity (default for quirks v2 switches) instead?
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.
If this is supposed to be a binary sensor, we should also set:
device_class=BinarySensorDeviceClass.TAMPER,
entity_type=EntityType.DIAGNOSTIC,
fallback_name="Tamper",
No translation key is required then, as the default device class name will be used, which is "Tamper".
The fallback name will not be used, but still needs to be present.
open = 0 | ||
closed = 1 | ||
tilted = 2 |
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.
Let's make these uppercase to follow other enums:
open = 0 | |
closed = 1 | |
tilted = 2 | |
Open = 0 | |
Closed = 1 | |
Tilted = 2 |
Due to some ZHA limitations, these are not translateable for now, but we'll work on changing that in the future.
Related PR: zigpy/zha#86
@@ -0,0 +1 @@ | |||
"""Module for Senoro quirks implementations.""" |
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.
Since this is a (white-label) Tuya device, let's remove this and put the quirk file (named something like tuya_door.py
) in the tuya
folder.
translation_key="opening_state", | ||
fallback_name="Opening state", |
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.
Let's move translation_key
and fallback_name
parameters to the bottom, to follow the style with how other quirks v2 entities are defined.
translation_key="opening_state", | ||
fallback_name="Opening state", |
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.
Also, should we only call this "Opening" or "Door" (removing the "state" part) to better match with other entity names in HA?
_TZE200_ytx9fudw
Proposed change
Support for the window/door contact from Senoro.
Additional information
Currently not supported.
Tested with hardware device as external quirk.
Checklist
pre-commit
checks pass / the code has been formatted using Black