#AC automatiuation
1 messages Β· Page 1 of 1 (latest)
i everyone π
Iβm looking for some feedback on a Home Assistant climate automation I built.
It controls an AC based on outdoor temperature (with hysteresis), time of day, and sunset.
What I want to achieve:
Turn the climate off at 10:00
In the evening/night, heat or cool depending on stable outdoor temperature
Use hysteresis (for: timers) to avoid frequent switching
Safety rule: if the room temperature drops below 10 Β°C during the day, force heating on
My questions:
Is this structure reasonable, or am I overusing choose?
Would you split this into multiple automations?
Any best practices to simplify hysteresis + time logic?
Can you edit the first post to only include the code and the second the include the whole qustion?
But it can be simplified a bit. For example, the second (non-nested) choose could be just a third case.
The nested choose makes sense to not repeat the time periode in each option. But you could leave out the triggers.
And
- condition: or
conditions:
- condition: time
after: "18:00:00"
- condition: time
before: "10:00:00"
#is the same as
- condition: time
after: "18:00:00"
before: "10:00:00"
As it may wrap over midnight nowadays (changed like 2 years ago)
So think you could simplify it to:
https://pastebin.com/Mbj1LGk4
And yeah, with templates you can reduce it even further. But that's not always making it simpler π
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Keep in mind you do have weird gaps, when it is between -1 and 1 or between 19 and 21 degree, you do nothing now. Does not seem correct. As even though it's 20 degrees outside @ 10:00, the room might not be at the desired temperature. And now you will not set the climate until outside does above 21 or below 19.
- conditions:
- condition: numeric_state
entity_id: sensor.mareike_outdoor_temperature
below: -1
sequence:
- service: climate.set_hvac_mode
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
hvac_mode: heat
- service: climate.set_temperature
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
temperature: 25
- conditions:
- condition: numeric_state
entity_id: sensor.mareike_outdoor_temperature
below: 21
sequence:
- service: climate.set_hvac_mode
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
hvac_mode: heat
- service: climate.set_temperature
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
temperature: 23
- conditions:
- condition: numeric_state
entity_id: sensor.mareike_outdoor_temperature
above: 21
sequence:
- service: climate.set_hvac_mode
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
hvac_mode: cool
- service: climate.set_temperature
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
data:
temperature: 20 ```
mode: single
trigger:
- id: sunset
platform: sun
event: sunset
- id: evening_fallback
platform: time
at: "18:00:00"
- id: morning_reduce
platform: time
at: "10:00:00"
- id: cold_stable
platform: numeric_state
entity_id: sensor.mareike_outdoor_temperature
below: -1
for: "00:10:00"
- id: mild_stable
platform: numeric_state
entity_id: sensor.mareike_outdoor_temperature
above: 1
below: 19
for: "00:10:00"
- id: warm_stable
platform: numeric_state
entity_id: sensor.mareike_outdoor_temperature
above: 21
for: "00:10:00"
- id: room_too_cold
platform: numeric_state
entity_id: climate.57a18c41e9d728829b73a45b811286a1
attribute: current_temperature
below: 10
for: "00:05:00"
action:
- choose:
- conditions:
- condition: trigger
id: morning_reduce
sequence:
- service: climate.turn_off
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
- conditions:
- condition: trigger
id: room_too_cold
- condition: time
after: "10:00:00"
before: "18:00:00"
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: heat
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
- service: climate.set_temperature
data:
temperature: 21
target:
entity_id: climate.57a18c41e9d728829b73a45b811286a1
My problem is that the AC sometimes does not turn on automatically at 6pm
Is that because of the missing interval between -1 and 1?
Yeah, if at 18:00 it is between those there is no action now
That's why I said I think they are werid π
Hi, I want to use thermostat card for charging my batteries. Instead of temperature,, the sensor will be SOC or battery voltage... It is possible?
@hybrid dove Get your own topic please π
@slim zephyr If you still have issues, please post the whole automation.
And also look in your traces for the trace at 18:00 (or other time you have an issue)
You still have a minor gap. As "below: 5" and "above: 5" leave out exactly 5 as that's neither below or above 5 π But changes are slim but not 0 and larger with less/no decimals. Just remove the "above"-part from the conditions. As only at most one choose option is executed and if will check in order (top top bottom), when you are at option 2 you already know the temperature is not below 5 otherwise option 1 would have been executed and thus option 2 will not even be evaluated.
And you removed the outdoor temp triggers, no need to change the setting during the night if it get colder?
Also, what is the idea about the sunset trigger? If sunset is before 18:00 it will do nothing. If it's after 18:00 if will retrigger even though heating is already on. Only effect is that it will re-evaluate the outside temperature and set the heating accordingly.
I do not know how I can really implement that tough
Which bit? Starting with my questions would be a good starting point π
@slim zephyr why donβt create an automation that only turn it on and off at a certain time, and then create a second automation to increase of decrease the temperature, based on the temp sensors?
Is that better?
No and yes, but this will solve 1 problem. That it will turn off and on no matter what. In new to ha myself.
Good point
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.