-
-
Save waako/cbe87d4d4e77e38a7eda0af5772cac6b 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: wifi-thermostat-mqtt | |
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 20C | |
- platform: gpio | |
pin: | |
number: GPIO0 | |
inverted: True | |
name: "Thermostat Button" | |
on_click: | |
- then: | |
- climate.control: | |
id: thermo | |
mode: HEAT | |
target_temperature: 20°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 18C | |
- platform: status | |
name: "Thermostat Status" | |
id: statussensor | |
on_release: | |
then: | |
- climate.control: | |
id: thermo | |
mode: HEAT | |
target_temperature: 18°C | |
sensor: | |
- platform: dallas | |
index: 0 | |
id: thermostat_temperature | |
name: "Downstairs Temperature" | |
- platform: homeassistant | |
name: "Average Temperature" | |
entity_id: sensor.median_temp | |
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: 360s | |
min_heating_run_time: 360s | |
heat_deadband: 0.2 | |
heat_overrun: 0.3 | |
heat_action: | |
- switch.turn_on: relay | |
idle_action: | |
- switch.turn_off: relay | |
preset: | |
- name: home | |
default_target_temperature_low: 17.0 °C | |
- name: comfort | |
default_target_temperature_low: 18.0 °C | |
- name: away | |
default_target_temperature_low: 16.0 °C | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment