How does dzvents handle a reptitive switch command

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

Moderator: leecollings

Post Reply
HvdW
Posts: 615
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

How does dzvents handle a reptitive switch command

Post by HvdW »

Just out of curiosity.
How does dzvents handle reptitive calls, let's say every 10 minutes.
In the following code the 'if' will be handled 6 times.
Will there be a six (twelve) times switch command in memory or will the timed switch commands be overwritten every 10 minutes.

Code: Select all

            if (current_time > '23:00') then
              domoticz.devices('myswitch').switchOn('at 23:01')
              domoticz.devices('myswitch').switchOff('at 06:59')
            end
I know, the correct code should be:

Code: Select all

            if (current_time == '23:00') then
              domoticz.devices('myswitch').switchOn('at 23:01')
              domoticz.devices('myswitch').switchOff('at 06:59')
            end
Nevertheless there is this curiosity.
Bugs bug me.
willemd
Posts: 652
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: How does dzvents handle a reptitive switch command

Post by willemd »

Not an answer to your curiosity I know, but I would test for the status of the switch before sending the switch commands. Then you are sure the command is only issued once, whether you use > or ==
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest