-
Notifications
You must be signed in to change notification settings - Fork 693
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
Convert Sinope light to new style AttributeDefs, add ZHA events #3313
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3313 +/- ##
==========================================
+ Coverage 88.49% 88.72% +0.23%
==========================================
Files 305 306 +1
Lines 9621 9811 +190
==========================================
+ Hits 8514 8705 +191
+ Misses 1107 1106 -1 ☔ View full report in Codecov by Sentry. |
So we will need to do the same in sinope thermostat.py, sensor.py and switch.py |
Ok I'm almost finish with the changes for thermostat.py, switch.py and sensor.py.
How do you change the AttributeDefs
|
@claudegel I don't know for sure, but my guess would be that you can probably inherit from the ZHA thermostat cluster attribute defs, something like this: class AttributeDefs(Thermostat.AttributeDefs):
... Btw, thank you for all the work you've done on supporting Sinope devices in ZHA! |
Thanks I'll push a PR tomorrow for thermostat, switch and sensor |
I've tried this but the attribute is not added to IasZone cluster:
Any idea ? |
Was able to fix like this:
If I replace foundation.BaseAttributeDefs by foundation.ZCLAttributeDef it is not working and atribute leak_status is not added |
I got it ... a stupid indentation that was not noticed in the log |
@TheJulianJES - Anything missing in this PR to merge up? |
Maybe change line
by |
fe60a43
to
0e3e816
Compare
Good point, changed it. |
@TheJulianJES - another bump, anything else needed to merge this? |
There's no need to ping me. It'll be looked at when I (or someone else) has time. |
Look good. Thank you |
0e3e816
to
7086191
Compare
7086191
to
d1a0677
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.
AttributeDefs
changes look good. The action_report
stuff seems fine as well, I think.
|
||
|
||
@pytest.mark.parametrize("quirk", (SinopeTechnologieslight,)) | ||
async def test_sinope_light_switch_reporting(zigpy_device_from_quirk, quirk): |
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.
Tbh, I'm not sure we really need this test in zha quirks? We're not really testing any quirk specific code here, right?
(maybe except that the attribute exists)
We can leave this in for now though.
] = None, | ||
): | ||
"""Handle the cluster command.""" | ||
self.debug( |
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 leave it like this for now, but this causes a zigpy
log. We might want to use our own logger here, since that'll clearly be zhaquirks.sinope
. Other quirks aren't consistent about this though.
The string does include "Sinope" at least, so that's good.
@@ -23,7 +23,7 @@ | |||
|
|||
SINOPE = "Sinope Technologies" | |||
SINOPE_MANUFACTURER_CLUSTER_ID = 0xFF01 | |||
ATTRIBUTE_ACTION = "actionReport" | |||
ATTRIBUTE_ACTION = "action_report" |
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.
Changing this might cause issues with current automations that do not use device triggers, right?
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, let's try this.
Proposed change
Add ability for Sinope light switches to handle routing attribute reports on the manufacturer cluster attribute
action_report
as ZHA events.Additional information
Related PR zigpy/zha/pull/153 made it so that
action_report
doesn't need to be manually configured for reporting (as shown by @claudegel here: https://github.com/claudegel/sinope-zha?tab=readme-ov-file#a-create-the-reporting-).Checklist
pre-commit
checks pass / the code has been formatted using Black