Hello,
I am wondering if when using the `heartbeat` function in the domoticz module (see https://wiki.domoticz.com/Developing_a_ ... llable_API) inside of a loop, takes into account the execution time of the code between consecutive iterations? In essence, I am wondering if heartbeat can be considered equivalent to this type of solution https://stackoverflow.com/questions/725 ... s#72587779 where timing of the execution is critical/accounted for. Thanks.
SOLVED: Does heartbeat takes into acount execution time?
Moderator: leecollings
-
- Posts: 45
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
SOLVED: Does heartbeat takes into acount execution time?
Last edited by averter on Saturday 28 December 2024 17:01, edited 1 time in total.
- gizmocuz
- Posts: 2541
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Does heartbeat takes into acount execution time?
No, it should be executed at every heartbeat interval
But I guess you want to use a timer? You can create your own timers in Python if you want
Or you can set the timer parameters in dzVents scripts
But I guess you want to use a timer? You can create your own timers in Python if you want
Or you can set the timer parameters in dzVents scripts
Quality outlives Quantity!
-
- Posts: 45
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
Re: Does heartbeat takes into acount execution time?
Thanks for your reply.
The main objective is to read values from an inverter at specific intervals, and I'm using this plugin to do so https://github.com/saidlm/Domoticz-Sola ... 8C8-L251C1
As you can see, the author has used heartbeat to pause between consecutive iterations, and that's why I was wondering if the code could be improved (apparently yes). Thanks again for your help.
The main objective is to read values from an inverter at specific intervals, and I'm using this plugin to do so https://github.com/saidlm/Domoticz-Sola ... 8C8-L251C1
As you can see, the author has used heartbeat to pause between consecutive iterations, and that's why I was wondering if the code could be improved (apparently yes). Thanks again for your help.
- waltervl
- Posts: 5847
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: SOLVED: Does heartbeat takes into acount execution time?
Why do you want it to be so specific that it needs a more precise timer? Is for example every approx 30 seconds not good enough? What goes wrong if it is sometimes 29 or 31 seconds?
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: 45
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
Re: SOLVED: Does heartbeat takes into acount execution time?
The reason is that I'm using a smart EV charger (dombusevse) along with the inverter, and for it to adjust the charging load properly domoticz should have readings from the inverter at every 5-6 seconds. The more precisely the better (less fluctuations).
Although 5-6 seconds might seem exaggerated, according to the dombusevse's website this is a standard value:
The 6s time (SAE1772 standard) corresponds with the max time that the OBC can use to modify the consumed power in accordance with what is established by the EVSE module
- waltervl
- Posts: 5847
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: SOLVED: Does heartbeat takes into acount execution time?
Every 5 or 6 seconds should be handled correctly unless you have a lot running on your system including mqtt.
Execution times of scripts should not exceed a couple of seconds. If not you have programmed the scripts incorrectly. For dzvents scripts look at asynchronous external commands execution, incl openURL().
Execution times of scripts should not exceed a couple of seconds. If not you have programmed the scripts incorrectly. For dzvents scripts look at asynchronous external commands execution, incl openURL().
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