check for multiple timer triggers

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

check for multiple timer triggers

Post 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
User avatar
waltervl
Posts: 7020
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: check for multiple timer triggers

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

Re: check for multiple timer triggers

Post 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
User avatar
habahabahaba
Posts: 285
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: check for multiple timer triggers

Post by habahabahaba »

execute = function(domoticz, item)

if (item.isTimer) then ... - working for me
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

Re: check for multiple timer triggers

Post 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
User avatar
habahabahaba
Posts: 285
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: check for multiple timer triggers

Post 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?
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

Re: check for multiple timer triggers

Post 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
User avatar
habahabahaba
Posts: 285
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: check for multiple timer triggers

Post by habahabahaba »

'01/05-09/09 at 07:00 or at 08:00 or at 09:00'
as a variant
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

Re: check for multiple timer triggers

Post 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
User avatar
waltervl
Posts: 7020
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: check for multiple timer triggers

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Gravityz
Posts: 755
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2026.3
Location: Netherlands
Contact:

Re: check for multiple timer triggers

Post 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
Post Reply