Python plugin: Battery Level for Z-Wave Devices

Python and python framework

Moderator: leecollings

User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Phantom »

bdormael wrote:
TakeAway wrote:Works for some time, but domoticz crashes. Is there a solution for this?
Same issue here, 2 times a day Domoticz crashes now, when disabling the plugin, no crashes anymore


Verzonden vanaf mijn iPad met Tapatalk
Sadly domoticz is crashing here also, had to disable the plugin :(
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by assenzuid »

Not stable at the moment, more plug-ins have issues.
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

assenzuid wrote:Not stable at the moment, more plug-ins have issues.
I think so... there have been many changes in the recent domoticz versions in the python framework that is from what I gather far from stable yet... and the latest beta builds from the website do not seem to compile with python active... so while I am happy that my plugin attracts interest, I strongly urge you to first check domoticz's ability to run other python plugins as well, before we can suspect some issue with my plugin... I am very happy with my three production systems running the BatteryLevel plugin with domoticz version 3.7421...
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by bdormael »

Maybe excerpt from Domoticz logfile below will help in troubleshooting the plugin/Domoticz issue:

Code: Select all

2017-06-13 11:41:43.603  (Battery) Calling message handler 'onHeartbeat'.
2017-06-13 11:41:43.603  Error: (Battery) 'onHeartbeat' failed 'TypeError':'<module>() takes 0 positional arguments but 1 was given'.
2017-06-13 11:41:43.603  Error: (Battery) ----> Line 181 in /home/pi/domoticz/plugins/BatteryLevel-master/plugin.py, function onHeartbeat
2017-06-13 11:41:44.010  Hardware Monitor: Fetching data (System sensors)
2017-06-13 11:41:51.768  (RFXCOM) Temp + Humidity (Thermometer Badkamer Boven)
2017-06-13 11:41:53.571  (Battery) Calling message handler 'onHeartbeat'.
2017-06-13 11:41:53.572  Error: (Battery) 'onHeartbeat' failed 'TypeError':'<module>() takes 0 positional arguments but 1 was given'.
2017-06-13 11:41:53.572  Error: (Battery) ----> Line 181 in /home/pi/domoticz/plugins/BatteryLevel-master/plugin.py, function onHeartbeat
2017-06-13 11:42:03.588  (Battery) Calling message handler 'onHeartbeat'.
2017-06-13 11:42:03.588  Error: (Battery) 'onHeartbeat' failed 'TypeError':'<module>() takes 0 positional arguments but 1 was given'.
2017-06-13 11:42:03.588  Error: (Battery) ----> Line 181 in /home/pi/domoticz/plugins/BatteryLevel-master/plugin.py, function onHeartbeat
2017-06-13 11:42:04.529  (RFXCOM) Temp (Temperatuur Strijkkamer)
2017-06-13 11:42:12.359  (RFXCOM) Temp (Temperatuur Slaapkamer Lauren)
2017-06-13 11:42:13.605  (Battery) Calling message handler 'onHeartbeat'.
2017-06-13 11:42:13.605  Error: (Battery) 'onHeartbeat' failed 'TypeError':'<module>() takes 0 positional arguments but 1 was given'.
2017-06-13 11:42:13.606  Error: (Battery) ----> Line 181 in /home/pi/domoticz/plugins/BatteryLevel-master/plugin.py, function onHeartbeat
2017-06-13 11:42:14.084  Hardware Monitor: Fetching data (System sensors)
2017-06-13 11:42:17.313  (RFXCOM) Temp (Temperatuur Keuken)
2017-06-13 11:42:20.585  (RFXCOM) Temp + Humidity (Thermometer Speelkamer)
2017-06-13 11:42:23.623  (Battery) Calling message handler 'onHeartbeat'.
2017-06-13 11:42:23.635  Error: Domoticz received fatal signal 6 !...
2017-06-13 11:42:23.638  Error:   /home/pi/domoticz/domoticz() [0x1cc844]
2017-06-13 11:42:23.638  Error:   /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1cc8fc]
2017-06-13 11:42:23.638  Error:   /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76abd180]
2017-06-13 11:42:23.638  Error:   /lib/arm-linux-gnueabihf/libc.so.6(gsignal+0x38) [0x76abbf70]
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

