Fix ghost events for sensors - #8189
Conversation
After the refactor of sensorToMap() when an event arrived in handleSensorEvent() not only respective parent object like attr, state, config, etc. was emitted on websocket but sometimes other event objects too. The PR prevents this to filter out any item that doesn't match the events item suffix. Related forum posts: https://forum.phoscon.de/t/ghost-button-events-with-deconz-2-29-5-and-aqara-smart-button/6300/14 https://forum.phoscon.de/t/lumi-vibration-aq1-sensor-with-phantom-triggers-since-deconz-2-29-5/6305/6
|
While I'm happy with these changes, I fail to understand in full how they're addressing the mentioned issues. Setting I don't understand how superfluous web socket notifications would lead to ghost events. For a client to "see" a button event, it would need to check whether |
|
It I m right the event
Is for a change, it mean there is a change, what is the utility to send websocket notification with useless information ? For me if deconz send me a "buttonevent" it's because there is a buttonevent, no need to check the "lastupdated". No need to send periodic report with a previous button state. |
|
Yes This PR only aims to restore the messaging of earlier versions, while keeping the improvements and cleanups from the refactor PR. What concerns me more is that some items for which ghost events were seen must have had push flags set. For example from the issue in the forum the hourly Xiaomi report from a switch also caused to emit I need to debug this further to see what's going on, so this PR is only a first workaround. |
Indeed. With
My API client code originates from before the websocket notifications were implemented. It polls the deCONZ gateway, checking for changed values. The notifications are used as optional accelerator; my code continues to work when the notifications fail (or the websocket connection cannot be established). The same piece of code handles the poll response and the websocket payload, comparing the received values to the cached previous values. With this setup, I'm immune to this issue and to the fact that still not all values changes are notified over the websocket. Note that deCONZ |
Similar treatment as in dresden-elektronik#8189 This PR will only emit Websocket events for the objects attr, state, config, etc. if the internal event for it originates such an item. It prevents extra events like config object when just an attr object should be send via Websocket. Clearing the push flags happens after lightToMap() was called to clear only items which fit the internal event suffix (and I prefer to let lightToMap() to not have this logic). The check group event is also emitted outside lightToMap() now.
Similar treatment as in #8189 This PR will only emit Websocket events for the objects attr, state, config, etc. if the internal event for it originates such an item. It prevents extra events like config object when just an attr object should be send via Websocket. Clearing the push flags happens after lightToMap() was called to clear only items which fit the internal event suffix (and I prefer to let lightToMap() to not have this logic). The check group event is also emitted outside lightToMap() now.
After the refactor of
sensorToMap()when an event arrived inhandleSensorEvent()not only the respective parent object likeattr/,state/,config/, etc. was emitted on Websocket but sometimes other event objects too.The PR prevents this to filter out any item that doesn't match the events item suffix.
Related forum posts:
https://forum.phoscon.de/t/ghost-button-events-with-deconz-2-29-5-and-aqara-smart-button/6300/14
https://forum.phoscon.de/t/lumi-vibration-aq1-sensor-with-phantom-triggers-since-deconz-2-29-5/6305/6