Page 6 of 7

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

Posted: Monday 13 August 2018 20:58
by heggink
Plugin works great but sometimes, after changing batteries, the old battery level persists and does not get updated (not even after reboot). Thoughts?

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

Posted: Saturday 18 August 2018 10:02
by Logread
heggink wrote:
Monday 13 August 2018 20:58
Plugin works great but sometimes, after changing batteries, the old battery level persists and does not get updated (not even after reboot). Thoughts?
The plugin reads the battery level from openzwave. Indeed openzwave sometimes takes time to update it. This is unrelated to the plugin.

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

Posted: Monday 27 August 2018 8:53
by multinet
Hello i have the same trouble (no battery update after changing them)

I change the battery 2 weeks ago, I think there is a pb in openzwave because indeed the openzwave xml file does not have the correct battery level

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

Posted: Thursday 20 September 2018 13:55
by Martinq
Great plugin!!

Somehow Notifications are not working. In the Utility page I have a sensor with a battery level from 90%. So I made a notification like this:
Type: Usage
When: Less
Value: 81
Ignore Interval: Enabled

But no notifications.

Also tried to make a dzVents script, but no luck with it. It seems the Battery level from the plugin is in the sValue field. But I can't find how to extract this in dzVents. Tried it with this:

Code: Select all

return {
   on = {
      timer = {'Every minute'}
   },
   execute = function(domoticz)
      if (domoticz.devices('Battery - Deursensor Berging').sValue < 80) then
        domoticz.log(domoticz.devices('Battery - Deursensor Berging').sValue)
      end
   end
}
But this gives an error:

Code: Select all

Status: dzVents: Error (2.4.6): An error occured when calling event handler Testbat
Status: dzVents: Error (2.4.6): ...o/domoticz/scripts/dzVents/generated_scripts/Testbat.lua:6: attempt to compare nil with number
Status: dzVents: Info: ------ Finished Testbat
Somebody knows how to get notifications working with this plugin?

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

Posted: Thursday 20 September 2018 18:41
by Logread
@Martinq,

I remember reading somewhere (on the forum or on GitHub) that devices created by python plugins do not work well with notifications (or dzvents ?). Or possibly because these are « custom » type of devices that show the battery levels.

Anyway, there is a global setting in domoticz for low battery that works with notifications (I am using this). Alternatively you could write a script that polls the battery level devices for levels, at regular intervals ?

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

Posted: Thursday 20 September 2018 20:10
by Martinq
I just got a notification from the sensors in Domoticz. Changed the When from Less to Less or Equal. Don't know why it was not working with only Less, but will wait a little bit longer.

The Low Battery function in the Domoticz settings doesn't work well. Many times the device battery is already empty without giving a warning. This script is the first one that gives the correct level. For instance I have a smoke detector. In Domoticz device page the battery level is still 100%. But in the zwcfxxxx.xml the level is 80%. So Domoticz still thinks the battery is full. Also when I check on the Nodes page the Control Page I see the level is 80%.

I am still trying to get the level in dzvents.

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

Posted: Thursday 20 September 2018 21:19
by Martinq
Oke, got it working in both Notifications from the Custom Sensor as in the dzVents.

In dzVents you can use the .state attribute to get the Battery Level, like this:

Code: Select all

return {
   on = {
      timer = {'Every minute'}
   },
   execute = function(domoticz)
       local LEVEL = tonumber(domoticz.devices('Battery - Deursensor Berging').state)
       
      if (LEVEL < 95) then
        domoticz.log('Battery level Low!! Level = ' .. LEVEL)
      else
        domoticz.log('Battery Level = ' .. LEVEL)
      end

   end
}
It's important to use the "tonumber". State returns a string, otherwise you get an error: attempt to compare string with number

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

Posted: Sunday 21 October 2018 22:39
by madvisionz
I can't get this plugin to work unfortunately.
I'm running Domoticz on Synology and the install commandlines doesn't work in Putty (in Windows) so I downloaded and copied the files with WinSCP to the BatteryLevel folder on my Syno manually, but I guess that isn't enough.

What am I missing here?

Domoticz 4.10007
DSM 6.2.1

Next day...Battery Monitoring still not visible in Hardware.

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

Posted: Tuesday 23 October 2018 8:19
by Logread
@madvisionz, I have no clue about where domoticz python plugins should reside in a synology install so difficult for me to assess if you chose the right location... do you successfully use other python plugins ?

