-
Notifications
You must be signed in to change notification settings - Fork 740
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 quirk for Aqara P1 contact sensor #2822
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #2822 +/- ##
==========================================
+ Coverage 87.35% 87.43% +0.08%
==========================================
Files 287 291 +4
Lines 8835 8908 +73
==========================================
+ Hits 7718 7789 +71
- Misses 1117 1119 +2 ☔ View full report in Codecov by Sentry. |
@dmulcahey thank you for having worked on this! Today, I tried it and it doesn't fully work on my side:
"out_clusters": {
"0x0006": {
"endpoint_attribute": "on_off",
"attributes": {
"0x0000": {
"attribute_name": "on_off",
"value": 1
}
},
"unsupported_attributes": {}
},
(...)
"in_clusters": {
(...)
"0x0001": {
"endpoint_attribute": "power",
"attributes": {
"0x0033": {
"attribute_name": "battery_quantity",
"value": 1
},
"0x0031": {
"attribute_name": "battery_size",
"value": 8
},
"0x0020": {
"attribute_name": "battery_voltage",
"value": 32.6
}
},
"unsupported_attributes": {}
},
Do you not have the same issues on your side? Is it possible I don't have exactly the same hardware? Here is the full .json file from ZHA for this device: zha-diagnostics.zip A while ago, I tried to play a bit with it and I noticed that sometimes, I had to invert the |
To confirm, when the magnet is near the sensor, it's showing "opened" instead of "closed"?
That could be because the magnet isn't close enough to the sensor.
You can configure it in the clusters UI for now. Go to the device page, click on the three dots on the left, then click on "Manage Zigbee device". After selecting the "clusters" tab, select the You can also change the distance by writing 1, 2, or 3 in the upper text field and then pressing "write attribute". Make sure to always leave the lower text field empty. |
@TheJulianJES: thank you for your reply!
Yes it is.
That's a good idea. It is quite close: the gap in between is around 5mm, less than the first detection distance of 10mm. (but maybe that's not the gap I should measure). If I add an extra magnet -- something that came with the sensor, rectangle, around 18mm by 10mm, I don't know what it was for -- on the existing magnet to reduce this distance, it now displays the correct status!
Thank you for the instructions! I tried to read the attribute after having pressed the button or even while opening the door but I always get an error. The logs from ZHA: we can see we get info after a few seconds, maybe after the timeout? home-assistant_zha_2023-12-24T11-43-01.078Z.zip I don't know if it is related but when I try to re-configure the device, the bindings don't work: The device is quite far from my USB dongle, and I struggled to pair it. That could explain why the bindings don't work? On the other hand, when I open the door, the HA UI always show events being fired up right away.
I tried doing this but I have the same error as when I read the field. |
Press the button on the device whilst reading or writing the attribute. |
I tried that multiple times without success. I also tried to press the button multiple times while waiting for the attribute to be read but it didn't help. Could it be due to the distance with the controller or some interferences even if I get the open and close events without issues? |
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.
Looks good.
("Note" for me that also applies here: #2821 (comment))
* Add quirk for Aqara P1 contact sensor * fix battery size * switch cluster implementation * update quirk
* Add quirk for Aqara P1 contact sensor * fix battery size * switch cluster implementation * update quirk
Hey! Thank you for your effort on this quirk! I have a Conbee ii and using a rpi 4. I have just paired the sensor with these details: It seems to be using the python script above, however for some reason it does not react when I physically try to trigger the sensor. It still stays as "open". Pairing works and connection is working fine. I downloaded the json of the diagnostics and it is as attached. zha-01J2FX0ZNCYY506T9TV5R1QX7P-LUMI lumi.magnet.ac01-7bf832946fb1e82b9231436cf856cb75.json Have you been able to get this working? The sensor I am trying to configure is MCCGQ13LM. |
@Ma1ch Make sure the firmware of your Conbee is up-to-date. Otherwise, create a new issue in this repo. |
@TheJulianJES Thanks for the advice, I have just updated the firmware and am still facing the same issue. I will create a new issue! |
@Ma1ch Remove and re-pair the sensor after updating the Conbee firmware. |
@TheJulianJES Perfect! After doing so, the light on the sensor started shining when bringing the magnet close by, so I got some response from the sensor. Did not reflect back to home assistant yet though, and I tried to reconfigure it, and the light stopped working completely. So I removed the sensor and re-paired it, and it started working, both the light on the device and the status on home assistant. This was great! I've been battling for hours with this. Battery still doesn't show and I am a little puzzled as to why it started working after I re-paired it twice, but regardless I can now start using the sensor. Thank you for your help! |
Proposed change
Title says it all. Fixes: #2349, #1295
TODO:
Additional information
Checklist
pre-commit
checks pass / the code has been formatted using Black