Last active
February 5, 2023 14:42
-
-
Save Cadair/48059492bb2bd348ffd7896763ebf126 to your computer and use it in GitHub Desktop.
esphome configuration for my Open Energy Monitor thermostat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an esphome configuration file for the OpenEnergyMonitor Thermostat | |
# The primary objectives of this configuration file are: | |
# 1) The temperature used as the sensor for the thermostat should be read from | |
# homeassistant, this lets you use an average or change the room the | |
# temperature is based on depending on the time of day etc. | |
# 2) If homeassisant goes offline the thermostat keeps working. | |
# To this end there is a sensor "average_temperature" which is recieved from hass | |
# and a second sensor "combined_temperature" which decides based on if a device | |
# is connected to the native API or not to use this sensor or the local sensor | |
# attached to the thermostat. | |
# Finally, when the last device disconnects from the Native API the thermostat | |
# will be put into heat mode with a default setpoint, meaning that it will keep | |
# itself at a useful temperature even though it is disconnected from hass. | |
esphome: | |
name: thermostat | |
platform: ESP8266 | |
board: esp_wroom_02 | |
wifi: | |
networks: | |
- ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Thermostat Fallback Hotspot" | |
password: "" | |
web_server: | |
port: 80 | |
ota: false | |
captive_portal: | |
logger: | |
api: | |
ota: | |
status_led: | |
pin: GPIO16 | |
switch: | |
- platform: gpio | |
pin: GPIO5 | |
id: relay | |
name: "Thermostat Relay" | |
i2c: | |
sda: GPIO4 | |
scl: GPIO5 | |
scan: false | |
dallas: | |
- pin: GPIO2 | |
binary_sensor: | |
# If you press the button on the thermostat set it to 23C | |
- platform: gpio | |
pin: | |
number: GPIO0 | |
inverted: True | |
name: "Thermostat Button" | |
on_click: | |
- then: | |
- climate.control: | |
id: thermo | |
mode: HEAT | |
target_temperature: 23°C | |
# If the API connection to home assistant is interrupted then we revert to | |
# using the local temp sensor and we turn the heating on and default it to 20C | |
- platform: status | |
name: "Thermostat Status" | |
id: statussensor | |
on_release: | |
then: | |
- climate.control: | |
id: thermo | |
mode: HEAT | |
target_temperature: 20°C | |
sensor: | |
- platform: dallas | |
index: 0 | |
id: thermostat_temperature | |
name: "Kitchen Temperature" | |
- platform: homeassistant | |
name: "Average Temperature" | |
entity_id: sensor.average_temperature | |
internal: true | |
id: average_temperature | |
unit_of_measurement: "°C" | |
- platform: template | |
name: Combined Temperature | |
id: combined_temperature | |
lambda: |- | |
if (id(statussensor).state) { | |
return id(average_temperature).state; | |
} else { | |
return id(thermostat_temperature).state; | |
} | |
update_interval: 10s | |
unit_of_measurement: "°C" | |
climate: | |
- platform: thermostat | |
id: thermo | |
name: "Central Heating" | |
sensor: combined_temperature | |
min_idle_time: 30s | |
min_heating_off_time: 60s | |
min_heating_run_time: 60s | |
default_target_temperature_low: 20 °C | |
away_config: | |
default_target_temperature_low: 14 °C | |
heat_action: | |
- switch.turn_on: relay | |
idle_action: | |
- switch.turn_off: relay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment