I am moving my HA environment from a centralised command and control on a raspberry pi to a distributed ESPHome setup (HA on a virtual machine, with control via ESPHome on ESP8266 and ESP32 units). Part of that journey means moving functionality from within HA automations and YAML files to ESPHome configurations. One such area is the climate control I currently use…
I found this code to setup a climate control on ESPHome…
climate:
- platform: thermostat
sensor: my_temperature_sensor
default_target_temperature_high: 22 °C
cool_action:
- switch.turn_on: air_cond
idle_action:
- switch.turn_off: air_cond
Which is great, but I am stuck trying to integrate the functionality from this automation code below.
alias: Open Damper
description: Open Damper Based on Outside Temperature
trigger:
- platform: numeric_state
entity_id: sensor.esp_outside_temp
below: '21'
- platform: state
entity_id: binary_sensor.ac_status
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.ac_status
state: 'off'
action:
- service: switch.turn_on
data: {}
entity_id: switch.damperrelay
- service: mqtt.publish
data:
topic: HomeAssistant/Studio/Damper/Status
payload: '1'
mode: single
alias: Close Damper
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.esp_outside_temp
above: '21'
- platform: state
entity_id: binary_sensor.ac_status
from: 'off'
to: 'on'
condition: []
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.hvac_damper
- service: mqtt.publish
data:
topic: HomeAssistant/Studio/Damper/Status
payload: '0'
mode: single
alias: Studio Fan Status
description: ''
trigger:
- platform: state
entity_id: switch.hvac_fan
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: switch.hvac_fan
state: 'on'
sequence:
- service: mqtt.publish
data:
topic: HomeAssistant/Studio/Fan/Status
payload: '1'
- conditions:
- condition: state
entity_id: switch.hvac_fan
state: 'off'
sequence:
- service: mqtt.publish
data:
topic: HomeAssistant/Studio/Fan/Status
payload: '0'
default: []
mode: single
alias: Start Fan
description: Start Fan Climate Control Based on Temperature and Damper Status
trigger:
- platform: state
entity_id: switch.hvac_damper
from: 'off'
to: 'on'
condition: []
action:
- service: climate.turn_on
target:
entity_id: climate.studiofan
mode: single
alias: Stop Fan
description: Stop Fan Climate Control Based on Damper Status
trigger:
- platform: state
entity_id: switch.hvac_damper
from: 'on'
to: 'off'
condition: []
action:
- service: climate.turn_off
target:
entity_id: climate.studiofan
mode: single
The automations above were originally running on my raspberry pi, which also had the GPIO ports connected to a relay board. But since I now use a VM to host HA and ESP8266 and ESP32 to do the relay board things dont work so well.
In essence I want the ESPHome ESP8266 to be stand alone in the event HA stops working. So I want the ESPHome connected to the relay board to open and close the air damper and start the fan based on various checks (see automation examples above).
I am sure the solution is simple, and it’s just a learning curve for me… so if there’s any examples some of you have seen that I could use to guide me that would be great. Much appreciated.