Also, did you make the plugin.py file executable (sudo chmod +x plugin.py) ?

Last, did you restart domoticz ?

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

Posted: Tuesday 23 October 2018 21:16
by madvisionz
@Logread, this is my first python plugin.. the location is /volume1/@appstore/domoticz/var/plugins. I created the "BatteryLevel" folder with mkdir and copied the files to this folder manually (apt-get and git clone isn't working). After that I did run the commandline to make plugin.py executable and restart Domoticz and Synology.

Also running Python 3.5.1.

Any ideas?

##Edit##
I installed another Domoticz incl. Python and now I can add the Battery Monitoring. Thx!! :D
No zwave devices found, but ok... we're getting somewhere.

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

Posted: Wednesday 14 November 2018 23:46
by dextm80
i've this error sometimes:

Code: Select all

 2018-11-14 12:13:24.602 Error: (Battery Level Zwave Devices) Ignoring controller ./Config/zwcfg_0xef422f8f.xml since presumed dead (not updated for more than 2 hours) 
can you help me ?

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

Posted: Thursday 15 November 2018 9:12
by Logread
dextm80 wrote:
Wednesday 14 November 2018 23:46
i've this error sometimes:

Code: Select all

 2018-11-14 12:13:24.602 Error: (Battery Level Zwave Devices) Ignoring controller ./Config/zwcfg_0xef422f8f.xml since presumed dead (not updated for more than 2 hours) 
can you help me ?
If it is only from time to time then it is no big deal... It just means your zwave controller has not been updating its data for a while. Not sure why but I assume your zwave network does not poll devices that often.

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

Posted: Monday 10 December 2018 19:17
by dextm80
Hi @Logread, my plugin stopped his work! :(

Code: Select all

 2018-12-10 18:09:11.798 Error: (Battery Level ZWave) Error reading openzwave file ./Config/zwcfg_0xcc2f1a61.xml 

Code: Select all

 2018-12-10 18:10:21.726 Error: (Battery Level ZWave) Enable to find a zwave controller configuration file ! 
what appened?

tnx

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

Posted: Monday 10 December 2018 19:33
by Logread
dextm80 wrote:
Monday 10 December 2018 19:17
Hi @Logread, my plugin stopped his work! :(

Code: Select all

 2018-12-10 18:09:11.798 Error: (Battery Level ZWave) Error reading openzwave file ./Config/zwcfg_0xcc2f1a61.xml 
Can you see the file in the Config directory ? Can you read it with a text editor ?
First time this error is reported (it could be a malformed xml format but this would be strange)...

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

Posted: Monday 10 December 2018 19:37
by dextm80
yes it's into config directory and i'm reading it normally

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

Posted: Monday 10 December 2018 22:23
by Logread
dextm80 wrote:
Monday 10 December 2018 19:37
yes it's into config directory and i'm reading it normally
Then it could be that since you are running a very recent beta the open wave config file format has changed ?
Did you successfully run the plugin with prior versions ? Did the plugin stop when you last upgraded ?

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

Posted: Monday 10 December 2018 22:28
by dextm80
Logread wrote:
Monday 10 December 2018 22:23
dextm80 wrote:
Monday 10 December 2018 19:37
yes it's into config directory and i'm reading it normally
Then it could be that since you are running a very recent beta the open wave config file format has changed ?
Did you successfully run the plugin with prior versions ? Did the plugin stop when you last upgraded ?
yes, after 25 november 18 the plugin stops

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

Posted: Monday 10 December 2018 23:38
by Logread
dextm80 wrote:
Monday 10 December 2018 22:28
yes, after 25 november 18 the plugin stops
You have to bear with me... just too busy to check what when wrong with recent Domoticz betas

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

Posted: Tuesday 11 December 2018 12:31
by Logread
Logread wrote:
Monday 10 December 2018 23:38
dextm80 wrote:
Monday 10 December 2018 22:28
yes, after 25 november 18 the plugin stops
You have to bear with me... just too busy to check what when wrong with recent Domoticz betas
dextm80, can you send your openzwave config file to me by pm (you might have to change its extension to .txt) ? I might then try to see if breaking changes have been Introduced recently.

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

Posted: Tuesday 11 December 2018 14:02
by alanlsmith
If it helps: I'm on beta 4.10267 and the battery plugin is working fine