999LV / BatteryLevel

Domoticz python plugin to display/log battery level of zwave devices
MIT License
9 stars 5 forks source link

Battery Status Level - wrong reporting when dead #6

Closed mpalyga closed 5 years ago

mpalyga commented 6 years ago

Hi. using this plugin, it is extremely useful however I've discovered some limitation. when zwave device is running well on battery that's no problem but when battery dies quickly, the last battery reports shows last read status which sometimes is not accurate (battery dies before correct status was reported). it would be great if i can suggest, if battery status is not provided by devices after threshold (not response from devices), battery status should be changed to 0% (battery dead). is it possible to implement this code enhancement ?

regards m.

999LV commented 6 years ago

@mpalyga ,

the plugin gets devices battery data from openzwave, so it can only "see" what openzwave sees. Implementing your workaround does not seem practical to me, since the battery level of many devices may not change for several months while still good, so not sure if one can define a threshold.

but you are always able in domoticz to setup a notification triggered at a certain bettery level (my own practice is to replace batteries of zwave devices whenever they are below 50% or for long lasting devices 33%)

mpalyga commented 6 years ago

hej 999LV. thx for very fast response :)

the main problem what is see it is that open zwave network even doesnt know that battery is dead as device could not send notification (battery died quicker) and still shows eg 50% or 30% of capacity even if  z-wave device is fully discharged. As per implemented interval in plugin max 1440min to get status from z-wave device, do battery plugin has correct battery status.  (assumption is i guess  that we trust z-wave device to provide correct status of battery level). I've looked for something what could be implemented in battery plugin like - plugin reads battery status once per configured threshold (eg. 1440 max) , if z-wave device was available during period, fine - we have true status of battery level. If z-wave device was not visible (eg. as you said - in sleep mode for weeks and didnt report that device is live) during this thereshold period (eg 1440 mins or triple threshold) we can assume that device is dead (battery discharged quicker then device could report it) and battery plugin can show status battery discharged or eg no response from device (mean potentially battery is dead).   does it make sense ? 

of course - i have few scripts in domoticz looking and triggers notification when no response from device even if battery status still shows (in capacity). But i looked something what improve in plugin to make it easier to use. of course im happy to test.

999LV commented 6 years ago

I thought a bit about your suggestion... it would be possible for the plugin to obtain the « last seen » timestamp for each node (using the domoticz json API, since the openzwave cfg file does not provide it), and then based on a time out test (that can be set as a plugin parameter), mark the battery level device as timed out and with a zero value. Not difficult but I do not have time to work on this at the moment. Can you code ?

mpalyga commented 6 years ago

will try to do that. do not promise that it will happen quickly but ... lets see. i will let you know or request some help :)