Hi,
I have two scripts, one running every hour, one running every 5 minutes. I need to merge them in a single one as they both increment/decrement a user variable.
Is it possible to make an event running on two timer conditions : 'every hour' and 'every 5 minutes' ?
Then, when running every hour, will it run twice, once for each trigger? Or will it run only once? In that case, what will be the value of item.trigger?
Thanks
Multiple overlapping dzvent events [Solved]
Moderator: leecollings
- boum
- Posts: 136
- Joined: Friday 18 January 2019 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: France
- Contact:
Re: Multiple overlapping dzvent events
Hi,
The script will be executed only once. In item.trigger, you will get the first rule that was evaluated to true. So you should put the 'every hour' first in the list of timer triggers.
The script will be executed only once. In item.trigger, you will get the first rule that was evaluated to true. So you should put the 'every hour' first in the list of timer triggers.
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Multiple overlapping dzvent events
How about to create a Uservariable and use that variable for both scripts. You cant combine them. So 2 scripts 1 per hour 1 every 5 minutes
p.s. did you read my PM about Milight Plugin

p.s. did you read my PM about Milight Plugin
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Multiple overlapping dzvent events
If the scripts are executed close to each other best to use a global_data variable.poudenes wrote: Friday 05 July 2019 14:24 How about to create a Uservariable and use that variable for both scripts. You cant combine them. So 2 scripts 1 per hour 1 every 5 minutes
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Multiple overlapping dzvent events
For my knowledge: because its faster a global_data variable? or other reasons?waaren wrote: Friday 05 July 2019 14:34If the scripts are executed close to each other best to use a global_data variable.poudenes wrote: Friday 05 July 2019 14:24 How about to create a Uservariable and use that variable for both scripts. You cant combine them. So 2 scripts 1 per hour 1 every 5 minutes
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Multiple overlapping dzvent events
Other reason.poudenes wrote: Friday 05 July 2019 14:39 For my knowledge: because its faster a global_data variable? or other reasons?
Because dzVents use one domoticz object with all devices, scenes, cameras, uservariables, etc. for multiple scripts to speedup overall processing it can happen that scripts executed with the same event-trigger (in this case every 5 minutes and every hour are triggered by the same time event once per hour; the other 11 times per hour the 5 minute script is triggered there is no issue) they use the same begin state.
example:
uservar a =70
hour script increase a with 100
5-minute script increase a with 50
assume hour script is processed first. ==> Increase uservar a (is 70 in domoticz object) increased with 100 ==> a = 170
5 minute script is processed when hour script has finished.Uservar a (also 70 because same domoticz object) increased with 50 ==> a = 120
So you expect a to be 70 + 100 + 50 = 220 after the execution of these two scripts but you get a = 120
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Multiple overlapping dzvent events [Solved]
Clear!!
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Who is online
Users browsing this forum: No registered users and 1 guest