-
Notifications
You must be signed in to change notification settings - Fork 761
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 Niko Connected single/double switch #3701
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 #3701 +/- ##
==========================================
+ Coverage 90.94% 91.09% +0.15%
==========================================
Files 326 328 +2
Lines 10585 10775 +190
==========================================
+ Hits 9626 9816 +190
Misses 959 959 ☔ View full report in Codecov by Sentry. |
8a62ae6
to
a96af16
Compare
Feel free to already test and provide feedback; perhaps some points before this PR is merged. Improvements
Functionality
Any feedback on the above would be helpful! |
f8c0652
to
84cc4d8
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.
I'll need to go through this properly when I find some free time, but one thing:
Bus
shouldn't really be needed anymore. The docs/README really have to be updated, but I just haven't found the time yet.
You can access update_attribute
and other methods on a different cluster directly (from your current cluster) using something like this:
zha-device-handlers/zhaquirks/xiaomi/aqara/motion_agl1.py
Lines 137 to 140 in b15a6dc
self.endpoint.ias_zone.update_attribute( | |
IasZone.AttributeDefs.zone_status.id, | |
IasZone.ZoneStatus.Alarm_1 if value == AqaraMotion.Moving else 0, | |
) |
You can also call methods on a different endpoint with
self.endpoint.device.endpoints[2].ias_zone.do_something()
for example (IIRC).
ias_zone
is the ep_attribute
of a cluster. You can also access it with self.endpoint.in_clusters[IasZone.cluster_id]
e.g.
Doing this might avoid needing some of the tasks? Again, I have to look at this properly some time soon, but it seems a bit weird looking at it now.
Same goes for the inheritance with NikoCluster
/the other Niko clusters.
And the NikoQuirkBuilder
also is a bit out of the usual pattern that we wanted to have with "quirks v2", though I see why you're doing it.
Again, this isn't a review. Just some thoughts whilst having a very quick look at this.
Not sure why apply_custom_configuration
wouldn't be working.. Your HA version is somewhat up-do-date?
You could also try overriding it in the CustomDeviceV2
class: https://github.com/zigpy/zigpy/blob/08f8f99df3d235aa0c0154331cb7c5b3dffde3e1/zigpy/quirks/__init__.py#L119-L137
The same quirk also appears to work fine with the NIKO zigbee dimmer:
|
1918f41
to
354cf88
Compare
354cf88
to
e6c8ad3
Compare
Thanks @TheJulianJES for looking at this!
I see! I rewrote the code without
The main thing this class now does is implementing the listener mechanism.
Yeah, there's quite some reuse between the switches. While I could have a static I did get rid of Niko-specific device classes though, by putting all their functionality in the quirk builder.
Latest versions, yes. Had trouble getting The code's been updated based on your suggestions. I'll still do some testing myself, and would be happy if others provided feedback as well. @ccantill That's neat! I don't have a dimmer here to test though. Would it need anything beyond the code you've added? There might be more dimmer-specific properties. |
Nothing additional needed. There might be more functionalities but I have no idea how to go about discovering those. |
Proposed change
Add support for the Niko Connected single switch (
552-721X1
) and Connected double switch (552-721X2
).Additional information
Request and previous work
Functionality
Events
Configuration
Checklist
pre-commit
checks pass / the code has been formatted using Black