-
Notifications
You must be signed in to change notification settings - Fork 721
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
Fix Sinope device triggers #3504
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3504 +/- ##
=======================================
Coverage 89.44% 89.44%
=======================================
Files 311 311
Lines 10033 10033
=======================================
Hits 8974 8974
Misses 1059 1059 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
I noticed an issue while trying to debug this problem. To validate my fix, I added a modified copy of the Instead, I had to ssh into HA OS as root and modify the I don't know if it's possible, but it would be nice if the loading order was changed such that if a custom quirk is present and it overrides an existing quirk, it would be loaded instead of the builtin one, and not after it. Separately, I also noticed that there's a helper If all fields in device automation triggers were either validated at dev time, or better yet, automatically coerced into voluptuous supported types, quirk authors wouldn't be forced to use scalar types instead of Enum values. |
@bassdr a couple questions for you:
|
Yes, this problem is exactly why I used relative import paths. This way, you can add the
I haven't tried 2024.11.0 yet, I keep my non-dev HA setup on the last version of last month... But I'm surprised to see this PR indeed, I'll upgrade to check when I get the chance. Do you still have the exact voluptuous error it gave you? Or maybe a snippet of you automation that is giving the error? I'm personally listening to the zha event directly like this: - trigger: event
event_type: zha_event
event_data:
endpoint_id: 1
cluster_id: 65281
args:
attribute_name: action_report To test it's the right device: condition: template
value_template: |-
{{
device_id('light.upstairslightswitch_lumiere') == trigger.event.data.device_id
}} and eventually: choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.command == 'initial_press' }}"
sequence:
- action: zha.issue_zigbee_cluster_command
data:
ieee: |-
{{
device_attr('light.upstairslightswitch_lumiere', 'identifiers')
| selectattr(0,'eq','zha')
| map(attribute=1)
| first
}}
endpoint_id: 1
cluster_id: 8
cluster_type: in
command: 5
command_type: server
params:
move_mode: |-
{{
iif (trigger.event.data.args.button == 'turn_on', 'Up', 'Down')
}}
rate: 50
alias: Initial Press |
I can't find the schema of EDIT: I think I figured my original mistake: the event_args = {
ATTRIBUTE_ID: 84,
ATTRIBUTE_NAME: ATTRIBUTE_ACTION,
BUTTON: button,
DESCRIPTION: action.name,
VALUE: action.value,
}
|
I'm not sure the above is needed anymore after these PRs: #3313 and zigpy/zha#153. I got tired of writing YAML for these things (I have a whole bunch of Sinope devices, particularly light switches), so I submitted the PRs above to patch things and make it work through the UI. Here's a partial example of an automation I'm running: |
3bae0da
to
4f93c1f
Compare
4f93c1f
to
ad0c331
Compare
Can you create an issue for each of these please? You can just copy paste your comment in those. For the first one, maybe in the ZHA repo? For the second one, we should add probably add some basic tests in the quirks repo to validate device triggers IMO. |
@TheJulianJES - no problem, will do! |
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!
Proposed change
Fixes device automation triggers for the Sinope light quirk. The current definition of the automation triggers
uses the
ButtonAction
enum in thevalue
field, which throws an error from Voluptuous when passed into HA'sasync_attach_trigger
.Additional information
Not a breaking change and doesn't require anything else to be merged into HA Core.
Checklist
pre-commit
checks pass / the code has been formatted using Black