appdaemon icon indicating copy to clipboard operation
appdaemon copied to clipboard

[Enhancement Request] Add "wait_for" option to sequences

Open dekiesel opened this issue 5 years ago • 3 comments

It would be great if sequences had a "wait_for" option. A wait_for chunk could look like this

   - wait_for:
        entity_id: input_boolean.debug_switch_3    #entity to wait for
        new: "on"                                                     #continue if state is this
        immediate: True                                           #if True: check if entity already in state. If False: wait for state change to new
        timeout: 30                                                   #wait for max this time
        unit: seconds
        on_timeout: continue                                   #wait timed out and state still doesn't match new: continue or stop?


The yaml-excerpt above would translate to: "Wait for debug_switch_3 to turn on, but at most for 30 seconds. If the wait times out continue with the rest of the sequence"

My personal use case is that I sometimes need to wait for a certain state before I can proceed with a sequence and this feature would make a lot of custom apps that need to wait for certain states before continuing with their sequences obsolete.

(Sorry for the bad formatting, I can't get the #comments to align in the code box.)

dekiesel avatar Jan 20 '21 14:01 dekiesel

@dekiesel,

Yeah your request is valid, and its something in the pipline.

If you have no solution for it yet, you can check out some code here I wrote some time back, pending when this is integrated.

Regards

Odianosen25 avatar Jan 20 '21 14:01 Odianosen25

I'll have a look, thank you very much!

dekiesel avatar Jan 20 '21 14:01 dekiesel

sounds to me that sequences this way are going to be HA automations. you can create an automation in HA that does the sequence and has the wait_for option, and then start that automation from AD.

ReneTode avatar Jan 20 '21 20:01 ReneTode