Switch: on_turn_on => what happens, if a delay in this function is still running and the switch is turned off

Hi everyone,

following scenario:

  • switch with “on_turn_on”
  • added a delay to on_turn_on with “1 hour” and some other operations after the delay
  • during that time period the switch is turned off

Now the question: Does delay gets stopped once the switch is turned off or is this still going to be executed?

And second: what happens, when within this hour the switch is turned on and off several times. Are the on_turn_on_operations which are still after the delay going to be executed? Does this behave like a script in restart mode or parallel mode?

Very happy for an answer!


Hi - post your yaml - it may make it clearer what you are doing.

Delay will not be stopped.
To achieve this - put delay and actions in script and execute script on on_turn_on ans stop it when on_turn_off happens.

1 Like