-
Notifications
You must be signed in to change notification settings - Fork 879
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
Merged
+36
−0
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f2e06f7
Add Senoro quirks implementation
ChristianGr1974 cb4f638
Apply pre-commit auto fixes
pre-commit-ci[bot] 22cf16a
Add Senoro quirks implementation
ChristianGr1974 e942166
Add Senoro quirks implementation
ChristianGr1974 5551725
Fix formatting by adding blank lines for improved readability in Sens…
ChristianGr1974 279c604
Merge branch 'dev' of https://github.com/ChristianGr1974/zha-device-h…
ChristianGr1974 8c320b1
Apply pre-commit auto fixes
pre-commit-ci[bot] ad38153
Refactor Sensoro Window Sensor code by removing redundant imports and…
ChristianGr1974 a4f90d8
Merge branch 'dev' of https://github.com/ChristianGr1974/zha-device-h…
ChristianGr1974 a7a3654
Apply pre-commit auto fixes
pre-commit-ci[bot] dc95999
Fix docstring punctuation for Sensoro Window Sensor
ChristianGr1974 b787e26
Implement Senoro Window Sensor (TS0601) quirk with battery and state …
ChristianGr1974 d8c0497
Apply pre-commit auto fixes
pre-commit-ci[bot] ab16b88
Remove tamper alarm
ChristianGr1974 ca6d775
Merge branch 'dev' of https://github.com/ChristianGr1974/zha-device-h…
ChristianGr1974 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Senoro Window Sensor (TS0601).""" | ||
|
||
from zigpy.quirks.v2 import EntityPlatform, EntityType | ||
import zigpy.types as t | ||
|
||
from zhaquirks.tuya import BatterySize | ||
from zhaquirks.tuya.builder import TuyaQuirkBuilder | ||
|
||
|
||
class OpeningStateEnum(t.enum8): | ||
"""Enum for opening state.""" | ||
|
||
Open = 0 | ||
Closed = 1 | ||
Tilted = 2 | ||
|
||
|
||
( | ||
TuyaQuirkBuilder("_TZE200_ytx9fudw", "TS0601") | ||
.tuya_battery( | ||
dp_id=2, | ||
battery_type=BatterySize.CR2032, | ||
battery_qty=3, | ||
) | ||
.tuya_enum( | ||
dp_id=101, | ||
attribute_name="opening_state", | ||
enum_class=OpeningStateEnum, | ||
entity_type=EntityType.STANDARD, | ||
entity_platform=EntityPlatform.SENSOR, | ||
translation_key="opening", | ||
fallback_name="Opening", | ||
) | ||
.tuya_switch( | ||
dp_id=16, | ||
attribute_name="alarm", | ||
entity_type=EntityType.STANDARD, | ||
translation_key="alarm", | ||
fallback_name="Tamper alarm", | ||
) | ||
.skip_configuration() | ||
.add_to_registry() | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 switch cannot be turned on (when it's off) to turn on the alarm manually, we should think about doing the following instead:
Have a binary sensor entity (for dp 16) (with
BinarySensorDeviceClass.TAMPER
to show nicely in HA) and also provide a "write attribute button" to reset the dp back to0
/clear.Implementing the button might require us to map the dp with
tuya_dp
and just use normalbinary_sensor
andwrite_attr_button
(instead of the Tuya variants), or just use the mapped dp fromtuya_binary_sensor
then. That might work as well, but I'll take another look at this, since it's not exactly easy.I think the approach with a binary sensor and button to reset might be a bit nicer than a switch entity though (that you cannot turn on).
I'll come back to this, but the beta cutoff for 2025.6.0 is already tomorrow, so we likely won't make that, as there are still some other things I have to take a look at.
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.
Have you had time to think about this?
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.
@TheJulianJES fyi
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.
Can we remove the "Tamper alarm" from this initial PR? We can hopefully get the other stuff into 2025.7.0 then.
I've not had much time yet, unfortunately. You can immediately create another PR with the same "Tamper alarm" switch, so it's not forgotten about.
When I get to it, I can try to push/comment the button/binary sensor alternative. But if you can get that working, that'd be great too.
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.
@TheJulianJES
ok, so I removed the tamper alarm switch. But currently, if the alarm turns on, you can't turn it off. The device activates the alarm for three minutes, then it turns off, or you have to remove the batteries...
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.
Ok, I'll come back to you with the button and binary sensor entity for turning off the tamper alarm.