I have a number of Zigbee temperature sensors connected to Domoticz via the Deconz plugin. The temperature and the humidity values of a sensor become separate devices in Domoticz. I use a dzVents script I found on Internet to combine these temperate and humidity values into one device.
The problem is, however, that the battery level of the sensor is not written into the new combined device. I can read the battery level of a device with:
local level = device.batteryLevel
How can I write the read battery level into the combined humidity/temperature device? I tried for example:
domoticz.devices('Bijkeuken').batteryLevel=domoticz.devices('$temperature Bijkeuken').batteryLevel
but that does not work.
I hope someone can help.
Regards,
Jan
How to write the battery level to a device?
Moderator: leecollings
- waltervl
- Posts: 5846
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: How to write the battery level to a device?
There is no setBatterylevel function in Dzvents like for other values.
You should ask the plugin owner to do that, no need to have a separate battery device and separate Temp and Hum devices.
You should ask the plugin owner to do that, no need to have a separate battery device and separate Temp and Hum devices.
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
- DewGew
- Posts: 581
- Joined: Thursday 21 April 2016 12:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10618
- Location: Sweden
- Contact:
Re: How to write the battery level to a device?
You can use domoticz api in dzVents:
Code: Select all
domoticz.openURL('http://ipadress/json.htm?type=command¶m=udevice&idx=<idx>&battery=<numeric value>')
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
-
- Posts: 38
- Joined: Sunday 11 August 2019 17:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to write the battery level to a device?
When I try http://192.168.1.2:8080/json.htm?type=c ... battery=20DewGew wrote: ↑Thursday 22 February 2024 18:05 You can use domoticz api in dzVents:Code: Select all
domoticz.openURL('http://ipadress/json.htm?type=command¶m=udevice&idx=<idx>&battery=<numeric value>')
I get the error:
{
"status": "ERR"
}
What I do wrong?
Regards,
Jan
-
- Posts: 575
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: How to write the battery level to a device?
When you send additional parameters like batterylevel you should also send the normal parameter(s)
See: https://www.domoticz.com/wiki/Domoticz_ ... y_level.29
That's the way I do it in Nodered.
See: https://www.domoticz.com/wiki/Domoticz_ ... y_level.29
That's the way I do it in Nodered.
Logic will get you from A to B. Imagination will take you everywhere.
-
- Posts: 381
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Re: How to write the battery level to a device?
It would be great if in the Devices list you could have a tick box next to the battery icon to say show battery level in device widget, the value would be visible at a glance then on any page.
-
- Posts: 575
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: How to write the battery level to a device?
Most battery operated devices last more then a year on a battery, besides in the device list you can sort on battery level, so you can see which due for a battery change.
You can also use one of the dzVents scripts that warn you when battery goes low.
So I don't think it is a good idea to have some icon/level indicator extra in the already crowded widget.
You can also use one of the dzVents scripts that warn you when battery goes low.
So I don't think it is a good idea to have some icon/level indicator extra in the already crowded widget.
Logic will get you from A to B. Imagination will take you everywhere.
-
- Posts: 38
- Joined: Sunday 11 August 2019 17:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to write the battery level to a device?
That works! Thanks!Kedi wrote: ↑Friday 23 February 2024 13:04 When you send additional parameters like batterylevel you should also send the normal parameter(s)
See: https://www.domoticz.com/wiki/Domoticz_ ... y_level.29
That's the way I do it in Nodered.
I'll try to rewrite my current script to add the battery level.
regards,
Jan
Who is online
Users browsing this forum: No registered users and 1 guest