From e96712174654ea7e3529adf1befad0582d48ea9c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 10 Mar 2026 09:42:33 -0500 Subject: [PATCH] adding basement and living and updating the whole ordeal --- basement.yml | 130 ++++++++++++++++++++++ kitchen.yml | 117 ------------------- living.yml | 108 ++++++++++++++++++ thermostat.yml | 297 +++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 479 insertions(+), 173 deletions(-) create mode 100644 basement.yml create mode 100644 living.yml diff --git a/basement.yml b/basement.yml new file mode 100644 index 0000000..8a26804 --- /dev/null +++ b/basement.yml @@ -0,0 +1,130 @@ +esphome: + name: basement-sensor + +esp8266: + board: nodemcuv2 + +# Enable logging +logger: + +# Enable Home Assistant API +api: + # password: "" + +ota: + - platform: esphome + password: "" + +wifi: + ssid: "Cochrun" + password: "GreasyChicken784" + manual_ip: + static_ip: 192.168.1.122 + gateway: 192.168.1.1 + subnet: 255.255.255.0 + + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Basement Fallback Hotspot" + password: "RUfAhbEfZmOU" + +captive_portal: + +web_server: + port: 80 + version: 3 + +http_request: + verify_ssl: false + +bluetooth_proxy: + +i2c: + sda: GPIO4 + scl: GPIO5 + scan: true + id: bus_a + +sensor: + - platform: aht10 + variant: AHT20 + temperature: + filters: + offset: 1.3 + name: "Basement Room Temperature" + humidity: + name: "Basement Room Humidity" + update_interval: 30s + i2c_id: bus_a + +# uart: +# tx_pin: GPIO1 +# rx_pin: GPIO3 +# baud_rate: 115200 + +# sensor: +# - platform: bme280_i2c +# temperature: +# name: "Temperature" +# id: temperature +# filters: +# offset: -4.3 +# oversampling: 16x +# pressure: +# name: "Pressure" +# id: pressure +# humidity: +# name: "Humidity" +# id: humidity +# i2c_id: bus_a +# address: 0x76 + +# dfrobot_sen0395: + +# binary_sensor: +# # Information coming from uart bus +# - platform: dfrobot_sen0395 +# name: Mmwave UART + +# # on_...: +# # - dfrobot_sen0395.settings: +# # factory_reset: true +# # detection_segments: +# # # Define between one and four segments +# # - [0cm, 3m] +# # - [5.1m, 6.6m] +# # output_latency: +# # delay_after_detect: 0s +# # delay_after_disappear: 0s +# # sensitivity: 7 + +# # Information coming from dedicated gpio (IO2) +# - platform: gpio +# name: Mmwave GPIO +# device_class: motion +# pin: +# number: GPIO16 +# mode: INPUT_PULLDOWN + +# switch: +# # Switch to turn on/off detection +# - platform: dfrobot_sen0395 +# type: sensor_active +# name: Mmwave Active + +# - platform: dfrobot_sen0395 +# type: presence_via_uart +# name: Mmwave UART active +# restore_mode: always_on + +# - platform: dfrobot_sen0395 +# type: turn_on_led +# name: Mmwave Led +# restore_mode: always_off +# icon: "mdi:led-on" + +# - platform: dfrobot_sen0395 +# type: start_after_boot +# name: Mmwave Start +# restore_mode: always_on diff --git a/kitchen.yml b/kitchen.yml index 7c45c6e..e69de29 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -1,117 +0,0 @@ -esphome: - name: kitchen-sensor - -esp8266: - board: esp01 - -# Enable logging -logger: - -# Enable Home Assistant API -api: - password: "" - -ota: - - platform: esphome - password: "" - -wifi: - ssid: "Cochrun" - password: "GreasyChicken784" - manual_ip: - static_ip: 192.168.1.125 - gateway: 192.168.1.1 - subnet: 255.255.255.0 - - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: "Kitchen Fallback Hotspot" - password: "RUfAhbEfZmOU" - -captive_portal: - -# web_server: -# port: 80 -# version: 3 - -# http_request: -# verify_ssl: false - -i2c: - sda: GPIO4 - scl: GPIO5 - scan: true - id: bus_a - -uart: - tx_pin: GPIO1 - rx_pin: GPIO3 - baud_rate: 115200 - -sensor: - - platform: bme280_i2c - temperature: - name: "Temperature" - id: temperature - filters: - offset: -1.3 - oversampling: 16x - pressure: - name: "Pressure" - id: pressure - humidity: - name: "Humidity" - id: humidity - i2c_id: bus_a - address: 0x76 - -dfrobot_sen0395: - -binary_sensor: - # Information coming from uart bus - - platform: dfrobot_sen0395 - name: Mmwave UART - - # on_...: - # - dfrobot_sen0395.settings: - # factory_reset: true - # detection_segments: - # # Define between one and four segments - # - [0cm, 3m] - # - [5.1m, 6.6m] - # output_latency: - # delay_after_detect: 0s - # delay_after_disappear: 0s - # sensitivity: 7 - - # Information coming from dedicated gpio (IO2) - - platform: gpio - name: Mmwave GPIO - device_class: motion - pin: - number: GPIO16 - mode: INPUT_PULLDOWN - -switch: - # Switch to turn on/off detection - - platform: dfrobot_sen0395 - type: sensor_active - name: Mmwave Active - - - platform: dfrobot_sen0395 - type: presence_via_uart - name: Mmwave UART active - restore_mode: always_on - - - platform: dfrobot_sen0395 - type: turn_on_led - name: Mmwave Led - restore_mode: always_off - icon: "mdi:led-on" - - - platform: dfrobot_sen0395 - type: start_after_boot - name: Mmwave Start - restore_mode: always_on - diff --git a/living.yml b/living.yml new file mode 100644 index 0000000..0b16f88 --- /dev/null +++ b/living.yml @@ -0,0 +1,108 @@ +esphome: + name: living-room-sensor + +esp32: + board: nodemcu-32s + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + # password: "" + +ota: + - platform: esphome + password: "" + +wifi: + ssid: "Cochrun" + password: "GreasyChicken784" + manual_ip: + static_ip: 192.168.1.121 + gateway: 192.168.1.1 + subnet: 255.255.255.0 + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Living Room Fallback Hotspot" + password: "RUfAhbEfZmOU" + +captive_portal: + +web_server: + port: 80 + version: 3 + +http_request: + verify_ssl: false + +bluetooth_proxy: + +#################### +# TEMP +#################### +i2c: + sda: GPIO32 + scl: GPIO33 + scan: true + id: bus_a + +# sensor: +# - platform: bme280_i2c +# temperature: +# name: "Temperature" +# id: temperature +# filters: +# offset: -3.3 +# pressure: +# name: "Pressure" +# id: pressure +# humidity: +# name: "Humidity" +# id: humidity +# i2c_id: bus_a +# address: 0x76 + +sensor: + - platform: aht10 + variant: AHT20 + temperature: + filters: + offset: 0.7 + name: "Living Room Temperature" + humidity: + name: "Living Room Humidity" + update_interval: 30s + i2c_id: bus_a + +#################### +# PRESENCE +#################### +# uart: +# tx_pin: GPIO27 +# rx_pin: GPIO26 +# baud_rate: 115200 + +# dfrobot_sen0395: + +# binary_sensor: +# # Information coming from uart bus +# - platform: dfrobot_sen0395 +# name: Mmwave UART + +# # Information coming from dedicated gpio (IO2) +# - platform: gpio +# name: Mmwave GPIO +# device_class: motion +# pin: +# number: GPIO25 +# mode: INPUT_PULLDOWN + +# switch: +# # Switch to turn on/off detection +# - platform: dfrobot_sen0395 +# type: sensor_active +# name: Mmwave Active diff --git a/thermostat.yml b/thermostat.yml index 8f29498..1838770 100644 --- a/thermostat.yml +++ b/thermostat.yml @@ -50,7 +50,8 @@ ch422g: # Enable Home Assistant API api: reboot_timeout: 30min - password: "" + batch_delay: 300ms + # password: "" ota: - platform: esphome @@ -60,7 +61,7 @@ wifi: ssid: "Cochrun" password: "GreasyChicken784" power_save_mode: none - reboot_timeout: 10s + reboot_timeout: 20s manual_ip: static_ip: 192.168.1.123 gateway: 192.168.1.1 @@ -81,6 +82,8 @@ web_server: http_request: +bluetooth_proxy: + i2c: - id: bus_a sda: GPIO08 @@ -88,6 +91,12 @@ i2c: scan: True frequency: 400kHz +button: + - platform: restart + name: "Restart Device" + - platform: safe_mode + name: "Restart in Safe Mode" + time: - platform: homeassistant id: hass_time @@ -99,6 +108,18 @@ time: text: !lambda |- auto time = id(hass_time).now(); return time.strftime("%a %b %e, %I:%M %p"); + - minutes: /2 # Update every second + then: + - lambda: |- + auto therm = id(climape); + if (therm->mode == CLIMATE_MODE_HEAT && therm->action != CLIMATE_ACTION_HEATING) { + therm->refresh(); + }; + if (therm->mode == CLIMATE_MODE_COOL && therm->action != CLIMATE_ACTION_COOLING) { + therm->refresh(); + }; + - script.execute: + id: refresh_hvac_state - hours: 1,2,3,4 minutes: 5 seconds: 0 @@ -110,24 +131,50 @@ time: then: - switch.turn_off: switch_antiburn # - script.execute: update_date_time_label + +script: + - id: refresh_hvac_state + then: + # - http_request.get: + # url: http://192.168.1.124/switch/heat + # capture_response: true + # request_headers: + # Content-Type: application/json + # on_response: + # then: + # - lambda: |- + # json::parse_json(body, [](JsonObject root) -> bool { + # if (root["value"]) { + # ESP_LOGD("main", "Heat is: %d", root["value"]); + # return root["value"]; + # } else { + # ESP_LOGD("main", "Heat problem"); + # return false; + # } + # }); + + sensor: - platform: bme280_i2c + update_interval: 20s + # iir_filter: 16x temperature: name: "Temperature" id: temperature filters: - - offset: 1.0 - on_value: - then: - - lvgl.label.update: - id: temp_label - text: !lambda |- - auto temp = x * (9.0/5.0) + 32.0; - return str_truncate(to_string(temp), 4); - - lvgl.indicator.update: - id: current_temp_needle - value: !lambda |- - return x * 10.0; + - offset: !lambda return id(temp_offset).state; + # on_value: + # then: + # - lvgl.label.update: + # id: temp_label + # text: !lambda |- + # auto temp = x * (9.0/5.0) + 32.0; + # return str_truncate(to_string(temp), 4); + # - lvgl.indicator.update: + # id: current_temp_needle + # value: !lambda |- + # return x * 10.0; + humidity: name: "Humidity" id: humidity @@ -146,6 +193,9 @@ sensor: id: pressure address: 0x76 + - platform: internal_temperature + name: "Chip Temperature" + - platform: template name: "Altitude" lambda: |- @@ -170,6 +220,50 @@ sensor: unit_of_measurement: °C icon: 'mdi:thermometer-alert' + - platform: homeassistant + id: living_room_temp + entity_id: sensor.living_room_sensor_living_room_temperature + # filters: + # - lambda: return (x - 32.0) * (5.0/9.0); + + - platform: homeassistant + id: bedroom_temp + entity_id: sensor.bedroom_temperature_offset + # filters: + # - lambda: return (x - 32.0) * (5.0/9.0); + + - platform: homeassistant + id: basement_temp + entity_id: sensor.basement_sensor_basement_room_temperature + # filters: + # - lambda: return (x - 32.0) * (5.0/9.0); + + - platform: homeassistant + id: house_temp + entity_id: sensor.house_temperature + filters: + - lambda: return (x - 32.0) * (5.0/9.0); + + - platform: template + id: used_temp + lambda: |- + if (id(house_temp).has_state()) { + return id(house_temp).state; + } else { + return id(temperature).state; + }; + on_value: + then: + - lvgl.label.update: + id: temp_label + text: !lambda |- + auto temp = x * (9.0/5.0) + 32.1; + return str_truncate(to_string(temp), 4); + - lvgl.indicator.update: + id: current_temp_needle + value: !lambda |- + return x * 10.0; + mapping: - id: weather_mapping from: string @@ -179,6 +273,10 @@ mapping: light-rain: "󰖗" medium-rain: "󰖗" heavy-rain: "󰖗" + "Mostly Cloudy": "󰖐" + "Breezy": "" + "Sunny": "󰖙" + text_sensor: - platform: homeassistant id: weather @@ -245,6 +343,65 @@ switch: - platform: homeassistant id: fan entity_id: switch.hvac_fan + + # These are for controling the hvac from the thermostat directly w/o + # needing to have home assistant running or the server running + - platform: template + name: hvac_heat_state + id: switch_heat_state + internal: true + optimistic: true + on_turn_on: + - http_request.post: + url: http://192.168.1.124/switch/heat/turn_on + on_turn_off: + - http_request.post: + url: http://192.168.1.124/switch/heat/turn_off + - platform: template + name: hvac_ac_state + id: switch_ac_state + internal: true + optimistic: true + on_turn_on: + - http_request.post: + url: http://192.168.1.124/switch/ac/turn_on + on_turn_off: + - http_request.post: + url: http://192.168.1.124/switch/ac/turn_off + - platform: template + name: hvac_fan_state + id: switch_fan_state + internal: true + optimistic: true + on_turn_on: + - http_request.post: + url: http://192.168.1.124/switch/fan/turn_on + on_turn_off: + - http_request.post: + url: http://192.168.1.124/switch/fan/turn_off + + ## This will turn all of the hvac off with one switch + - platform: template + name: HVAC Master Control + id: switch_master + optimistic: true + on_turn_on: + - climate.control: + id: climape + preset: Home + mode: HEAT_COOL + on_turn_off: + - http_request.post: + url: http://192.168.1.124/switch/heat/turn_off + - http_request.post: + url: http://192.168.1.124/switch/ac/turn_off + - http_request.post: + url: http://192.168.1.124/switch/fan/turn_off + - climate.control: + id: climape + preset: Away + mode: "OFF" + - platform: template name: Antiburn id: switch_antiburn @@ -283,19 +440,20 @@ climate: - platform: thermostat id: climape name: "Thermostat" - sensor: temperature + sensor: used_temp humidity_sensor: humidity - min_cooling_off_time: 120s - min_cooling_run_time: 120s - min_heating_off_time: 120s - min_heating_run_time: 120s - min_fanning_off_time: 120s - min_fanning_run_time: 120s - min_idle_time: 300s - cool_deadband: 0.2 °F - cool_overrun: 0.5 °F - heat_deadband: 0.2 °F - heat_overrun: 0.5 °F + startup_delay: true + min_cooling_off_time: 60s + min_cooling_run_time: 60s + min_heating_off_time: 60s + min_heating_run_time: 60s + min_fanning_off_time: 60s + min_fanning_run_time: 60s + min_idle_time: 60s + cool_deadband: 0.1 °F + cool_overrun: 0.9 °F + heat_deadband: 0.1 °F + heat_overrun: 0.9 °F visual: temperature_step: target_temperature: 0.5 °F @@ -332,18 +490,23 @@ climate: default_preset: Home preset: - name: Home - default_target_temperature_low: 67 °F - default_target_temperature_high: 79 °F + mode: heat_cool + default_target_temperature_low: 68 °F + default_target_temperature_high: 77 °F - name: Summer + mode: cool default_target_temperature_low: 60 °F default_target_temperature_high: 77 °F - name: Winter + mode: heat default_target_temperature_low: 68 °F default_target_temperature_high: 85 °F - name: Night Winter + mode: heat default_target_temperature_low: 64 °F default_target_temperature_high: 85 °F - name: Away + mode: heat_cool default_target_temperature_low: 60 °F default_target_temperature_high: 85 °F on_state: @@ -354,10 +517,19 @@ climate: return x.target_temperature_high * 10.0; end_value: !lambda |- return x.target_temperature_low * 10.0; - - lvgl.arc.update: - id: hvac_temp_knob - value: !lambda |- - return x.target_temperature_high * 10.0; + - if: + condition: + lambda: "return id(climape).mode == CLIMATE_MODE_HEAT;" + then: + - lvgl.arc.update: + id: hvac_temp_knob + value: !lambda |- + return x.target_temperature_low * 10.0; + else: + - lvgl.arc.update: + id: hvac_temp_knob + value: !lambda |- + return x.target_temperature_high * 10.0; - if: condition: lambda: "return x.mode != CLIMATE_MODE_OFF;" @@ -588,7 +760,7 @@ font: type: gfonts family: Quicksand weight: 400 - id: body + id: body_font size: 18 - file: type: gfonts @@ -711,6 +883,18 @@ number: max_value: 180 step: 5 mode: box + - platform: template + name: Temperature Offset + optimistic: true + icon: "mdi:thermometer-chevron-down" + id: temp_offset + unit_of_measurement: "°F" + initial_value: -3.1 + restore_value: true + min_value: -7.0 + max_value: 7.0 + step: 0.1 + mode: box lvgl: # buffer_size: 25% @@ -939,7 +1123,7 @@ lvgl: bg_opa: TRANSP border_width: 0 scales: - range_from: 160 # 16°C + range_from: 80 # 16°C range_to: 340 # 34°C # Set temperature ticks background ticks: @@ -948,21 +1132,21 @@ lvgl: width: 2 color: ${color_white} indicators: + # Set temperature ticks + - tick_style: + id: hvac_temp_ticks + start_value: 80 + end_value: 340 # 24°C Should be the same as the set temperature label + color_start: ${color_green} + color_end: ${color_green} + width: 2 # Curremt temperature needle - line: id: current_temp_needle color: ${color_red} - width: 3 - r_mod: 10 + width: 8 + r_mod: 35 value: 340 # 34°C Should be the same as the current temperature label - # Set temperature ticks - - tick_style: - id: hvac_temp_ticks - start_value: 160 - end_value: 240 # 24°C Should be the same as the set temperature label - color_start: ${color_green} - color_end: ${color_green} - width: 2 # Meter inner Ring only for visual effect - obj: id: meter_ring_inner @@ -982,7 +1166,7 @@ lvgl: arc_opa: TRANSP adjustable: true value: 240 # 24°C (24x10) Should be the same as the set temperature needle - min_value: 160 + min_value: 80 max_value: 340 width: 335 height: 335 @@ -1156,13 +1340,14 @@ lvgl: text_font: h3 text: "" text_color: ${color_white} - pad_top: 50 + pad_top: 20 align: LEFT_MID long_mode: WRAP - label: id: out_weather_sum_label text_font: h4 text: "" + width: 150 text_color: ${color_white} align: LEFT_MID long_mode: WRAP @@ -1187,26 +1372,26 @@ lvgl: - label: - id: set_temp_label + id: action_label text_font: h2 text: "Loading..." align: center - y: -90 - text_color: 0xA5A5A9 - - label: - id: action_label - text_font: h4 - text: "Loading..." - align: center # x: 145 - y: 70 + y: -90 text_color: 0xA5A5A9 - label: id: temp_label text_font: h1 - text: "Loading..." + text: "00" align: center y: -10 text_color: 0xE2E4E5 + - label: + id: set_temp_label + text_font: h2 + text: "00" + align: center + y: 70 + text_color: 0xA5A5A9