Duration of execution of an action

Jérôme Tapie shared this question 11 years ago
Answered

It would be nice to choose the duration of execution of an action. For example, I turn on my light and I want it to turn off automatically after 5 minutes.

In addition, I would like my action executes only in the evening from 18h to 22h. Is it possible?

Best Answer
photo

Off course it is possible. This is exactly why we made rule creator. You should try using "WAIT" puzzle, and puzzle "SCHEDULER"... Using rule creator, you can do much more than this.

Please find some example on picture attached.

Replies (10)

photo
1

Off course it is possible. This is exactly why we made rule creator. You should try using "WAIT" puzzle, and puzzle "SCHEDULER"... Using rule creator, you can do much more than this.

Please find some example on picture attached.

photo
1

It's OK for the WAIT puzzle but for SCHEDULER, one more question :

how to schedule this : Every night from 10 PM to 8 AM

Thanks

photo
2

If you want http request to do something only between 18 and 22,

there is a simple way to do it with time between and a overly complicated way to do it with 2 schedules and a variable.


Simple way would be something like:

  1. when http_whatever_you_want
  2. if time now between time(18:00) and time(22:00)
  3. then
  4. do_what_you_want_to_do


Complicated:

  1. when scheduler(daily 18:00)
  2. set variable good_time to 1

  1. when scheduler(daily 22:00)
  2. set variable good_time to 0

  1. when http_whatever_you_wand
  2. if variable(good_time) = 1
  3. then
  4. do_what_you_want_to_do


And you can save a scheduler with something like

  1. when scheduler(daily 18:00)
  2. set variable good_time to 1
  3. wait 4*3600
  4. set variable good_time to 0

photo
1

Wonderful, it's perfect ! Thanks !

photo
1

I tried between 18h and 8h (now 20h) and with the condition "if time ... between ... and ..." does not work, whereas in removing the rule works again.


Tested at 20h:


Rule that does not work: capture 1

Rule works : capture 2


Any idea ...?


Thanks !

photo
1

That's my bad.

The firmware that you have doesn't implicitly convert from datetime to time in 'time between' command, but you have to explicitly convert it with to 'time of' command. That will not be necessary with next firmware.

Please try

  1. if time time_of(now) between time(18:00) and time(22:00)

photo
1

This time the problem is reversed, the action runs all the time, regardless of the time interval.

Indeed, it is 12am and the action should not be executed, or my lights come on ...

photo
1

There was a bug in the time range puzzle. High and low were swapped. Fixed in new version.

photo
1

despite the new version 0.9.9.6, the problem with time range puzzle is still present ...

photo
1

Your example "TimeBetweenRule.png" is not working for me withe the latest version. Can you confirm me thait this rule is working now ?

Leave a Comment
 
Attach a file