Delay done: false?

Howdo.

Scenario:

I have an automation I’ve been using for a while to help keep tabs on the state of charge for our car. It runs each night at 2300hrs, looks at the vehicle location and battery percentage, and reports back if there’s anything we need to do overnight. This works perfectly.

Keeping the polling sensor open on the car means that we do get some vampire drain, so I tend to turn it off if I know the car is sat unused. My problem is that the nightly automation then can’t see the car info, so I risk missing scenarios where a prompt would trigger.

I was solving this by using another automation, running ahead of the primary automation at 2230hrs, and checking to see if the polling sensor is off. If that condition is met, the automation turns the polling sensor on, waits for 35 minutes (so that the battery check can run with updated data at 2300) and then flips it back off again.

End result: Polling is always available for the period I want to check, and my preference to have it on or off is honoured.

Issue:

My automation does not turn the polling sensor back off. When I look at the trace, the delay seems to fail to complete. Sharing the steps below, can anyone see what I’m doing wrong?

Step 1: OK. Automation runs at 2230

Step 2: OK. Automation checks the polling sensor and continues

Step 3: OK. Automation sets the polling sensor

Step 4: Problem. Automation waits for 35 minutes


I note that the ‘done’ value is false. The syntax looks correct, as its correctly understood 35 minutes is 2100 seconds.

Step 5: Automation should turn off the sensor, but doesn’t reach this step


Per above, this step is not executed. There’s no condition on it, just that the delay never seems to complete.

Yaml:

alias: 2230 - Poll car if off, to update location
description: ''
trigger:
  - platform: time
    at: '22:30'
condition:
  - condition: device
    type: is_off
    device_id: 7c1b76042f84538e96e8a82aa7a81ad8
    entity_id: switch.silent_bob_update_switch
    domain: switch
action:
  - type: turn_on
    device_id: 7c1b76042f84538e96e8a82aa7a81ad8
    entity_id: switch.silent_bob_update_switch
    domain: switch
  - delay:
      hours: 0
      minutes: 35
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 7c1b76042f84538e96e8a82aa7a81ad8
    entity_id: switch.silent_bob_update_switch
    domain: switch
mode: single

Thoughts

  • I realise I could add a third automation that turns the polling sensor off, but then I’d need another helper entity to say whether or not it was originally enabled, and this seems a long way round.
  • I don’t think its a UTC thing, my timezone is currently one hour ahead of UTC, so the delay doesn’t cross the date terminator in local or zulu.
  • I’m stuck for a reason why that delay isn’t passing execution to step 5. Are delays known to be a bit flaky? Am I doing something wrong? Is my approach just out?

Cheers for any light you can shed on this.

5 Likes