It's that time of year when it warms up here in Sydney and I start tinkering with my home automation to make life easier and cheaper.
Background
Our house is very well insulated: the old 1920s part of the house has double brick and good insulation in the roof, the new part of the house has hempcrete walls, good roof insulation and double glazed windows. The high thermal mass means the temperature can stay very stable. Just closing the house up on hot days goes a long way to keeping it cool, but sometimes it needs a bit of help.
There's got a 6kW solar system on the roof and a Daikin wifi-connected air conditioner in the lounge room. On hot, sunny days when we're exporting lots of power to the grid and getting paid a pittance for it, I want to pre-chill the house below the usual comfort level so that when the sun goes down we keep the house closed up and turn the air con off but keep comfortable.
Home Assistant Helpers
I created two Helpers in Home Assistant, a dropdown called "Air con mode" and a numeric called "Air con target temp". The dropdown has "Manual" and "Power-driven cool" modes.
The logic I want is that when we're exporting more than 1kW of power and the air con is in "Power-driven cool" mode, drop the set temperature of the air con by 5 degrees. When we don't have excess, set it to the actual target temp. So we set the target to our comfort level, usually 24º, but when we have excess power cool it quite a bit lower.
Discussion
Adjusting the set point means we're not hard switching the air conditioner off and on, so we don't have to worry about hysteresis and the like. When someone switches the kettle or oven on, drawing lots of power, it silently switches to "keep it at the comfort temperature" and then will automatically switch back when more power is available.
By contrast, my shed/office air conditioner is a fair bit dumber so I just have it on a wifi switch to turn off and on under similar conditions, but I use a five minute average of the power and also have a condition set on the temperature so it's not flipping on/off too often.
I could probably set the excess power threshold and the amount of adjustment as Helpers too, but they're hardcoded here for now. In Winter I might do a similar automation, though there's usually a lot less excess power at that time of year.
Home Assistant Automations
The logic requires two automations that run every minute each. One for when there is excess power, one for when there isn't.
Automation for when there's excess power
alias: "Air con: Power-driven cool excess power"
description: ""
trigger:
- platform: time_pattern
minutes: "*"
condition:
- condition: state
entity_id: input_select.air_con_mode
state: Power-driven cool
- condition: numeric_state
entity_id: sensor.envoy_current_net_consumption
below: -1000
action:
- service: climate.set_temperature
data:
temperature: "{{ states('input_number.air_con_target_temp')|float - 5 }}"
target:
entity_id: climate.daikinap26021
mode: single
Automation for when there's no excess power
alias: "Air con: Power-driven cool no excess"
description: ""
trigger:
- platform: time_pattern
minutes: "*"
condition:
- condition: state
entity_id: input_select.air_con_mode
state: Power-driven cool
- condition: numeric_state
entity_id: sensor.envoy_current_net_consumption
above: -1000
action:
- service: climate.set_temperature
data:
temperature: "{{ states('input_number.air_con_target_temp')|float }}"
target:
entity_id: climate.daikinap26021
mode: single
Shed automation with a simple switch
This one uses a 5 minute average and also checks that it's uncomfortably warm before turning the air con back on. I actually leave this one running all the time: it checks that the door is closed so I'm okay using excess free electricity to keep the shed at a reasonable temperature even if I'm not in there.
alias: Shed aircon automatic on
description: ""
trigger:
- platform: time_pattern
minutes: "*"
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.shed_air_con_mode
state: "on"
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.envoy_current_net_consumption_5_minute_average_linear
below: -500
- condition: state
entity_id: binary_sensor.shed_door
state: "off"
- condition: numeric_state
entity_id: sensor.shed_weather_temperature
above: 25
- condition: state
entity_id: input_select.shed_air_con_mode
state: Excess power
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.shed_aircon
mode: single