Within the Domoticz Python Plugin Framework everytime we call the Update method, it triggers the domoticz notification mechanism (dzEvents .... ), however sometimes, we just have to update some side informations like Signal or Battery level.
For instance if you take a Water Leak device, it is expected that we never get a state change (detection of water) during its all life, despite the fact that the battery will drain and get empty at a point of time.
As of now, in order to protect the Domoticz notification system, (and the device log) we do update only when sValue and nValue are changing.
Could we imagine a specific methods to update silently Battery, Levels ?
Python Framework - Updating Battery and Level without touching sValue and nValue Topic is solved
Moderator: leecollings
-
- Posts: 2016
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Python Framework - Updating Battery and Level without touching sValue and nValue
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
- waltervl
- Posts: 5918
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
Use the SuppressTriggers ?:
Optional
Default: False Boolean flag that allows device attributes to be updated without notifications, scene or MQTT, event triggers. nValue and sValue are not written to the database and will be overwritten with current database values.
https://www.domoticz.com/wiki/Developin ... #Devices_2
Optional
Default: False Boolean flag that allows device attributes to be updated without notifications, scene or MQTT, event triggers. nValue and sValue are not written to the database and will be overwritten with current database values.
https://www.domoticz.com/wiki/Developin ... #Devices_2
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: 2016
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
@waltervl did you already use it ? because from my understanding this do not update anything at all !
It is only used for updating:
Used
Options
Color
CustomImage
SwitchType
SubType
Type
Description
Name
This by the way why there is also a dedicated method for updating the LastUpdate ( Touch() )
It is only used for updating:
Used
Options
Color
CustomImage
SwitchType
SubType
Type
Description
Name
This by the way why there is also a dedicated method for updating the LastUpdate ( Touch() )
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
- waltervl
- Posts: 5918
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
I did not try it.
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: 852
- Joined: Wednesday 15 August 2018 14:38
- Target OS: -
- Domoticz version:
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
Same for me, "SuppressTriggers" haven't worked on my side.
And I have same problem for switches, to don't trigger LUA event during a battery update. I m forced to ignore all event and only update battery during a button press to avoid that.
And I have same problem for switches, to don't trigger LUA event during a battery update. I m forced to ignore all event and only update battery during a button press to avoid that.
-
- Posts: 2016
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
The way I see it is to either create an addition method UpdateBattery() which could be simpler, or the treat "Battery" as the "SuppressTriggers" eligible attribute
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
Hi,
I've had a look at the update function in the legacy plugin framework and it looks like the developer who added SupressTriggers made some interesting choices.
BatteryLevel will ONLY be updated if SuppressTriggers is false and even then only sometimes because the original code was changed to use an underlying internal Domoticz function to update values and that code has hundreds of lines of logic that makes it do different things for different device types.
Given this change was made quite some time ago I'm not sure the code can be reverted because a number of plugins will have been developed to work with it the way it is. Instead I've pushed a fix where the existing code remains but they are also updated (if changed) regardless of SuppressTriggers, this is aligned to how most non-value fields are treated. In some cases they will now be updated twice but that seems like a minor side effect.
Can you try it out?
I've had a look at the update function in the legacy plugin framework and it looks like the developer who added SupressTriggers made some interesting choices.
BatteryLevel will ONLY be updated if SuppressTriggers is false and even then only sometimes because the original code was changed to use an underlying internal Domoticz function to update values and that code has hundreds of lines of logic that makes it do different things for different device types.
Given this change was made quite some time ago I'm not sure the code can be reverted because a number of plugins will have been developed to work with it the way it is. Instead I've pushed a fix where the existing code remains but they are also updated (if changed) regardless of SuppressTriggers, this is aligned to how most non-value fields are treated. In some cases they will now be updated twice but that seems like a minor side effect.
Can you try it out?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
-
- Posts: 2016
- Joined: Monday 02 April 2018 20:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: France
- Contact:
Re: Python Framework - Updating Battery and Level without touching sValue and nValue
@Dnpwwo as usal, this is working well, thanks for the quick update.
the only sad thing, but I think we cannot really change is that nValue and sValue must be part of the parameters.
Well done ! It works with 2021.1 (Build 13374)
the only sad thing, but I think we cannot really change is that nValue and sValue must be part of the parameters.
Well done ! It works with 2021.1 (Build 13374)
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
If the plugin provides you value, you can support me with a donation Paypal.
Wiki is available here.
Zigbee for Domoticz FAQ
Who is online
Users browsing this forum: No registered users and 1 guest