I don’t like the heat. I hate being hot. Always have. I’m the guy who will leave the windows open when others have already turned on the furnace. And I used to be guy who ran the AC all the time and ran it at a very low temp. Recently though, I’ve come to realize that as long as it’s colder in here than it is out there, it’s all good. However, the delta has be more than just a few degrees. And I need the fan on.
So, with this realization, I set about configuring my Home Assistant to constantly tweak the AC so that it’s 10 degrees cooler inside than outside (if I’m home). To accomplish this, I use the temperature as reported by Weatherbit.io which I integrated via HACS’s integration. I already had my Nest integrated, and could have used its outdoor temperature sensor, but I found it slower to update than Weatherbit.
The automation is actually really simple. In fact, it’s a little too simple in that I completely forgot to account for when I’m sleeping. You see, as much as I don’t like the heat, I literally cannot sleep if I’m hot. And for whatever reason, I put off heat while I sleep, so the room has to be straight up cold for me to even have a chance of resting well. So I quickly realized that I need to check what time it is and if its late set the temp low and stop adjusting it until I get up in the morning. Which brings me to my binary sensor:
- platform: tod
name: Daytime
after: "08:00"
before: "23:00"
As you can see, I’ve defined ‘daytime’ as between 0800 and 2300.
So my automation looks like:
- alias: Adjust the AC
id: '1625265017'
description: 'Keep it 10 degrees cooler inside (but at least 72); keep it 68 at night'
trigger:
- platform: state
entity_id: sensor.weatherbit_temperature
condition:
- condition: state
entity_id: climate.living_room
state: 'cool'
action:
- service: climate.set_temperature
target:
entity_id: climate.living_room
data_template:
temperature: >-
{%- if states('binary_sensor.daytime') == 'on' -%}
{%- if states('sensor.weatherbit_temperature')|int - 10 > 71 -%}
{{ states('sensor.weatherbit_temperature')|int - 10 }}
{%- else -%}
72
{%- endif -%}
{%- else -%}
68
{%- endif -%}
mode: single
Essentially, every time the temperature (as reported by Weatherbit) changes, this automation kicks off. It checks if the Nest is set to ‘cool’ mode (which means the AC is on and also means I’m home as another automation sets the Nest to ‘off’ when I leave) and then it checks if its ‘daytime’ or not. If it is, it subtracts 10 from the reported outside temp, checks if that value is greater than 71 degrees and if so, sets the AC to that target temp. If the result is less than or equal to 72, it sets the target temp to 72. Unless it’s not ‘daytime’ in which case it sets it to 68 (my preferred sleeping temp).
It’s trivial, but it’s very powerful. And its saved me some money already, which is always nice.