Python plugin: Battery Level for Z-Wave Devices

Python and python framework

Moderator: leecollings

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post by waaren »

Logread wrote: Thursday 26 September 2019 11:08 Plugin version 0.6.0 is now available for download
Thanks ! Working like a charm.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Labtec
Posts: 20
Joined: Friday 10 August 2018 19:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Labtec »

Hi

Cant get it to work, I download version 0.6.0 but I don't see any batt.status devices

Messages log:

2019-09-28 14:23:10.644 (Piles) Calling message handler 'onHeartbeat'.
2019-09-28 14:23:22.872 (Piles) Pushing 'onHeartbeatCallback' on to queue
2019-09-28 14:23:22.879 (Piles) Processing 'onHeartbeatCallback' message
2019-09-28 14:23:22.879 (Piles) Calling message handler 'onHeartbeat'.
2019-09-28 14:23:32.873 (Piles) Pushing 'onHeartbeatCallback' on to queue
2019-09-28 14:23:32.875 (Piles) Processing 'onHeartbeatCallback' message
2019-09-28 14:23:32.875 (Piles) Calling message handler 'onHeartbeat'.
2019-09-28 14:23:42.875 (Piles) Pushing 'onHeartbeatCallback' on to queue
2019-09-28 14:23:42.917 (Piles) Processing 'onHeartbeatCallback' message
2019-09-28 14:23:42.917 (Piles) Calling message handler 'onHeartbeat'.
2019-09-28 14:23:52.877 (Piles) Pushing 'onHeartbeatCallback' on to queue
2019-09-28 14:23:52.914 (Piles) Processing 'onHeartbeatCallback' message
2019-09-28 14:23:52.914 (Piles) Calling message handler 'onHeartbeat'.

Error log:

2019-09-28 13:59:07.692 Error: (Piles) Error calling 'http://localhost:8080/json.htm?type=com ... vels&idx=9'
Labtec
Posts: 20
Joined: Friday 10 August 2018 19:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Labtec »

Problem solved, need to fill in username and password :D
akamming
Posts: 359
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by akamming »

For me it's not working. No devices are created.

This is a piece of the Log:

Code: Select all

