From bb0371b5e83948a0976d72fd0e2ff5d6ec58174c Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Mon, 23 Oct 2023 13:57:40 +0200 Subject: [PATCH] Migrate boiler.yaml -> heating.yaml - add heating controller (on/off/auto) - add heating status --- boiler.yaml | 65 ------------------------- heating.yaml | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 65 deletions(-) delete mode 100644 boiler.yaml create mode 100644 heating.yaml diff --git a/boiler.yaml b/boiler.yaml deleted file mode 100644 index 793536d..0000000 --- a/boiler.yaml +++ /dev/null @@ -1,65 +0,0 @@ -esphome: - name: boiler - friendly_name: "Boiler" - - project: - name: dasfoo.boiler - version: "1.0" - -packages: - device_base: !include templates/esp8266.yaml - -i2c: - # The default is GPIO4 (D2), but the way display is connected - # right now (plugged into breadboard), we can only use these pins. - sda: D3 - # The default is GPIO5 (D1). - # As a side effect, D4 LED (antenna) will be blinking. - scl: D4 - -font: -- file: "fonts/DejaVuSans.ttf" - id: font_sans - size: 20 - -display: -- platform: ssd1306_i2c - model: "SSD1306 128x32" - id: oled_display - lambda: |- - it.printf( - 4, 6, - id(font_sans), - "%.2f C", - id(boiler_temperature).state); - - if (id(furnace_burning).state) { - it.filled_circle(112, 16, 12); - } else { - it.circle(112, 16, 12); - } - -dallas: -- pin: D5 - -sensor: -- platform: dallas - address: 0x133c2cf648f40728 - id: boiler_temperature - name: "Boiler Temperature" - filters: - - offset: 0.5 - -- platform: adc - pin: A0 - update_interval: 1s - id: furnace_led_brightness - -binary_sensor: -- platform: analog_threshold - id: furnace_burning - name: "Furnace Burning" - sensor_id: furnace_led_brightness - threshold: 0.7 - filters: - - invert: diff --git a/heating.yaml b/heating.yaml new file mode 100644 index 0000000..eb2cd96 --- /dev/null +++ b/heating.yaml @@ -0,0 +1,133 @@ +esphome: + name: heating + friendly_name: "Heating" + + project: + name: dasfoo.heating + version: "2.0" + + on_boot: + then: + - if: + condition: + switch.is_off: relay_temperature_manual + then: + - select.set: + id: floor_heating_mode + option: "auto" + else: + - if: + condition: + switch.is_on: relay_temperature_warm + then: + - select.set: + id: floor_heating_mode + option: "off" + else: + - select.set: + id: floor_heating_mode + option: "on" + +packages: + device_base: !include templates/esp32.yaml + +i2c: + sda: GPIO21 + # Marked as SCK on the display itself for some reason, + # thus the GPIO choice. + scl: GPIO18 + +font: +- file: "fonts/DejaVuSans.ttf" + id: font_sans + size: 20 + +display: +- platform: ssd1306_i2c + model: "SSD1306 128x32" + id: oled_display + lambda: |- + it.printf( + 4, 6, + id(font_sans), + "%.2f C", + id(boiler_temperature).state); + + if (id(furnace_burning).state) { + it.filled_circle(112, 16, 12); + } else { + it.circle(112, 16, 12); + } + +dallas: +- pin: GPIO27 + +sensor: +- platform: dallas + address: 0x133c2cf648f40728 + id: boiler_temperature + name: "Boiler temperature" + filters: + - offset: 0.5 + +- platform: adc + pin: GPIO32 + update_interval: 1s + id: furnace_led_brightness + +- platform: adc + pin: GPIO33 + update_interval: 1s + id: heating_led_brightness + +binary_sensor: +- platform: analog_threshold + id: furnace_burning + name: "Furnace burning" + sensor_id: furnace_led_brightness + threshold: 0.7 + filters: + - invert: + +- platform: analog_threshold + id: heating_enabled + name: "Floor heating active" + sensor_id: heating_led_brightness + threshold: 0.7 + filters: + - invert: + +switch: +- platform: gpio + pin: GPIO25 + id: relay_temperature_manual + inverted: true + restore_mode: RESTORE_DEFAULT_OFF + +- platform: gpio + pin: GPIO26 + id: relay_temperature_warm + inverted: true + restore_mode: RESTORE_DEFAULT_OFF + +select: +- platform: template + name: "Floor heating mode" + id: floor_heating_mode + options: + - "on" + - "off" + - "auto" + optimistic: true + set_action: + lambda: |- + if (x == "auto") { + id(relay_temperature_manual).turn_off(); + } else { + if (x == "off") { + id(relay_temperature_warm).turn_on(); + } else { + id(relay_temperature_warm).turn_off(); + } + id(relay_temperature_manual).turn_on(); + }