-
Notifications
You must be signed in to change notification settings - Fork 703
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 support for QUAD-ZIG-SW from smarthjemmet.dk #3400
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3400 +/- ##
==========================================
+ Coverage 88.72% 89.35% +0.62%
==========================================
Files 306 310 +4
Lines 9813 10027 +214
==========================================
+ Hits 8707 8960 +253
+ Misses 1106 1067 -39 ☔ View full report in Codecov by Sentry. |
All should be fixed now. Sorry for all the commits. |
@TheJulianJES I see that a new release was created yesterday, and mine was not included. Any idea why? The only checks failing are code coverage, which shouldn't prevent it from being merged. Was really hoping to get this quirk implemented in the next release, as I'm guessing I have to wait a few more weeks now. |
There's a few things on this PR that I'd likely change. I just haven't found the time to properly review this PR and comment all small change suggestions. I still plan to do that, of course, but there are also other PRs. |
Follows the style of other quirks where there's proper quirk defined in a `CustomDevice` class that's inherited from in other quirks that just change the `signature`, but keep the `replacement` and device triggers.
Ok, so I've pushed multiple commits now. The "refactor" commit changes the structure of the (so-called v1) quirk to have a The last commit (as of now) "Replace with v2 quirk" completely replaces the
Please test if that v2 quirk works as expected. With the v1 quirk before, the If the replacement .removes(MultistateInput.cluster_id, cluster_type=ClusterType.Client, endpoint_id=1) # remove output cluster
.adds(CustomMultistateInputCluster, endpoint_id=1) # default cluster_type is server, so it'll add an input cluster |
The test here is no longer really needed for the v2 quirk. There's no real point in testing if all the correct clusters are included. Ideally, we would send messages from the device and see if they are converted to "ZHA events" as expected in a test.
zhaquirks/smarthjemmet/quadzigsw.py
Outdated
async def bind(self): | ||
"""Prevent bind.""" | ||
return zigpy.zcl.foundation.Status.SUCCESS | ||
|
||
async def unbind(self): | ||
"""Prevent unbind.""" | ||
return zigpy.zcl.foundation.Status.SUCCESS | ||
|
||
async def _configure_reporting(self, *args, **kwargs): | ||
"""Prevent remote configure reporting.""" | ||
return ( | ||
zigpy.zcl.foundation.ConfigureReportingResponse.deserialize(b"\x00")[0], | ||
) |
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.
Unrelated to converting the whole quirk to a v2 quirk:
Are these necessary? We already set SKIP_CONFIGURATION = True
.
@TheJulianJES Hi and thanks for your effort. Unfortunately it's not working. When I am talking about V1 and V2 in terms of firmware, it's because I have one physical device with two different firmware versions. The signature of the devices are completely different, which is why I need to be able to support both signatures on the same device. V1 of the firmware came out back in 2023, and now I've updated it in late 2024. Does that make sense? For all I care, Quirk V1 or Quirk V2 doesn't matter to me. Quirk V2 looks better with the QuirkBuilder - definitely, but unfortunately it's not working as intended in this case. Regards to your "It was also missing on endpoint 1 in the replacement. I don't think that was intentional" it actually was. The physical device has 5 buttons, but only 4 of them should work as MultistateInput. The last is used for resetting the device, which is done on a firmware level. |
And for good measure, here's the old firmware (firmware V1 from 2023)'s device signature:
and here is the new firmware V2 (from late 2024) device signature:
|
@TheJulianJES Help is not really wanted. What I originally had worked perfectly. Only thing not passing is the code coverage. Is that a requirement to get it merged? |
"Help wanted" just means this needs to be looked again. A v2 quirk should work. |
Okay I see. Is it for you to look at "at some point" as a reminder? Or someone else? My question really is, do I need to take action? |
I'll take another look again at this soon. In the mean time, you can try to see if you can make the v2 quirk work if you want.
On which HA version did you test the v2 quirk? Did you test it by replacing the whole quirks library or just inserting the one quirks file as a "custom quirk" (using the ZHA config option) (recommended for testing this). |
@TheJulianJES I am doing the custom quirk with the ZHA config option. It was matched to the signature of one of the devices I tested (the old V1 firmware), but no events were shown when I pressed the buttons. Also, I appreciate the help. Let me know if there is anything I can do. |
@mortenmoulder … was any of your quirk versions working when you added them as custom quirks? I think we are many users waiting for ZHA support to happen and I would like to try deploying a quirk file if your can point to a version you tested to be working. @TheJulianJES what is missing yet before the PR can be accepted? Hope you will have the time to look at this again. Really appreciate the work you are doing. |
@OptionHenrik Yes, the quirk was working perfectly before @TheJulianJES's changes. Feel free to go look at the commit just before his changes, and grab the file from there to give it a go yourself. |
We already "skip configuration" during pairing, so we don't need this.
The device only has 5 endpoints. Endpoint 2 to 5 have MultistateInputClusters. This will account for that, as `ENDPOINT_ID: i + 1` with i ranging from 1 to 4.
This isn't really correct, but it's what the original quirk did.
I've made the changes suggested in this comment: #3400 (comment) The original PR also created a device trigger for endpoint 6, even though there the device only goes up to endpoint 5. Please try and see if these changes work now. |
event_args = {VALUE: value} | ||
self.listener_event(ZHA_SEND_EVENT, action, event_args) | ||
|
||
super()._update_attribute(0, action) |
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 the changes work, please also try and see what these additional changes to this line do:
- replacing 0 with
MultistateInput.AttributeDefs.present_value.id
in this line (sensor entity in HA?) - completely removing this line
I believe this was copied from other quirks where it doesn't actually work, as there is no attribute with id=0
on this cluster.
Works like a charm … great work so far even though it’s only a custom quirk. I hope you guys get it integrated into the standard ZHA soon |
Please also test the v2 quirk now. It was updated a few days ago. |
@mortenmoulder can confirm your quirk works with just a model name change for MULTI-ZIG-SW as well! Great job. I'll try to find time to test out @TheJulianJES changes later. |
Proposed change
Add support for smarthjemmet.dk's QUAD-ZIG-SW device.
Additional information
Works with V1 and V2 firmware.
Checklist
pre-commit
checks pass / the code has been formatted using Black