Hi all,
I have the following automation which is doing exactly what I need, however I noticed that it stops running when I restart HA. I think the problem is at the delay action and I also think that I have to replace the delay with a timer, but I don’t know if this is doable and how to do it, at all. Can someone help or point to the right direction?
Of course, I wouldn’t mind if there is an easier or alternatives solution. My only goal here is to ensure that the automation can run seamlessly after the HA restarts.
- id: Bedroom AC stable temperature
alias: Bedroom AC stable temperature
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.shelly1pm_349454789b5a_power
for:
hours: 0
minutes: 1
seconds: 30
above: 60
condition:
- condition: numeric_state
entity_id: sensor.shelly1pm_349454789b5a_power
above: 7
action:
- service: climate.set_temperature
data:
temperature: 31
hvac_mode: cool
target:
entity_id: climate.bedroom_ac
- service: climate.set_fan_mode
data:
fan_mode: silence
target:
entity_id: climate.bedroom_ac
- if: "{{ this.from_state.attributes.last_triggered < today_at() }}"
then:
- delay:
minutes: 5
else:
- delay:
minutes: "{{ states('input_number.air_condition_delay_minutes') | int(0) }}"
seconds: "{{ states('input_number.air_condition_delay_seconds') | int(0) }}"
- service: climate.set_temperature
data:
# temperature: 25
temperature: "{{ states('input_number.air_condition_temperature_number') }}"
hvac_mode: cool
target:
entity_id: climate.bedroom_ac
- service: climate.set_fan_mode
data:
fan_mode: silence
target:
entity_id: climate.bedroom_ac
I don’t mind if the we the following piece of code would be removed
- if: "{{ this.from_state.attributes.last_triggered < today_at() }}"
then:
- delay:
minutes: 5
else:
Mainly the code starts and stop my air condition during the day like this
I turn on manually the AC and after 1:30 minutes “stop” the AC by turning the temperature to 31. Then after the delay (which I need to replace) of 05 or 04 minutes it turns it on again by setting the temperature to 25 and the cycle continues until I turn off the AC. I just need to be able to change the delay time without to reload the automation that’s why I used the input numbers. I think if I could change this with a timer should be ok, (it will work after a restart, and change the delay without a reload) but I don’t know how to implement.