Waiting is the hardest part

My ObiTALK device periodically requires a reboot. On any given day when the device requests a reboot, I want the reboot to occur at 0017 (17 minutes after midnight).

Today was the first real test of my automation. When the reboot request event triggered, I reeived a notification of the pending reboot as expected. However, the “wait until 0017” action did not BLOCK the “reboot” action. The “reboot” was executed immediately.

Am I doing this incorrectly?? Any suggestion appreciated. Thanks!

History Window:

Trace:

yaml:

id: 'randomnumber'
alias: ObiTALK  Reboot
description: ''
trigger:
  - platform: state
    entity_id:
      - sensor.obihai_reboot_required
    to: 'true'
condition: []
action:
  - service: notify.mobile_app_s10_d
    data:
      message: ObiTALK will reboot at 12:17 AM
      title: Obihai
  - wait_for_trigger:
      - platform: time
        at: '00:17:00'
    timeout:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - service: button.press
    data: {}
    target:
      entity_id: button.obihai_reboot
mode: single

That timeout is suspiciously short.

1 Like

Why not flip it around, just run the automation every night at 12:17am, and once triggered you check the condition of the reboot sensor = true before doing the reboot?

1 Like

Does a wait_for_trigger survive a restart? Not sure about that…

Anyway, the suggestion from @dgaust is better and it will survive a restart of HA. I’d go with that. :smiley:

1 Like

Agreed. No “waiting” whatsoever. :wink:

Very good and THANKS!

As you suggested:

If wait_for_trigger doesn’t survive a restart, I’m sure it would get a chance on the next restart “cycle”…

I appreciate the comment. I’ll proceed with @dgaust 's suggestion.

thanks all!

1 Like