-
Notifications
You must be signed in to change notification settings - Fork 771
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 Sonoff SNZB-03P motion sensor #3979
base: dev
Are you sure you want to change the base?
Conversation
46f5854
to
0847f71
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3979 +/- ##
=======================================
Coverage 91.04% 91.05%
=======================================
Files 331 332 +1
Lines 10698 10716 +18
=======================================
+ Hits 9740 9757 +17
- Misses 958 959 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
( | ||
QuirkBuilder("eWeLink", "SNZB-03P") | ||
.replaces(SonoffIlluminationCluster) | ||
.removes(IasZone.cluster_id) # IasZone cluster 0x0500: remove motion detection |
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.
So the IasZone
cluster doesn't do anything at all?
Can we use .prevent_default_entity_creation(endpoint_id=1, cluster_id=IasZone.cluster_id)
here instead?
It's a new functionality that doesn't entirely remove the cluster for us, just disables the auto discovery for ZHA entities on that cluster.
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.
Yes, cluster is always "unavailable".
@property | ||
def _is_manuf_specific(self): | ||
return False |
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 think we can use manufacturer_id_override: t.uint16_t = foundation.ZCLHeader.NO_MANUFACTURER_ID
instead. See this PR as an example: https://github.com/zigpy/zha-device-handlers/pull/3910/files#diff-6c9212ca1af0b4604a20edb89247ceb6d30b010041e81fde812465a2f73a3ccbR24
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.
.replaces(SonoffIlluminationCluster) | ||
.removes(IasZone.cluster_id) # IasZone cluster 0x0500: remove motion detection | ||
.number( | ||
OccupancySensing.AttributeDefs.ultrasonic_o_to_u_delay.name, |
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.
Ah, interesting. This is a default attribute. It's also used by the Hue motion sensors, though it's reported as an "unsupported attribute" if we read it during pairing, for some reason, so I've not added that as a config entity for now. We could add the entities via quirks v2 for both sensors, but we might be able to add this as a general entity in ZHA. I'll have to come back to 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.
If removed, then same issue like #3979 (comment)
@property | ||
def _is_manuf_specific(self): | ||
return False |
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.
Z2M seems to specify a manufacturer code: https://github.com/Koenkk/zigbee-herdsman-converters/blob/216ba1a56f1b21fda7de7204839f0fb838df0b85/src/devices/sonoff.ts#L1162
Do we even need this at all? By default, zigpy will use the manufacturer code for the device if the attribute is marked as is_manufacturer_specific
(it is) and if the cluster is in the manufacturer specific range (it is).
I guess this is only really needed if we explicitly poll/read the attribute ourselves though (through the "Manage Zigbee device -> Clusters" debug menu).
Thanks for huge feedback. This PR is only request with originial code from @BillyBlaze and with (little) mods. I have zero experience with Python and device handlers, bit i will try it. |
@TheJulianJES What next now? If i use some from your suggest, some functions wrong. |
Proposed change
Checklist
pre-commit
checks pass / the code has been formatted using Black