-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Mi Aquara Door Sensor - Missed updates when contact toggled quickly #1511
Comments
Sorry for the delays, I cannot reproduce this, it seems that the events are also captured by zigbee2mqtt. ( Can you share your |
Here is my configuration.yaml file. The debounce was me trying to figure out this issue, but it doesn't seem to have any effect.
|
So without If so, could you add to https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/extension/deviceReceive.js#L40
|
The issue still exists without debounce, and I just double checked it. Here is the log with that line added |
In this log I don't see the problem.
|
On line 68 there is an attReport with the "onOff":0 parameter, which from what I can tell looking at the logs is the inverse of the current status, so it should report contact status true to MQTT but that last one seems to get skipped for whatever reason. As far as I can tell this is what the problem is, but it could also be related to the last attReport which seems to have some weird data in it. |
Good catch, the last Can you change https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js#L650 to if (msg.data.data.hasOwnProperty('65281') && msg.data.data['65281'].hasOwnProperty('100')) { |
Ok I have tried that this morning. It seems to be better so far but I will have to do a bit more testing throughout the day. I had a thought that the strange message might be something xiaomi added into the sensor so that just in case the fast toggling gets missed by their gateway, that extra message gets sent afterwards to make sure the gateway has the proper status. |
I have been testing it today, and found that filtering out those messages has made it a lot more reliable, but it still isn't 100% perfect at picking up the quick toggles. It seems like this time the issue isn't zigbee2mqtt missing packets, it looks like in some situations the sensor won't send the genOnOff command for restoring to normal if the contact is toggled quickly enough. However it seems to prefer to send the genBasic command after a short period of time. After some testing I have been able to get genBasic commands for both states, and found that the parameter that differs is "4", looks like it is 5032 for true, and 17320 for false. Converting the numbers to hex it comes out as 0x13A8 and 0x43A8, so it looks as if some bits change based on the contact status but other remain constant. Not really sure what to make of this, is it possible to add in decoding for these packets? |
@dasrue the |
It looks like I have the same issue. Sometimes my door sensor in HA stays open even when the door itself is closed. |
The code change above did not bring any difference. Yesterday again both sensors stayed in open state. Still Aqara device sent state update to closed together with next alive message in about an hour, so internally the sensor knew it is closed but for some reason this information did not make it to HA. Mija device is still open since door has not been opened yet. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
After more testing, I think doing the code change mentioned above on the zigbee-shepard converters is worth pulling. I have not been able to make any sense of the genBasic messages so I think that would be the best we can do. |
@dasrue thanks for reporting back, added it, assumed this can be closed know. |
Bug Report
I have been testing some of these sensors using the front door of my office. I found that this door does a little bounce when you close it, and this causes the sensor to trigger twice quickly when the door gets closed. This second message gets missed, and zigbee2mqtt reports that the door is open all the time. I have attached the debug logs, and it looks like the information is being picked up by zigbee-shepard but being missed by zigbee2mqtt.
See log here:
https://gist.github.com/dasrue/97771acf2089cdb8da364000b60291b7
Debug Info
zigbee2mqtt version 1.3.1 (commit #39d6a8e)
CC253X firmware version: CC2531ZNP-Prod_20190223
The text was updated successfully, but these errors were encountered: