alias: Lounge Heating on for 1 hour if temp < 15
description: ""
trigger:
- platform: state
entity_id: sensor.lounge_temp_temp
condition:
- condition: numeric_state
entity_id: sensor.lounge_temp_temp
below: 15
- condition: state
entity_id: switch.lounge_plug_baxi
state: "off"
action:
- service: homeassistant.turn_on
target:
entity_id: switch.lounge_plug_baxi
data: {}
- delay:
hours: 0
minutes: 30
- service: homeassistant.turn_off
target:
entity_id: switch.lounge_plug_baxi
data: {}
mode: single
My underastanding is this will thurn the lounge_plug_baxi on for 30 minutes if tempriture drops below 15, and will efectivly pause the automation so it will not fire again untill after all the ctions are finished?
This is essentially correct. Though it is not “paused” as such.
What actually happens is that while the actions are waiting in the delay new triggers are rejected because the automation is already running and you have selected ‘single’ mode that only allows one instance of the automation to run at a time.
There are a few issues with this automation.
It will log warnings every time more than one instance tries to run at a time, which could be quite often depending on your temp sensor update rate. You can suppress this logging with max_exceeded: silent see: https://www.home-assistant.io/docs/automation/modes/
Your automation alias says you want the heating on for an hour but your delay is only for 30 minutes.
Waiting a long time in an automation isn’t a good idea. If it is interrupted (e.g. by a restart) then your plug will never turn off. A better way would be:
lias: Lounge Heating off after 1 hour
description: ""
trigger:
- platform: state
entity_id: switch.lounge_plug_baxi
to: 'on'
for:
hours: 1
condition: {}
action:
- service: switch.turn_off
target:
entity_id: switch.lounge_plug_baxi
data: {}
Now a restart will reset that 1 hour time counting in the second automation but at least it will turn off an hour after the restart.
You could combine the two automations using trigger ids and a choose action if you wish, but two automations is simpler.
The other way is to use a timer as they can be restored after a restart. So as long as you are not shut down for longer than an hour the heating will only be on for an hour.
The problem is that other automations also turn heating on and if these run I dont want the heating tuened off after 30 mins (Alias name wrong, I was going to do 1 houre but decided to do 30 mins). If the temp was still under 15 (which is verry unlikely) it will just run again. I actualy have quite a few automations for the heating and there is a failsafe that turns off heating if it gets hotter than 19 so ime not too woried about the restart casuing a problem.
What would be good would be a bluepring that works like a modern central heating controler, where you set begin and end times for diferent tempritures. This is what I am doing.
How can I find/change the update rate. 10 mins would be fine.
Then use a helper to communicate between automations.
e.g. use an input select with the options “Manual” and “Automatic”. Then in your other automations set this to “Automatic” when they run. In the turn off automation above use a condtion to disallow the actions unless the input select sate is “Manual”.
An input boolean would also do if you only have two options. You can have more with an input select if needed.