Page 1 of 2
batterylevel contacts
Posted: Wednesday 23 December 2020 21:40
by michelscholte
Is there a way to show the battery level of door/window contacts on the Dashboard?
Re: batterylevel contacts
Posted: Thursday 24 December 2020 15:41
by Lokonli
Not yet.
How would you like to have it presented?
I could show an icon at the upper right of a block, when the battery level is below a certain threshold.
Currently this are the existing font-awesome icons.

- battery-level.jpg (8.31 KiB) Viewed 1714 times
Would that be sufficient?
(on the dashboard they will be rotated counter clockwise)
Re: batterylevel contacts
Posted: Thursday 24 December 2020 18:24
by michelscholte
That would be great. Are you using all the 5 icons, so that each level has his own icon or only the empty one when the level is below a certain value? Thanks in advance.
Re: batterylevel contacts
Posted: Thursday 24 December 2020 18:39
by Lokonli
I planned to use them all:
>90%: full
>60%: three quarters
>35%: half
>10: quarter
<=10: empty
but only show them if battery level is below the user defined threshold
Re: batterylevel contacts
Posted: Monday 28 December 2020 9:13
by michelscholte
OK. That's nice.
Re: batterylevel contacts
Posted: Wednesday 30 December 2020 23:35
by Lokonli
ok, implemented first version in latest beta.
Could you test?
Add the following to CONFIG.js to show the battery level for all battery powered devices:
The batteryThreshold parameter can also be set on block level.

- batterylevel.jpg (5.07 KiB) Viewed 1657 times
See:
https://dashticz.readthedocs.io/en/beta ... tery-level
Re: batterylevel contacts
Posted: Thursday 31 December 2020 10:06
by madpatrick
Hi Lokonli,
It is working !
Nice add-on
Re: batterylevel contacts
Posted: Thursday 31 December 2020 11:24
by red73390
Hello,
I try to implement it also (i swithed to the beta branch). I think there's a difference because I use zwave module with 2 or more informations and domoticz didn't manage the battery as he does with a simple battery object (433 for example).
I'm using this plugin in domoticz to have a battery object.
https://www.domoticz.com/wiki/Plugins/BatteryLevel.html
Do you think it's possible to link the battery state you implement to another idx ?
Thank you.
Re: batterylevel contacts
Posted: Thursday 31 December 2020 12:42
by Lokonli
red73390 wrote: ↑Thursday 31 December 2020 11:24
Hello,
I try to implement it also (i swithed to the beta branch). I think there's a difference because I use zwave module with 2 or more informations and domoticz didn't manage the battery as he does with a simple battery object (433 for example).
I'm using this plugin in domoticz to have a battery object.
https://www.domoticz.com/wiki/Plugins/BatteryLevel.html
Do you think it's possible to link the battery state you implement to another idx ?
Thank you.
If I read the zwave plugin page, then it seems that the plugin just uses the battery information from the device itself.
If that's true then it doesn't add value to connect to the additional 'battery level' devices created by the plugin.
If you set config['batteryThreshold'] = 256
do you then see battery level info for your zwave devices?
Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:00
by madpatrick
Using
gives all the battery info of my zwave devices.
Is it possible to scale the image ?
My block a little bit small

Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:09
by Lokonli
The default battery font size is 15. To reduce it to 10, add the following to custom.css:
Code: Select all
.battery-level {
font-size: 10px
}
To change the font size for the percentage number: (default is 10)
Code: Select all
.battery-percentage {
font-size: 5px;
}
Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:30
by madpatrick
The default size was bigger then 15px
I need to go to "font-size: 20px" and add "!important"
Probably due the small screen size of my tablet
Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:32
by red73390
@madpatrick : Then i have to check again, with config['batteryThreshold'] = 100; or config['batteryThreshold'] = 256; nothing appear
@Lokonli : Yes the plugin battery ask the zwave master, and create a new equipment for each equipment with a battery status. As it works for madpatrick I need to check why it's not working for me.
- Spoiler: show
- blocks['Astride_Mesure'] =
{
idx: 12,
width: 12,
title: 'Chambre Astride',
batteryThreshold: 256,
last_update: true,
popup: 'popup_Astride_Temp_SP'
}

Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:45
by Lokonli
Device 11 and 12 seem to have battery level info.
Double check that you run the latest Dashticz beta version. Update with 'git pull' in the Dashticz folder. There should be no errors reported.
Re: batterylevel contacts
Posted: Thursday 31 December 2020 13:48
by Lokonli
madpatrick wrote: ↑Thursday 31 December 2020 13:30
The default size was bigger then 15px
I need to go to "font-size: 20px" and add "!important"
Probably due the small screen size of my tablet
or you changed the icon font size in custom.css already? (or font size for .fas)
Re: batterylevel contacts
Posted: Thursday 31 December 2020 14:24
by madpatrick
Lokonli wrote: ↑Thursday 31 December 2020 13:48
or you changed the icon font size in custom.css already? (or font size for .fas)
yep.....
.fas was set to 26px

Re: batterylevel contacts
Posted: Thursday 31 December 2020 14:40
by red73390
Lokonli wrote: ↑Thursday 31 December 2020 13:45
Device 11 and 12 seem to have battery level info.
Double check that you run the latest Dashticz beta version. Update with 'git pull' in the Dashticz folder. There should be no errors reported.
Yes device 11 and 12 have battery info, in fact it's 1 equipment with many devices.
I tried it again in dashticz folder, git pull -> it say already up to date (french translate)
In the info on dasthicz folder i'm in version 3.7.2 beta you are running latest version
Re: batterylevel contacts
Posted: Thursday 31 December 2020 18:36
by Lokonli
Can you post the output of:
Code: Select all
http://domoticz ip:port/json.htm?type=devices&rid=11
Re: batterylevel contacts
Posted: Thursday 31 December 2020 18:48
by red73390
Lokonli wrote: ↑Thursday 31 December 2020 18:36
Can you post the output of:
Code: Select all
http://domoticz ip:port/json.htm?type=devices&rid=11
- Spoiler: show
- {
"ActTime" : 1609436787,
"AstrTwilightEnd" : "18:48",
"AstrTwilightStart" : "06:44",
"CivTwilightEnd" : "17:26",
"CivTwilightStart" : "08:06",
"DayLength" : "08:02",
"NautTwilightEnd" : "18:08",
"NautTwilightStart" : "07:24",
"ServerTime" : "2020-12-31 18:46:27",
"SunAtSouth" : "12:46",
"Sunrise" : "08:45",
"Sunset" : "16:47",
"app_version" : "2020.2",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 82,
"CustomImage" : 0,
"Data" : "17.0",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "Zwave",
"HardwareType" : "OpenZWave USB",
"HardwareTypeVal" : 21,
"HaveTimeout" : false,
"ID" : "0000701",
"LastUpdate" : "2020-12-31 18:44:23",
"Name" : "Zwave_Cons_Radiateur_Astride",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" :
[
0
],
"Protected" : false,
"SetPoint" : "17.0",
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "SetPoint",
"Timers" : "true",
"Type" : "Thermostat",
"TypeImg" : "override_mini",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "11"
}
],
"status" : "OK",
"title" : "Devices"
}
Re: batterylevel contacts
Posted: Thursday 31 December 2020 19:01
by Lokonli
Just as double check, can you add the following to CONFIG.js:
Do you see any battery level?