bdormael wrote:Maybe excerpt from Domoticz logfile below will help in troubleshooting the plugin/Domoticz issue:
Thanks, but I am not seeing this with BatteryLevel plugin version 4.0.3 (latest) and Domoticz version 3.7421 (Compile Date: 2017-05-06) ... can you tell me which versions of the plugin and domoticz you are using ?

EDIT: I upgraded my development system (Debian Linux in VirtualBox) to today's latest version 3.7969 to test the plugin and it works just fine... But I had to compile domoticz myself since the builds from the domoticz.com website do not even start... So I can only urge those of you who have issues to turn their attention to the current instability in the ready-to-use domoticz installations/update.
Please only use this thread for issues related to the plugin itself. Thanks !
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by bdormael »

Logread wrote:
bdormael wrote:Maybe excerpt from Domoticz logfile below will help in troubleshooting the plugin/Domoticz issue:
Thanks, but I am not seeing this with BatteryLevel plugin version 4.0.3 (latest) and Domoticz version 3.7421 (Compile Date: 2017-05-06) ... can you tell me which versions of the plugin and domoticz you are using ?

EDIT: I upgraded my development system (Debian Linux in VirtualBox) to today's latest version 3.7969 to test the plugin and it works just fine... But I had to compile domoticz myself since the builds from the domoticz.com website do not even start... So I can only urge those of you who have issues to turn their attention to the current instability in the ready-to-use domoticz installations/update.
Please only use this thread for issues related to the plugin itself. Thanks !
Thx for the answer.

It only crashes once or twice per day so just checking if it works for 5 minutes is probably not sufficient.

I use the latest beta build of Domoticz and the latest version of your plugin.

For now I will uninstall your plugin and go back to my own scripting of reading battery devices.

Good luck with the plugin in the future.
Just for your information, other plugins I use do just work fine.


Verzonden vanaf mijn iPad met Tapatalk
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

@bdormael,

Please do not get me wrong...
I made this plugin public in case others would find it useful... I am not a professional developer.

I cannot reproduce the errors you have been seeing... BUT I welcome you looking into the code and your systems specifics and I will happily implement whatever improvement you can suggest
brianhunt
Posts: 8
Joined: Monday 26 September 2016 18:18
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by brianhunt »

Had the issue that after installing the latest beta, none of my devices were shown any more. Solved it by using

Code: Select all

chmod 755 domoticz/plugins/BatteryLevel/plugin.py
Need to monitor if the system is stable now...
User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Phantom »

Hey Logread, domoticz is running fine here for a long time but as soon as i activate this plugin it crashes within 24 hours.
Debian version (up to date):
pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux

Domoticz version:
Version: 3.7722
Build Hash: dce48ed
Compile Date: 2017-06-12 15:49:30

Last lines in the domoticz log file:
2017-06-14 17:54:31.071 Hardware Monitor: Fetching data (System sensors)
2017-06-14 17:54:31.088 Error: Domoticz received fatal signal 11 !...
2017-06-14 17:54:31.091 Error: /home/pi/domoticz/domoticz() [0x1cca74]
2017-06-14 17:54:31.091 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1ccb2c]
2017-06-14 17:54:31.091 Error: /lib/arm-linux-gnueabihf/libc.so.6(+0x24fd0) [0x76afefd0]

Would it help to make some debug files (and how then)?
Let me know if you need any more information or what i can do.
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

@Phantom,

Many thanks for the detailed report...

I'll investigate tomorrow if I find the time but a cursory look at the log extracts you sent reminded me of some other comments in the forum regarding some of the latest domoticz builds and python framework errors... see https://www.domoticz.com/forum/viewtopi ... 11#p137821 for instance

I just upgraded my test system today with the latest build from the website (3.7972) and it seems stable. Your own risk (since these are anyway all beta releases...), but you may want to upgrade your domoticz version. Anyway I'll let my test virtual machine run for a while and see... It seems some of the recent changes in the python framework of domoticz broke many things but I see its developers are Orking hard on fixing these.
User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Phantom »

Thanks for the reply, it could be the whole python issue indeed but i am no developer at all.
i will keep updating my domoticz to the latest version and hope the will get python stable soon, guess i am a little impatient.
brianhunt
Posts: 8
Joined: Monday 26 September 2016 18:18
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by brianhunt »

Unfortunately, my domoticz system also crashed after about 9 hours (currently on version 3.7972). Guess we all have to wait for some stability in the python plugin area (also have issues with sonos plugin)...

@Logread: your work is very much appreciated!!
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by mivo »

Hi Logread,

I am testing your plugin, It is running OK for more than 1 day on my RPi without issues. I have beta 3.8025 compiled from source. Battery level of 2 Zwave radiator valves is reported correctly. Great work !

One minor suggestion - please try to set Domoticz.Heartbeat parameter in OnStart function. It will use longer interval of heartbeat calling (10 sec. by default) and can decrease CPU load. It will not worsen this plugin work - battery values updated every 30 mins. or more.

Example:

Code: Select all

def onStart(self):
    ...
    Domoticz.Heartbeat(60)
    ...
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

mivo wrote:Hi Logread,

I am testing your plugin, It is running OK for more than 1 day on my RPi without issues. I have beta 3.8025 compiled from source. Battery level of 2 Zwave radiator valves is reported correctly. Great work !

One minor suggestion - please try to set Domoticz.Heartbeat parameter in OnStart function. It will use longer interval of heartbeat calling (10 sec. by default) and can decrease CPU load. It will not worsen this plugin work - battery values updated every 30 mins. or more.
Thanks for your feedback.
Regarding the changing of the Heartbeat, your point is taken, though I will test this first against the warning on the wiki about heartbeat set to longer than 30 seconds:
Set the heartbeat interval in seconds, default 10 seconds. Values greater than 30 seconds will cause a message to be regularly logged about the plugin not responding. The plugin will actually function correctly with values greater than 30 though.
If I decide to implement this (that is is there is no annoying side effect such as clogging the logs), I will rather change the heartbeat interval after the first call to onHeartbeat function rather than in the onStart function, so that the battery levels remain updated 10s after the plugin is started as currently setup.
That being said, i have now four plugins I wrote using the same heartbeat code stucture running concurrently on the same system and I have not noticed any material load on the CPU or delays (on a Raspberry).
marco.bag
Posts: 14
Joined: Tuesday 16 December 2014 0:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by marco.bag »

Thank you!
Testing right now :)
User avatar
lmet
Posts: 23
Joined: Wednesday 19 July 2017 22:35
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.9700
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by lmet »

Thanks for this plugin
I have to stop it because many logs with error :

Code: Select all

2017-08-17 13:33:33.449 Error: (Modules batteries) Failed to update device unit 39
Probably due to waking time of sensative strips which is 24 hours by default.
I set polling interval to 720 mn but remains the same. Do I have to set it to 1440 mn ?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

lmet wrote: Friday 18 August 2017 17:59 Thanks for this plugin
I have to stop it because many logs with error :

Code: Select all

2017-08-17 13:33:33.449 Error: (Modules batteries) Failed to update device unit 39
Probably due to waking time of sensative strips which is 24 hours by default.
I set polling interval to 720 mn but remains the same. Do I have to set it to 1440 mn ?
I doubt this is related to polling. This error is thrown when the plugin cannot update one of its child devices (unit(s))... Possibly you deleted this device or the plugin for some reason failed to create it in the first instance... Do you see in the Setup / Devices tab any device with the plugin's hardware name and a unit number 39 ? If not, can you try to restart the plugin ("update" it in the hardware tab) and see if the device is created ?
User avatar
lmet
Posts: 23
Joined: Wednesday 19 July 2017 22:35
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.9700
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by lmet »

Thanks
I see it in Setup/Devices and in Utility tab
img_005.jpg
img_005.jpg (17.37 KiB) Viewed 3660 times
39 is the z-Wave node number of this Sensative strips module.
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

lmet wrote: Saturday 19 August 2017 16:15 Thanks
I see it in Setup/Devices and in Utility tab
img_005.jpg
39 is the z-Wave node number of this Sensative strips module.
Wierd... is this deviçe 39 the only zwave node causing an error in the logs ? If so, would you mind sharing by pm (en Français même) the content of the openzwave data file ( usually ~/domoticz/Config/zwcfg_0x????????.xml" where ???????? is the unique home id of your zwave controller) ?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: Battery Level for Z-Wave Devices

Post by Logread »

Thanks @imet for uncovering a small bug causing an update error for devices with a bettery level >= 25% and < 50% (typo in the code: wrong icon name).
This is corrected in version 0.4.4 available from GitHub (see https://www.domoticz.com/wiki/Plugins/BatteryLevel.html for updating instructions)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest