Hi all,
I’m newbie and trying out my hand at automation. Apologies if it has been asked or answered before.
I have a heater connected to smart plug. I have set an automation which turns it off after 45 minutes. It has worked beautifully and in most cases. However, if I restart Home Assistant, it stops working.
Is there way to extend this to continue after reboot? I’m thinking to setup a helper to record the time when smart plug is turned on but not sure how to restart other automation without trigger and also it doubles up automations (I plan to include more such timers for different room).
alias: Matter Plug 2 - Auto Off - 45 Min
description: ""
triggers:
- trigger: state
entity_id:
- switch.matter_plug_2
to: "on"
for:
hours: 0
minutes: 45
seconds: 0
from: "off"
conditions: []
actions:
- action: switch.turn_off
target:
entity_id:
- switch.matter_plug_2
data: {}
mode: single
To overcome this problem, you need to create the automation to start a Timer instead of using the time in the automation. The delay in the automation does not transfer during the reboot.
This is example, when I switch on my backdoor light it will stay on for 10 Minutes then switch off.
You can create the timer during the automation configuration, but would recommend doing separately: Setting → Devices → Helpers → Create a Helper
The select Timer and give it a name and “tick” the restore box, as that will restore the timer to is state before the reboot / reload.
Thanks @BambamNZ works perfectly. I was worried about timer being finished when HA restarts (or power failure) but seems it is triggered as soon as HA boots up.