Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #substitutions is a list of variables basically. here you can easily change the high/low limits and setpoints
- substitutions:
- temperature_setpoint: '25.5'
- temperature_alarm_low: '23.3'
- temperature_alarm_high: '27.5'
- temperature_hysteresis: '0.3'
- esphome:
- name: thermostat
- platform: ESP8266
- board: nodemcuv2
- esp8266_restore_from_flash: True
- on_boot:
- priority: -10
- # ...
- then:
- #on boot we turn the thermostat on ("HEAT" mode in my case) and set the desired setpoint
- - climate.control:
- id: temp_control
- mode: HEAT
- target_temperature: ${temperature_setpoint}
- #This script begins the monitor that makes sure we receive a new temperature measurement at least every 2 minutes
- #If this script isn't called every 2 minutes it will start the high temperature alarm
- #Everytime we call the script the timer resets. I call this the temperature "heartbeat"
- - script.execute: temperature_heartbeat
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- ap:
- ssid: thermostat
- password: !secret ap_password
- web_server:
- port: 80
- logger:
- api:
- ota:
- captive_portal:
- sensor:
- - platform: dht
- pin: D5
- temperature:
- name: "Test Room Temperature"
- id: temp_1
- humidity:
- name: "Test Room Humidity"
- update_interval: 60s
- switch:
- - platform: gpio
- pin: D8
- id: Relay
- name: "Heating Element Relay"
- - platform: template
- name: "Target Up"
- turn_on_action:
- id: temp_control
- target_temperature: !lambda 'return id(temp_control).target_temperature + 1;'
- turn_off_action:
- climate:
- - platform: thermostat
- name: "thermostat_test"
- id: temp_control
- #Note that here the same temperature sensor that has all of the alarms configured is used to control the thermostat
- sensor: temp_1
- default_target_temperature_low: ${temperature_setpoint}
- hysteresis: ${temperature_hysteresis}
- heat_action:
- - switch.turn_on: Relay
- idle_action:
- - switch.turn_off: Relay
- script:
- - id: temperature_heartbeat
- mode: restart
- then:
- - delay: 2 min
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement