I wrote a script to read the battery percentage of a device by IDX number and then send that value to a dummy custom device again by IDX number, when I did this the battery percentage of the device according to Z2M and Dom was 50% which is exactly the value I got displayed in my dummy device. I then had an issue a bit later with the hardware not responding and so replaced the batteries, that cured the issue and they are now showing 100% in both Z2M and Dom but i have just noticed that despite my script still running my displayed value in my dummy device is still 50%.
Any ideas ?
script help
Moderator: leecollings
- waltervl
- Posts: 5770
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: script help
Perhaps it is not wise to name an attribute exactly the same as the parameter batteryLevel so make it for example mybatteryLevel
Do you see the same incorrect value 50% in the log line you are logging?
And next, why do you want to export the battery level to a separate device? If the level becomes low you can have Domoticz send notifications and also the device widgets change in color when battery level becomes low.
Also there are scripts that check levels without using a separate device. https://wiki.domoticz.com/Battery_level_check
Do you see the same incorrect value 50% in the log line you are logging?
And next, why do you want to export the battery level to a separate device? If the level becomes low you can have Domoticz send notifications and also the device widgets change in color when battery level becomes low.
Also there are scripts that check levels without using a separate device. https://wiki.domoticz.com/Battery_level_check
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 378
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Re: script help
Thanks for you rcomments, I will look into this. Yes I see the value in the log, the update time is not normally 10 mins, I adjusted this so I could try and investigate a little easier.
The reason for checking the battery is that for most (if not all) devices the battery level I have set in Domoticz for alerting me to a low battery is fine however this device stops responding correctly when it gets to about 50% so I needed a separate way to monitor it.
I will look at the link you have sent and hopefully this will help.
Thanks again.
The reason for checking the battery is that for most (if not all) devices the battery level I have set in Domoticz for alerting me to a low battery is fine however this device stops responding correctly when it gets to about 50% so I needed a separate way to monitor it.
I will look at the link you have sent and hopefully this will help.
Thanks again.
- waltervl
- Posts: 5770
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: script help
You can set the default notification level at 60% from the Domoticz settings to get a notification before it reaches 50%
Or let a dzvents script daily only check the affected sensors and send a notification if needed. No need to create separate devices for this.
Or let a dzvents script daily only check the affected sensors and send a notification if needed. No need to create separate devices for this.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 378
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Re: script help
I don't need notification of any other devices until they reach about 20 or 25%, it's only 2 devices that I need to know about at 50%
- waltervl
- Posts: 5770
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: script help
You can do something like this: viewtopic.php?p=282048
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: No registered users and 1 guest