I have a register booster fan, and I only wrote the automation to take into account turning on/off during/after heating
when the rate of change of the average temperature of the house is increasing, it turns on the fan if it has been off for five minutes, and shuts it off when the rate of change is <0 and has been on for 5 minutes.
ChatGPT helped me through this behemoth of a yaml logic statement to account for cooling also after a bit of hand holding. Not really tested yet, but I think it’s going to work.
binary_sensor:
- platform: template
name: "Temperature Comparison"
id: tempcompare
lambda: |-
return (id(average_temperature_24h).state > id(outside_temperature).state);
sensor:
- platform: homeassistant
name: "Average Temperature (24h)"
entity_id: sensor.average_temperature_24h
id: average_temperature_24h
- platform: homeassistant
name: "Weather Home"
entity_id: sensor.weather_home
id: outside_temperature
- platform: homeassistant
name: "Bedroom Temperature Derivative"
id: temperaturederivative
entity_id: sensor.average_temperature_derivative_2_min
on_value_range:
- below: 0
then:
if:
condition:
and:
- binary_sensor.is_on: tempcompare
- for:
time: 5min
condition:
switch.is_off: relay
then:
- switch.turn_on: relay
else:
if:
condition:
and:
- binary_sensor.is_off: tempcompare
- for:
time: 5min
condition:
switch.is_on: relay
then:
- switch.turn_off: relay
- above: 0
then:
if:
condition:
and:
- binary_sensor.is_on: tempcompare
- for:
time: 5min
condition:
switch.is_off: relay
then:
- switch.turn_on: relay
else:
if:
condition:
and:
- binary_sensor.is_off: tempcompare
- for:
time: 5min
condition:
switch.is_on: relay
then:
- switch.turn_off: relay
for the record my previous automation was as follows:
# - platform: homeassistant
# name: "Bedroom Temperature Derivative"
# id: temperaturederivative
# entity_id: sensor.average_temperature_derivative_2_min
# on_value_range:
# - below: 0
# then:
# if:
# condition:
# for:
# time: 5min
# condition:
# switch.is_on: relay
# then:
# - switch.turn_off: relay
# - above: 0
# then:
# if:
# condition:
# for:
# time: 5min
# condition:
# switch.is_off: relay
# then:
# - switch.turn_on: relay
made some manual changes to logic after the fact, but even just helping with the nested conditional in formatting alone was a major help.