How do I manage events by time?

One of the ways to manage events by time.

The event starts from 8 am to 23 pm every 10 minutes. BTN12 is turned on and the LED indication is displayed. Starting now reverse delay timer for 60 seconds
if timer_l==0&getHours() > 07&getHours() <23&gethhmm() == «**:*1» then {btn12= 1; led =1; timerPump = 60}

Shutdown after 60 seconds by timer.
if timerPump==0 then {led=0; btn12=0}

Turn on the light from 17 to 22 hours. This construction will work at any time from this interval. If suddenly there was no light and it appeared later, it will still turn on.
If you want it to work only at 17 you can use the module cronif timer_l==0&getHours() > 16&getHours() <22&light_time==0 then {btn13 = 1; light_time=1; tglemon2.sendMsg(«Лимон1 свет включен » + getTime())}

Lights out at 22.00
if timer_l==0&light_time==1&getHours() > 21 then {btn13 = 0; light_time=0;}

This is one of the ways to manage events in IoTmanager. There are others, each for its own case.

For this scenario to work, you need a circular timer timer_l with an interval of one minute, for generating events, and a timer called timerPump. You can do without the second line: if timer_l==0&getHours() > 07&getHours() <23&gethhmm() == «**:*2» then {btn12 = 0; led =0;}

The effect will be similar. This shows that you can achieve the same action in different ways.
You can also use the string:
if cron then {btn12 = 0; led =0;}
In this case, with the cron setting, specify:

0 2,12,22,32,42,52 * * * *

Leave a Comment

Supported the project — saved a DIY maker! And we accept gifts...

X