2019-09-28 18:08:11.186  (Battery) Node 1 Controller has battery level of 255%
2019-09-28 18:08:11.187  (Battery) Node 11 Pi has battery level of 255%
2019-09-28 18:08:11.188  (Battery) Node 12 Wasmachine has battery level of 255%
2019-09-28 18:08:11.188  (Battery) Node 13 Droger has battery level of 255%
2019-09-28 18:08:11.188  (Battery) Node 15 Lamp bij Spiegel has battery level of 255%
2019-09-28 18:08:11.189  (Battery) Node 17 Designlamp bij TV has battery level of 255%
2019-09-28 18:08:11.189  (Battery) Node 19 Lichtknopje voorkamer has battery level of 255%
2019-09-28 18:08:11.189  (Battery) Node 33 Rookmelder Max has battery level of 255%
2019-09-28 18:08:11.190  (Battery) Node 35 Houten Lamp bij TV has battery level of 255%
2019-09-28 18:08:11.190  (Battery) Node 39 Lichtknopje gang buitenlamp has battery level of 255%
2019-09-28 18:08:11.190  (Battery) Node 40 Vaatwasser has battery level of 255%
2019-09-28 18:08:11.191  (Battery) Node 42 Ongebruikt has battery level of 255%
2019-09-28 18:08:11.191  (Battery) Node 44 ZwolleLamp has battery level of 255%
2019-09-28 18:08:11.191  (Battery) Node 46 niet meer in gebruik has battery level of 255%
2019-09-28 18:08:11.192  (Battery) Node 47 Vriezer has battery level of 255%
2019-09-28 18:08:11.192  (Battery) Node 50 Lamp garage OUd has battery level of 255%
2019-09-28 18:08:11.193  (Battery) Node 51 PIR Garage has battery level of 255%
2019-09-28 18:08:11.193  (Battery) Node 54 Luchtontvochtiger has battery level of 255%
2019-09-28 18:08:11.193  (Battery) Node 55 Meterkast has battery level of 255%
2019-09-28 18:08:11.194  (Battery) Node 56 PIR Carport has battery level of 255%
2019-09-28 18:08:11.194  (Battery) Node 57 PIR Woonkamer has battery level of 255%
2019-09-28 18:08:11.194  (Battery) Node 58 Vloerverwarming has battery level of 255%
2019-09-28 18:08:11.195  (Battery) Node 65 Rookmelder garage has battery level of 255%
2019-09-28 18:08:11.195  (Battery) Node 69 Heiman humtemp has battery level of 255%
2019-09-28 18:08:11.195  (Battery) Node 70 Ventilatie has battery level of 255%
2019-09-28 18:08:11.195  (Battery) Node 71 Badkamer HumTemp has battery level of 255%
2019-09-28 18:08:11.196  (Battery) Node 72 Badkamer Boven HumTemp has battery level of 255%
2019-09-28 18:08:11.196  (Battery) Node 77 Niet meer in gebruik has battery level of 255%
2019-09-28 18:08:11.196  (Battery) Node 78 VanMoof has battery level of 255%
2019-09-28 18:08:11.197  (Battery) Node 82 Deurbel has battery level of 255%
2019-09-28 18:08:11.197  (Battery) Node 83 Tulplamp has battery level of 255%
2019-09-28 18:08:11.197  (Battery) Node 84 Lamp garage has battery level of 255%
2019-09-28 18:08:11.198  (Battery) Node 85 BuitenTempHum has battery level of 255%
2019-09-28 18:08:11.198  (Battery) Node 86 Buitenverlichting Achterkamer has battery level of 255%
2019-09-28 18:08:11.198  (Battery) Node 87 Buitenverlichting Keuken has battery level of 255%
2019-09-28 18:08:11.199  (Battery) Node 88 NEO Coolcam hangt in garage has battery level of 255%
2019-09-28 18:08:11.199  (Battery) Node 89 Smoke detector 1 has battery level of 255%
2019-09-28 18:08:11.199  (Battery) Node 90 Smoke detector 2 has battery level of 255%
If i understand the code correctly everything with a level below 255% should result in a device being created, but in my case it thinks all devices, including the battery reported devices report 255. I checked.... This URL gives (http://localhost:80/json.htm?type=comma ... vels&idx=9) gives the same output (all devices, including the battery powered devices give a value of 255)
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 »

akamming wrote: Saturday 28 September 2019 18:19 For me it's not working. No devices are created.

If i understand the code correctly everything with a level below 255% should result in a device being created, but in my case it thinks all devices, including the battery reported devices report 255. I checked.... This URL gives (http://localhost:80/json.htm?type=comma ... vels&idx=9) gives the same output (all devices, including the battery powered devices give a value of 255)
Let it run for hours or day (the instructions call for your patience... devices need to communicate their battery levels so at the plugin gets these). Please report then
akamming
Posts: 359
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by akamming »

Logread wrote: Saturday 28 September 2019 20:35 Let it run for hours or day (the instructions call for your patience... devices need to communicate their battery levels so at the plugin gets these). Please report then
yep that was it... running ok now :D

I did notice a small security issue:
- The password is logged to the logfile when debug is on
- The password is also stored unencrypted in the database

Not a big thing, cause normally someone will not have access to the database or the log. But still better not to store unencrypted passwords anywhere..
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 »

akamming wrote: Sunday 29 September 2019 9:18 I did notice a small security issue:
- The password is logged to the logfile when debug is on
- The password is also stored unencrypted in the database

Not a big thing, cause normally someone will not have access to the database or the log. But still better not to store unencrypted passwords anywhere..
Good points.
I will address the first issue (logging) in a new release.
I think the second one is part of the python plugins framework implementation, so not within the scope of the plugin.
Thanks
TheCondor
Posts: 78
Joined: Thursday 18 June 2015 10:32
Target OS: Linux
Domoticz version:
Contact:

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

Post by TheCondor »

Labtec wrote: Saturday 28 September 2019 14:32 Problem solved, need to fill in username and password :D
I set as IP 127.0.0.1 and put this address in the trusted ip of domoticz settings. In this way it works without password.
andreasm80
Posts: 7
Joined: Thursday 24 November 2016 22:05
Target OS: Linux
Domoticz version:
Contact:

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

Post by andreasm80 »

Discovered this brilliant plugin yesterday, worked out of the box.

My setup consists of a RPi with Domoticz and the ZwaveController installed doing all the actual zwave commands etc and updates my second Domoticz server which is a Ubuntu VM. This Ubuntu VM is my "main" Domoticz server where all my logic is configured and all switches/actions are defined and used. All new devices from the RPi Domoticz is synced to this one, except a limitation when it comes to Python plugin devices.
What I am looking to do is read the status from all the BatteryMonitor devices createad by the BatteryPlugin and update dummy devices on my main Domoticz server respectively. I get the status from the devices by running curl command from my main Domoticz server command line and get all the expected data.
I am not expecting anyone to jump on an help me out with a finished script, I have been searching the forums and read the WIKI but I would like some help to start out. A lua script (or whatever) that reads all the data from the devices on the one Rpi Domoticz sever and creates/updates a dummy switch which look excatly the same as on the Rpi Domoticz, battery icon (full, low, empty etc), percentage level on battery etc. And I want it to only be updated when theres is a change in battery-level on the source side (the Rpi Domoticz side). I have installed the same custom icons on the main Domoticz server also.
I must admit, I am not able to create such a script from scratch, but able to read an existing one and make changes that suits my need. But it would be great get a place to start..

Thanks
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 »

andreasm80 wrote: Friday 17 January 2020 11:55 Discovered this brilliant plugin yesterday, worked out of the box.

My setup consists of a RPi with Domoticz and the ZwaveController installed doing all the actual zwave commands etc and updates my second Domoticz server which is a Ubuntu VM. This Ubuntu VM is my "main" Domoticz server where all my logic is configured and all switches/actions are defined and used. All new devices from the RPi Domoticz is synced to this one, except a limitation when it comes to Python plugin devices.
What I am looking to do is read the status from all the BatteryMonitor devices createad by the BatteryPlugin and update dummy devices on my main Domoticz server respectively. I get the status from the devices by running curl command from my main Domoticz server command line and get all the expected data.
Thanks for your appreciation.
If you are using domoticz version above 4.11253 and therefore plugin version 0.6.0, you can run the plugin on your « main » domoticz (configure IP / Port / password as needed) to get the data from your « remote » domoticz. Then no need for device replication.
Hope this helps.
andreasm80
Posts: 7
Joined: Thursday 24 November 2016 22:05
Target OS: Linux
Domoticz version:
Contact:

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

Post by andreasm80 »

Hi,

Thank you for your reply. I noticed that I had more input on the latest plugin version. That could be a way to go. If I have understood it correctly the version above 4.10717 is considered beta? Do you happen to have some insight in how stable this release is?

Thanks again

Regards
vulbas
Posts: 37
Joined: Tuesday 20 February 2018 17:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by vulbas »

Hello,
I installed the plugin but I don't see it.
I do not understand.

Image

Image

can you help me please ?
TheCondor
Posts: 78
Joined: Thursday 18 June 2015 10:32
Target OS: Linux
Domoticz version:
Contact:

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

Post by TheCondor »

Hi, try to restart domoticz and post the initial log, so we can check what's wont load.
vulbas
Posts: 37
Joined: Tuesday 20 February 2018 17:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by vulbas »

hello,
do you see a problem ?

Code: Select all

2020-02-11 11:06:31.903 Status: Domoticz V4.11674 (c)2012-2020 GizMoCuz
2020-02-11 11:06:31.903 Status: Build Hash: 91c3475ac, Date: 2020-02-09 10:00:09
2020-02-11 11:06:31.904 Status: Startup Path: /home/pi/domoticz/
2020-02-11 11:07:26.609 Status: PluginSystem: Started, Python version '3.7.3'.
2020-02-11 11:07:26.691 Status: WebServer(HTTP) started on address: :: with port 8080
2020-02-11 11:07:26.775 Status: WebServer(SSL) started on address: :: with port 443
2020-02-11 11:07:26.781 Status: Proxymanager started.
2020-02-11 11:07:26.783 Status: Camera: settings (re)loaded
2020-02-11 11:07:26.788 Status: RxQueue: queue worker started...
2020-02-11 11:07:26.788 Status: TCPServer: shared server started...
2020-02-11 11:07:27.080 Status: PROXY: Authenticate result: success.
2020-02-11 11:07:28.789 Status: (EDF) Teleinfo device uses serial port: /dev/ttyUSB-EDF at 1200 bauds
2020-02-11 11:07:28.795 Status: (EDF) CRC checks will be performed on incoming data
2020-02-11 11:07:28.797 Status: Pinger: Worker started...
2020-02-11 11:07:28.797 Status: (chauffage sol) Started.
2020-02-11 11:07:28.797 Status: (controle batterie zwave) Started.
2020-02-11 11:07:28.797 Status: Harmony Hub: Worker thread started...
2020-02-11 11:07:28.798 Status: EventSystem: reset all events...
2020-02-11 11:07:28.813 Status: EventSystem: reset all device statuses...
2020-02-11 11:07:28.992 Status: RFLink: Using serial port: /dev/ttyUSB-RFX433
2020-02-11 11:07:29.122 Status: (EDF) Teleinfo CRC check mode set to 1
2020-02-11 11:07:29.235 Status: PluginSystem: Entering work loop.
2020-02-11 11:07:29.289 Status: OpenZWave: using config in: /home/pi/domoticz/Config/
2020-02-11 11:07:29.433 Status: OpenZWave: Starting...
2020-02-11 11:07:29.433 Status: OpenZWave: Version: 1.6-1020-g67c46b68
2020-02-11 11:07:30.255 Status: (chauffage sol) Entering work loop.
2020-02-11 11:07:30.255 Status: (chauffage sol) Initialized version 0.4.7, author 'logread'
2020-02-11 11:07:31.029 Status: (controle batterie zwave) Entering work loop.
2020-02-11 11:07:31.031 Status: (controle batterie zwave) Initialized version 0.6.0, author 'logread'
2020-02-11 11:07:31.042 Status: (chauffage sol) This version of domoticz allows status logging by the plugin (in verbose mode)
2020-02-11 11:07:31.097 Status: Incoming connection from: ::1
2020-02-11 11:07:32.109 Status: Harmony Hub: Connected to Hub.
2020-02-11 11:07:32.294 Status: Python EventSystem: Initalizing event module.
2020-02-11 11:07:32.296 Status: EventSystem: Queue thread started...
2020-02-11 11:07:32.303 Status: EventSystem: Started
2020-02-11 11:07:36.818 Status: OpenZWave: User Alert - Manufacturer_specific.xml out of Date
2020-02-11 11:07:36.818 Status: OpenZWave: Received unhandled notification type (30) from HomeID: 0, NodeID: 0 (0x00)
2020-02-11 11:07:36.818 Status: OpenZWave: User Alert - Manufacturer_specific.xml out of Date
2020-02-11 11:07:36.818 Status: OpenZWave: ManufacturerSpecificDB Ready
2020-02-11 11:07:37.561 Status: OpenZWave: Driver Ready
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 »

@vulbas,

Looks the plugin is loading... give it some time (could be hours) to create the child devices, or run in debug mode to see that it works in details.

Did you try to clear your browser cache (see instructions in many posts on the forum) ? May be this is why the hardware page does not show it...
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

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

Post by Solderbro »

Short question.

Where to get the latest version for Domoticz Stable? My install seems to have some trouble and the archive is lost.
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
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 »

Solderbro wrote: Sunday 16 February 2020 12:37 Short question.

Where to get the latest version for Domoticz Stable? My install seems to have some trouble and the archive is lost.
It is on the github repo for the plugin. The file is called ‘ plugin legacy OZW 1.4 version.py ‘ and needs to be renamed to ’ plugin.py ‘ manually
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Z-wave battery monitor error after update to 4.11777

Post by ronaldbro »

Hi,

After the update to 4.11777 which contains an updated OpenZWave library I get the following error on the Z-wave battery monitor plugin.

2020-03-08 01:07:13.535 Error: (Z-wave battery monitor) Error calling 'http://Localhost:8080/json.htm?type=com ... vels&idx=5'

Is this a Domoticz bug or should the Z-wave battery monitor get an update?

Thanks
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Z-wave battery monitor error after update to 4.11777

Post by waaren »

ronaldbro wrote: Sunday 08 March 2020 12:05 2020-03-08 01:07:13.535 Error: (Z-wave battery monitor) Error calling

http://Localhost:8080/json.htm?type=com ... vels&idx=5
Probably not completely comparable because I compile locally and on a Intel NUC(Debian buster) but on the same application versions.

domoticz V4.11777
zWave Version: 1.6-1004-g71220f43
Python Version: 3.7.3

and I don't see this error.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jphc
Posts: 2
Joined: Friday 28 December 2018 15:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.97
Contact:

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

Post by jphc »

Hello,
Nothing is displayed after two hours in Setup > Devices ...
Log: loop with pushing,processing,calling messages

Questions:
1. Shall we also set the X permission for the 'plugin legacy OZW 1.4 version.py' file ?
2. Shall we change localhost for the real IP address ?
3. The plugin folder owner is root: shall we change for the username ?

Linux Burst/Domoticz beta
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest