Page 1 of 1
Multiple overlapping dzvent events
Posted: Thursday 04 July 2019 15:03
by galinette
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
Re: Multiple overlapping dzvent events
Posted: Thursday 04 July 2019 15:32
by boum
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.
Re: Multiple overlapping dzvent events
Posted: Friday 05 July 2019 14:24
by poudenes
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

Re: Multiple overlapping dzvent events
Posted: Friday 05 July 2019 14:34
by waaren
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
If the scripts are executed close to each other best to use a global_data variable.
Re: Multiple overlapping dzvent events
Posted: Friday 05 July 2019 14:39
by poudenes
waaren wrote: Friday 05 July 2019 14:34
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
If the scripts are executed close to each other best to use a global_data variable.
For my knowledge: because its faster a global_data variable? or other reasons?
Re: Multiple overlapping dzvent events
Posted: Friday 05 July 2019 14:55
by waaren
poudenes wrote: Friday 05 July 2019 14:39
For my knowledge: because its faster a global_data variable? or other reasons?
Other reason.
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
Re: Multiple overlapping dzvent events [Solved]
Posted: Friday 05 July 2019 15:00
by poudenes
Clear!!