Page 1 of 1
check for multiple timer triggers
Posted: Wednesday 27 May 2026 18:13
by Gravityz
Hello,
i want to check for multiple timer triggers and based on the trigger time i want to execute something.
i tried several things but it does not seem to work
either the timer triggers are wrong or the check.
it did a compare with both 'at 21:00' as well as '21:00' but none of them work so i suspect the timer definition is wrong.
i want to check several times during the period of 01/05 until 09/09
can somebody help me out
timer definition
Code: Select all
timer = {'on 01/05-09/09 at 06:00, at 12:00, at 21:00'},
check
Code: Select all
execute = function(domoticz,event)
if event.isTimer and event.trigger == 'at 21:00' then
-- execute some code
end
Re: check for multiple timer triggers
Posted: Wednesday 27 May 2026 21:46
by waltervl
Perhaps just log the trigger to see what you have to check against. I never used these kind of checka so no idea what the value really is. Be aware that you set a test trigger minimum 2 minutes away to be sure the trigger is registered.
Code: Select all
execute = function(domoticz,event)
if event.isTimer then
domoticz.log('trigger: ' .. event.trigger)
end
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 9:09
by Gravityz
i discovered the following
Works
Code: Select all
timer = {'on 01/05-09/09 at 07:00'},
does not work
Code: Select all
timer = {'on 01/05-09/09 at 07:00, at 08:00'},
works
Code: Select all
timer = {'on 01/05-09/09 at 07:00','on 01/05-09/09 at 13:00', 'on 01/05-09/09 at 21:30'},
so it seems you can do a timer with date and time but if you have multiple times you need to add the date part to every time.
also the event.trigger also includes the date part and will be 'on 01/05-09/09 at 21:30'
so for now working but i would have thought 1 date with multiple times would be more readable/logical
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 11:43
by habahabahaba
execute = function(domoticz, item)
if (item.isTimer) then ... - working for me
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 12:01
by Gravityz
that is not the problem.
the problem isa based on different timers execute different code
habahabahaba wrote: Thursday 28 May 2026 11:43
execute = function(domoticz, item)
if (item.isTimer) then ... - working for me
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 12:14
by habahabahaba
oh..
So try
if domoticz.time.matchesRule('on 01/05-09/09 at 06:50-07:05') then ...
Or did I misunderstand you again?
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 13:22
by Gravityz
that will probably work but i want mutliple specific times, not a timeframe
so using your example i want
Code: Select all
if domoticz.time.matchesRule('on 01/05-09/09 at 06:50, at 07:05') then ...
this does not seem to work
i can only make it work if i add the dateframe to every time
maybe this is by design
Re: check for multiple timer triggers
Posted: Thursday 28 May 2026 18:23
by habahabahaba
'01/05-09/09 at 07:00 or at 08:00 or at 09:00'
as a variant
Re: check for multiple timer triggers
Posted: Friday 29 May 2026 7:55
by Gravityz
thanks, will test
habahabahaba wrote: Thursday 28 May 2026 18:23
'01/05-09/09 at 07:00 or at 08:00 or at 09:00'
as a variant
Re: check for multiple timer triggers
Posted: Friday 29 May 2026 9:27
by waltervl
So you have 2 issues:
1. Getting multiple timer triggers working in the on section. But you are getting there I read above....
2. A check which timer trigger is triggered. Did you log the timer event.trigger already?
Re: check for multiple timer triggers
Posted: Friday 29 May 2026 14:05
by Gravityz
tried it but that example does not work either
this works
Code: Select all
timer = {'on 01/05-09/09 at 07:00','on 01/05-09/09 at 13:00', 'on 01/05-09/09 at 21:30'},
the trigger logged is
on 01/05-09/09 at 07:00
this works
Code: Select all
timer = {'on 01/05-09/09 at 07:00'},
the trigger logged is
at 07:00
the other examples doe not work and nothing is logged.
so for now i am good to go