ebaauw / homebridge-deconz

Homebridge plugin for deCONZ
Apache License 2.0
135 stars 7 forks source link

Battery status and value toggling twice on every Heartbeat #77

Closed Monofin closed 1 year ago

Monofin commented 1 year ago

Hi there: I've observed a very odd behaviour with homebrideg-deconz and my motion sensors: Precisely every heartbeat (mine is currently set to 21 seconds, in this case to verify it), the battery values of the sensor toggle to a default value, then beck to the actual level.

What is more odd, is that the deconz web API debug doesn't show a single message referring to any of the sensors or any updates. (ZCL/APS snoop also checks that nothing has been actually received from the sensor either).

This can be cured by removing the device, then re-adding it - note that 'unexoposing' the device then re-exposing it doesn't solve the issue, it starts toggling on heartbeat when re-exposed.

Is it plausible that this is a stale or cached resource issue? (If so, potentially a deCONZ DB issue?)

Homebridge log are below: [12/10/2022, 16:53:58] [deCONZ] Mordin Button: Programmable Switch Event: Single Press [12/10/2022, 16:54:11] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:54:11] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:54:11] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:54:11] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:54:32] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:54:32] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:54:32] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:54:32] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:54:53] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:54:53] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:54:53] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:54:53] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:54:58] [deCONZ] Mordin Button: Programmable Switch Event: Single Press [12/10/2022, 16:55:14] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:55:14] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:55:14] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:55:14] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:55:35] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:55:35] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:55:35] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:55:35] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:55:56] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 94% to 0% [12/10/2022, 16:55:56] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 0 to 1 [12/10/2022, 16:55:56] [deCONZ] Kitchen Sink Motion Battery: set Battery Level from 0% to 94% [12/10/2022, 16:55:56] [deCONZ] Kitchen Sink Motion Battery: set Status Low Battery from 1 to 0 [12/10/2022, 16:55:58] [deCONZ] Mordin Button: Programmable Switch Event: Single Press

ebaauw commented 1 year ago

I would need to see the debug messages to know what’s going on exactly. My guess is this is a motion sensor with multiple sensors resources, that report different values for config.battery. In that case, the issue lies with deCONZ. I would need to see the dump file to confirm that.

Monofin commented 1 year ago

I have confirmed that the single sensor is ending up exposing two resources, one a ZHABattery and one presence sensor, with a battery resource, resulting in this behaviour. It seems that deCONZ is automatically adding the ZHABattery when adding the sensor (through Phoscon), despite the presence detector DDF having bindings for the battery, and no extra ZHABattery.

ebaauw commented 1 year ago

That would be an issue in deCONZ, indeed. As workaround you might blacklist the illegal ZHABattery /sensors resource.

ebaauw commented 1 year ago

Oh, damn, this is Homebridge deCONZ, no blacklisting per resource yet.