Python Plugin: Battery Levels

Python and python framework

Moderator: leecollings

Post Reply
Xorfor

Python Plugin: Battery Levels

Post by Xorfor »

I create a new Python plugin to monitor the battery levels of ALL Domoticz devices. This plugin is based on:

Battery Level for Z-Wave Devices
and the latest Domoticz API/JSON URL's

The plugin Battery Level for Z-Wave Devices works great, but is limited to only Z-Wave devices. This plugin tries to find all Domoticz battery devices, like the Philips Hue Dimmer Switch, and display the current battery level.

This plugin has a modular structure to be able to support other battery devices then the standard Domoticz and Z-Wave devices. Originally there was a module to get the Philips Hue battery levels, but since Domoticz 2020.01 devices like the Philips Hue Dimmer Switch are now standard available.

Plugin available at https://github.com/Xorfor/Domoticz-BatteryLevels-Plugin
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Python Plugin: Battery Levels

Post by sincze »

You just served me the ticket to migrate to 2020.2 tnx. :D
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Dave21w
Posts: 375
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Python Plugin: Battery Levels

Post by Dave21w »

Luckly I tested this on a "test system" I have so no harm done however unless I did somthing wrong the plugin created a new device in the Utility's tab for EVERY device it could see not just the ones that are actually in use, so all devices in the "not used" list now have an entry under utility's

Was it just me ?
Xorfor

Re: Python Plugin: Battery Levels

Post by Xorfor »

Dave21w wrote: Monday 27 April 2020 13:11 ... so all devices in the "not used" list now have an entry under utility's...
The plugin will create a device for every battery device, also if they are not used.

Can you be more specific? What kind of devices? From specific hardware?
Dave21w
Posts: 375
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Python Plugin: Battery Levels

Post by Dave21w »

Obviously only battery powered devices, I just didn't think to select the "not used" tab and delete everthing that had been seen that wasn't mine !

I now have about 110 devices for battery value that i need to delete :D
peerkersezuuker
Posts: 70
Joined: Monday 14 December 2015 22:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Mierlo
Contact:

Re: Python Plugin: Battery Levels

Post by peerkersezuuker »

Hi Xorfor,
I would like to try this one out, but i seem to mis a config option.
I enabeled the hardware and in my log is :

Code: Select all

Error: (Battery Levels) Error calling 'http://192.168.0.31:8080/json.htm?type=devices&displayhidden=1'
This error is correct because my domoticz runs on port 8880
I there a way to configure the domoticz port for the plugin ?

Regards
Peer
Xorfor

Re: Python Plugin: Battery Levels

Post by Xorfor »

Dave21w wrote: Monday 27 April 2020 13:11 Luckly I tested this on a "test system" I have so no harm done however unless I did somthing wrong the plugin created a new device in the Utility's tab for EVERY device it could see not just the ones that are actually in use, so all devices in the "not used" list now have an entry under utility's

Was it just me ?
The latest version only creates Battery Level devices for a 'used' devices with battery.
Xorfor

Re: Python Plugin: Battery Levels

Post by Xorfor »

peerkersezuuker wrote: Monday 27 April 2020 14:16
I there a way to configure the domoticz port for the plugin ?
The latest version allows you to configure the port number of Domoticz, because I didn't find a way to retrieve that.
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Python Plugin: Battery Levels

Post by ronaldbro »

Thanks Xorfor, this plugin is great :) I can even track the battery levels on my slave domoticz.
peerkersezuuker
Posts: 70
Joined: Monday 14 December 2015 22:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Mierlo
Contact:

Re: Python Plugin: Battery Levels

Post by peerkersezuuker »

Xorfor wrote: Tuesday 28 April 2020 8:23
peerkersezuuker wrote: Monday 27 April 2020 14:16
I there a way to configure the domoticz port for the plugin ?
The latest version allows you to configure the port number of Domoticz, because I didn't find a way to retrieve that.
Excelent, that did the trick.
Thanks for this awesome plugin

Regards
Peer
HvdW
Posts: 591
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Python Plugin: Battery Levels

Post by HvdW »

You can have a look at the very simple dzVents script @waaren showed in this post. , it warns with a notification if any device is low on battery, no display of the devices in Domoticz.
Bugs bug me.
Xorfor

Re: Python Plugin: Battery Levels

Post by Xorfor »

HvdW wrote: Tuesday 28 April 2020 22:38 You can have a look at the very simple dzVents script @waaren showed in this post. , it warns with a notification if any device is low on battery, no display of the devices in Domoticz.
The main reason I created this plugin is for the history. I want to know whether a device is using a battery for one or two years, or even 3 months!!! A notification from Domoticz or other script was not enough for me.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest