From 75fb9c2ab8beb8b32a2ea8ed03407db2fb07bf88 Mon Sep 17 00:00:00 2001 From: CeeWeasel Date: Sun, 20 Jul 2025 12:33:08 -0400 Subject: [PATCH] updating common esphome sensors finally fixing hvac-multisensor. All of this was caused by the display switch referenced the display while it wasn't plugged in. Updated code to check for the existence first. --- esphome/archive/front-yard-plant-monitor.yaml | 39 --- .../furnace-room-multisensor-back.yaml | 220 ++++++++++++++++ esphome/archive/furnace-room-multisensor.yaml | 120 +++++---- esphome/archive/hvac-multisensor-425f4f.yaml | 212 ++++++++++++++++ esphome/archive/hvac-multisensor.yaml | 222 ++++++++++++++++ .../archive/new-furnace-room-multisensor.yaml | 229 +++++++++++++++++ esphome/bed-presence/base.yaml | 80 ------ esphome/bed-presence/bluetooth-proxy.yaml | 15 -- esphome/bed-presence/diagnostics.yaml | 59 ----- esphome/bed-presence/sensor.yaml | 240 ------------------ .../binary_sensor/status_sensor.config.yaml | 3 +- esphome/common/ble_tracker.yaml | 9 +- .../common/button/restart_button.config.yaml | 3 +- esphome/common/device_base.yaml | 4 +- esphome/common/ethernet.yaml | 7 +- esphome/common/hx711_single_verbose.yaml | 20 +- esphome/common/sensor-test.yaml | 9 - esphome/common/sensor/rssi_sensor.config.yaml | 3 +- .../common/sensor/uptime_sensor.config.yaml | 3 +- .../ethernet_ip_address.config.yaml | 3 +- .../ethernet_mac_address.config.yaml | 3 +- .../text_sensor/version_sensor.config.yaml | 9 +- .../text_sensor/wifi_sensor.config.yaml | 12 +- esphome/common/touch_sensor_bed_single.yaml | 13 - esphome/common/wifi.yaml | 3 +- esphome/common/wifi_dhcp.yaml | 3 +- esphome/common/wifi_no_power_save.yaml | 8 +- esphome/hvac-multisensor-425f4f.yaml | 233 +++++++++++++++++ esphome/nursery-tagreader.yaml | 34 +-- lovelace/cameras/view-camera-mbr.yaml | 92 +++++++ lovelace/phone/master-bedroom.yaml | 5 +- 31 files changed, 1315 insertions(+), 600 deletions(-) create mode 100644 esphome/archive/furnace-room-multisensor-back.yaml create mode 100644 esphome/archive/hvac-multisensor-425f4f.yaml create mode 100644 esphome/archive/hvac-multisensor.yaml create mode 100644 esphome/archive/new-furnace-room-multisensor.yaml delete mode 100644 esphome/bed-presence/base.yaml delete mode 100644 esphome/bed-presence/bluetooth-proxy.yaml delete mode 100644 esphome/bed-presence/diagnostics.yaml delete mode 100644 esphome/bed-presence/sensor.yaml delete mode 100644 esphome/common/sensor-test.yaml delete mode 100644 esphome/common/touch_sensor_bed_single.yaml create mode 100644 esphome/hvac-multisensor-425f4f.yaml create mode 100644 lovelace/cameras/view-camera-mbr.yaml diff --git a/esphome/archive/front-yard-plant-monitor.yaml b/esphome/archive/front-yard-plant-monitor.yaml index 343b414..d8673eb 100644 --- a/esphome/archive/front-yard-plant-monitor.yaml +++ b/esphome/archive/front-yard-plant-monitor.yaml @@ -38,45 +38,6 @@ logger: #C4:7C:8D:6D:3E:AE sensor: - # - platform: xiaomi_hhccjcy01 - # mac_address: 'C4:7C:8D:6D:CE:A4' - # temperature: - # name: 'Plant Sensor 1: Temperature' - # moisture: - # name: 'Plant Sensor 1: Moisture' - # illuminance: - # name: 'Plant Sensor 1: Illuminance' - # conductivity: - # name: 'Plant Sensor 1: Soil Conductivity' - # battery_level: - # name: 'Plant Sensor 1: Battery Level' - - # - platform: xiaomi_hhccjcy01 - # mac_address: 'C4:7C:8D:6D:3E:AE' - # temperature: - # name: 'Plant Sensor 2: Temperature' - # moisture: - # name: 'Plant Sensor 2: Moisture' - # illuminance: - # name: 'Plant Sensor 2: Illuminance' - # conductivity: - # name: 'Plant Sensor 2: Soil Conductivity' - # battery_level: - # name: 'Plant Sensor 2: Battery Level' - - # - platform: xiaomi_hhccjcy01 - # mac_address: 'C4:7C:8D:6D:3E:B0' - # temperature: - # name: 'Plant Sensor 3: Temperature' - # moisture: - # name: 'Plant Sensor 3: Moisture' - # illuminance: - # name: 'Plant Sensor 3: Illuminance' - # conductivity: - # name: 'Plant Sensor 3: Soil Conductivity' - # battery_level: - # name: 'Plant Sensor 3: Battery Level' - - platform: ultrasonic trigger_pin: GPIO13 echo_pin: GPIO14 diff --git a/esphome/archive/furnace-room-multisensor-back.yaml b/esphome/archive/furnace-room-multisensor-back.yaml new file mode 100644 index 0000000..8568bb5 --- /dev/null +++ b/esphome/archive/furnace-room-multisensor-back.yaml @@ -0,0 +1,220 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v +substitutions: + devicename: furnace-room-multisensor + entity_name: furnace_room_multisensor + friendly_name: Furnace Room MultiSensor + comment: Clever MultiSensor + platform: ESP32 + board: wemos_d1_mini32 + static_ip: !secret furnace-room-multisensor-ip + + one_wire_pin: GPIO14 + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO34 + trigger_pin: GPIO33 + echo_pin: GPIO35 + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + +packages: + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml + device_base: !include common/device_base.yaml + ble_proxy: !include common/ble_proxy.yaml + +esphome: + name: ${devicename} + friendly_name: ${friendly_name} + +esp32: + board: ${board} + framework: + type: esp-idf + +# Enable logging +logger: + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +esp32_ble_tracker: + +globals: + - id: screen_power + type: bool + restore_value: yes + initial_value: 'true' + +font: + - file: 'CascadiaMonoPL.ttf' + id: font1 + size: 17 + +one_wire: + - platform: gpio + pin: ${one_wire_pin} + +i2c: + sda: ${sda_pin} + scl: ${scl_pin} + frequency: 800kHz + +display: + - platform: ssd1306_i2c + id: oled + model: "SSD1306 128x64" + #reset_pin: GPIO14 #D0 + address: 0x3C + lambda: |- + it.print(0, 0, id(font1), "Delt:"); + it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); + it.print(0, 16, id(font1), "HVAC:"); + it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac).state); + it.print(0, 32, id(font1), "Retn:"); + it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); + it.print(0, 48, id(font1), "Ambt:"); + it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); + +sensor: + - platform: dallas_temp + address: 0xB33C01B607798528 + name: "Return Temperature" + id: hvac_return + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0x0F3C01B6070C1328 + name: "Supply Temperature" + id: hvac_supply + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0xFA3C01B607005B28 + name: "Ambient Temperature" + id: ambient + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: template + name: "Delta Temperature" + id: hvac_delta + lambda: |- + return (id(hvac_supply).state - id(hvac_return).state); + update_interval: 10s + unit_of_measurement: "°F" + state_class: measurement + filters: + - or: + - throttle: 60s + - delta: 1.0 + + - platform: ultrasonic + trigger_pin: ${trigger_pin} + echo_pin: ${echo_pin} + id: ultrasonic_source + #update_interval: 5s + internal: True + filters: + - sliding_window_moving_average: + window_size: 5 + send_every: 5 + send_first_at: 1 + on_value: + then: + - sensor.template.publish: + id: distance_from_bottom + state: !lambda 'return id(ultrasonic_source).state;' + + - sensor.template.publish: + id: distance_from_top + state: !lambda 'return id(ultrasonic_source).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_bottom + name: "Salt Level in CM" + #update_interval: 5s + filters: + - lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;' + on_value: + then: + - sensor.template.publish: + id: level_in_bags + state: !lambda 'return id(distance_from_bottom).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_top + name: "Salt Level From Top in CM" + #update_interval: 5s + filters: + - lambda: 'return (id(ultrasonic_source).state) * 100;' + + - platform: template + unit_of_measurement: "bags" + state_class: measurement + id: level_in_bags + name: "Salt Level in Bags" + #update_interval: 5s + filters: + - lambda: 'return (id(distance_from_bottom).state) / 17.5;' + +binary_sensor: + - platform: gpio + name: "Door" + device_class: door + pin: + number: ${door_pin} + mode: INPUT_PULLUP + + - platform: homeassistant + internal: true + id: light_state + entity_id: light.furnace_room + on_state: + then: + - if: + condition: + lambda: 'return id(light_state).state;' + then: + - logger.log: "The light is on" + else: + - logger.log: "The is off. Turning off display" + - switch.turn_off: display_switch + +switch: + - platform: template + id: display_switch + name: "Display" + lambda: |- + if (id(screen_power)) { + id(oled).turn_on(); + } else { + id(oled).turn_off(); + } + return id(screen_power); + turn_on_action: + - lambda: |- + id(screen_power) = true; + // id(oled).turn_on(); + turn_off_action: + - lambda: |- + id(screen_power) = false; + // id(oled).turn_off(); diff --git a/esphome/archive/furnace-room-multisensor.yaml b/esphome/archive/furnace-room-multisensor.yaml index 555cfef..2914e9d 100644 --- a/esphome/archive/furnace-room-multisensor.yaml +++ b/esphome/archive/furnace-room-multisensor.yaml @@ -1,25 +1,49 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v substitutions: devicename: furnace-room-multisensor entity_name: furnace_room_multisensor friendly_name: Furnace Room MultiSensor + comment: Clever MultiSensor platform: ESP32 - board: nodemcu-32s + board: wemos_d1_mini32 static_ip: !secret furnace-room-multisensor-ip + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO19 + + + one_wire_pin: GPIO14 + trigger_pin: GPIO04 + echo_pin: GPIO12 + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + packages: - #wifi: !include common/wifi.yaml - ethernet: !include common/olimex-evb.yaml + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml device_base: !include common/device_base.yaml ble_proxy: !include common/ble_proxy.yaml -esp32: - board: esp32-poe-iso +esphome: + name: ${devicename} + friendly_name: ${friendly_name} +esp32: + board: ${board} + framework: + type: esp-idf + +# Enable logging logger: - level: DEBUG - logs: - dallas.sensor: NONE - sensor: NONE + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +esp32_ble_tracker: globals: - id: screen_power @@ -32,14 +56,13 @@ font: id: font1 size: 17 -dallas_temp: - - pin: - number: GPIO5 #D4 - update_interval: 10s +one_wire: + - platform: gpio + pin: ${one_wire_pin} i2c: - sda: GPIO13 #D1 - scl: GPIO15 #D2 + sda: ${sda_pin} + scl: ${scl_pin} frequency: 800kHz display: @@ -49,48 +72,51 @@ display: #reset_pin: GPIO14 #D0 address: 0x3C lambda: |- - it.print(0, 0, id(font1), "Delt:"); + it.print(0, 0, id(font1), "Delta:"); it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); - it.print(0, 16, id(font1), "HVAC:"); - it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac).state); - it.print(0, 32, id(font1), "Retn:"); + it.print(0, 16, id(font1), "Supply:"); + it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_supply).state); + it.print(0, 32, id(font1), "Return:"); it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); - it.print(0, 48, id(font1), "Ambt:"); + it.print(0, 48, id(font1), "Ambient:"); it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); sensor: - - platform: dallas + - platform: dallas_temp address: 0xB33C01B607798528 name: "Return Temperature" id: hvac_return + update_interval: 10s filters: - lambda: return x * (9.0/5.0) + 32.0; unit_of_measurement: "°F" state_class: measurement - - platform: dallas + - platform: dallas_temp address: 0x0F3C01B6070C1328 - name: "HVAC Temperature" - id: hvac + name: "Supply Temperature" + id: hvac_supply + update_interval: 10s filters: - lambda: return x * (9.0/5.0) + 32.0; unit_of_measurement: "°F" state_class: measurement - - platform: dallas + - platform: dallas_temp address: 0xFA3C01B607005B28 - name: "Furnace Room Temperature" + name: "Ambient Temperature" id: ambient + update_interval: 10s filters: - lambda: return x * (9.0/5.0) + 32.0; unit_of_measurement: "°F" state_class: measurement - platform: template - name: "HVAC Delta" + name: "Delta Temperature" id: hvac_delta lambda: |- - return (id(hvac).state - id(hvac_return).state); + return (id(hvac_supply).state - id(hvac_return).state); update_interval: 10s unit_of_measurement: "°F" state_class: measurement @@ -99,37 +125,9 @@ sensor: - throttle: 60s - delta: 1.0 - # - platform: ultrasonic - # trigger_pin: GPIO1 #D7 - # echo_pin: GPIO5 #D8 - # name: "Salt Level in percent" - # update_interval: 1s - # #update_interval: 10s - # filters: - # - lambda: return (0.86-x)*(100/0.86); - # unit_of_measurement: "%" - - # - platform: ultrasonic - # trigger_pin: GPIO33 #D7 - # echo_pin: GPIO35 #D8 - # unit_of_measurement: "cm" - # id: distance_from_bottom - # name: "Salt Level in CM" - # # pulse_time: 10us - # #update_interval: 3h - # #update_interval: 5s - # #timeout: 4.0m - # update_interval: 5s - # filters: - # - lambda: return ( 0.86 - x * 100; - # - sliding_window_moving_average: - # window_size: 5 - # send_every: 5 - # send_first_at: 1 - - platform: ultrasonic - trigger_pin: GPIO33 #D7 - echo_pin: GPIO35 #D8 + trigger_pin: ${trigger_pin} + echo_pin: ${echo_pin} id: ultrasonic_source #update_interval: 5s internal: True @@ -182,10 +180,10 @@ sensor: binary_sensor: - platform: gpio - name: "Furnace Room Door" + name: "Door" device_class: door pin: - number: GPIO3 #D5 + number: ${door_pin} mode: INPUT_PULLUP - platform: homeassistant @@ -206,7 +204,7 @@ binary_sensor: switch: - platform: template id: display_switch - name: "HVAC Display Switch" + name: "Display" lambda: |- if (id(screen_power)) { id(oled).turn_on(); diff --git a/esphome/archive/hvac-multisensor-425f4f.yaml b/esphome/archive/hvac-multisensor-425f4f.yaml new file mode 100644 index 0000000..1f09a31 --- /dev/null +++ b/esphome/archive/hvac-multisensor-425f4f.yaml @@ -0,0 +1,212 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v +substitutions: + devicename: hvac-multisensor-425f4f + entity_name: hvac_multisensor + friendly_name: HVAC MultiSensor + comment: Clever MultiSensor + platform: ESP32 + board: wemos_d1_mini32 + static_ip: !secret hvac-multisensor-ip + + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO19 + one_wire_pin: GPIO14 + trigger_pin: GPIO04 + echo_pin: GPIO12 + + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + +packages: + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml + device_base: !include common/device_base.yaml + ble_proxy: !include common/ble_proxy.yaml + +esphome: + name: ${devicename} + friendly_name: ${friendly_name} + name_add_mac_suffix: false + +esp32: + board: ${board} + framework: + type: esp-idf + +web_server: + port: 80 + version: 3 + include_internal: true + +# Enable logging +logger: + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +esp32_ble_tracker: + +# globals: +# - id: screen_power +# type: bool +# restore_value: yes +# initial_value: 'true' + +# font: +# - file: 'CascadiaMonoPL.ttf' +# id: font1 +# size: 17 + +# one_wire: +# - platform: gpio +# pin: ${one_wire_pin} + +# i2c: +# sda: ${sda_pin} +# scl: ${scl_pin} +# frequency: 800kHz + +# display: +# - platform: ssd1306_i2c +# id: oled +# model: "SSD1306 128x64" +# #reset_pin: GPIO14 #D0 +# address: 0x3C +# lambda: |- +# it.print(0, 0, id(font1), "Delta:"); +# it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); +# it.print(0, 16, id(font1), "Supply:"); +# it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_supply).state); +# it.print(0, 32, id(font1), "Return:"); +# it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); +# it.print(0, 48, id(font1), "Ambient:"); +# it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); + +# sensor: +# - platform: dallas_temp +# address: 0xB33C01B607798528 +# name: "Return Temperature" +# id: hvac_return +# update_interval: 10s +# filters: +# - lambda: return x * (9.0/5.0) + 32.0; +# unit_of_measurement: "°F" +# state_class: measurement + +# - platform: dallas_temp +# address: 0x0F3C01B6070C1328 +# name: "Supply Temperature" +# id: hvac_supply +# update_interval: 10s +# filters: +# - lambda: return x * (9.0/5.0) + 32.0; +# unit_of_measurement: "°F" +# state_class: measurement + +# - platform: dallas_temp +# address: 0xFA3C01B607005B28 +# name: "Ambient Temperature" +# id: ambient +# update_interval: 10s +# filters: +# - lambda: return x * (9.0/5.0) + 32.0; +# unit_of_measurement: "°F" +# state_class: measurement + +# - platform: template +# name: "Delta Temperature" +# id: hvac_delta +# lambda: |- +# return (id(hvac_supply).state - id(hvac_return).state); +# update_interval: 10s +# unit_of_measurement: "°F" +# state_class: measurement +# filters: +# - or: +# - throttle: 60s +# - delta: 1.0 + +# - platform: ultrasonic +# trigger_pin: ${trigger_pin} +# echo_pin: ${echo_pin} +# id: ultrasonic_source +# #update_interval: 5s +# internal: True +# filters: +# - sliding_window_moving_average: +# window_size: 5 +# send_every: 5 +# send_first_at: 1 +# on_value: +# then: +# - sensor.template.publish: +# id: distance_from_bottom +# state: !lambda 'return id(ultrasonic_source).state;' + +# - sensor.template.publish: +# id: distance_from_top +# state: !lambda 'return id(ultrasonic_source).state;' + +# - platform: template +# unit_of_measurement: "cm" +# state_class: measurement +# id: distance_from_bottom +# name: "Salt Level in CM" +# #update_interval: 5s +# filters: +# - lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;' +# on_value: +# then: +# - sensor.template.publish: +# id: level_in_bags +# state: !lambda 'return id(distance_from_bottom).state;' + +# - platform: template +# unit_of_measurement: "cm" +# state_class: measurement +# id: distance_from_top +# name: "Salt Level From Top in CM" +# #update_interval: 5s +# filters: +# - lambda: 'return (id(ultrasonic_source).state) * 100;' + +# - platform: template +# unit_of_measurement: "bags" +# state_class: measurement +# id: level_in_bags +# name: "Salt Level in Bags" +# #update_interval: 5s +# filters: +# - lambda: 'return (id(distance_from_bottom).state) / 17.5;' + +# binary_sensor: +# - platform: gpio +# name: "Door" +# device_class: door +# pin: +# number: ${door_pin} +# mode: INPUT_PULLUP + +# switch: +# - platform: template +# id: display_switch +# name: "Display" +# lambda: |- +# if (id(screen_power)) { +# id(oled).turn_on(); +# } else { +# id(oled).turn_off(); +# } +# return id(screen_power); +# turn_on_action: +# - lambda: |- +# id(screen_power) = true; +# // id(oled).turn_on(); +# turn_off_action: +# - lambda: |- +# id(screen_power) = false; +# // id(oled).turn_off(); diff --git a/esphome/archive/hvac-multisensor.yaml b/esphome/archive/hvac-multisensor.yaml new file mode 100644 index 0000000..40a4185 --- /dev/null +++ b/esphome/archive/hvac-multisensor.yaml @@ -0,0 +1,222 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v +substitutions: + devicename: hvac-multisensor + entity_name: hvac_multisensor + friendly_name: HVAC MultiSensor + comment: Clever MultiSensor + platform: ESP32 + board: wemos_d1_mini32 + static_ip: !secret hvac-multisensor-ip + + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO19 + + + one_wire_pin: GPIO14 + trigger_pin: GPIO04 + echo_pin: GPIO12 + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + +packages: + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml + device_base: !include common/device_base.yaml + ble_proxy: !include common/ble_proxy.yaml + +esphome: + name: ${devicename} + friendly_name: ${friendly_name} + +esp32: + board: ${board} + framework: + type: esp-idf + +# Enable logging +logger: + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +esp32_ble_tracker: + +globals: + - id: screen_power + type: bool + restore_value: yes + initial_value: 'true' + +font: + - file: 'CascadiaMonoPL.ttf' + id: font1 + size: 17 + +one_wire: + - platform: gpio + pin: ${one_wire_pin} + +i2c: + sda: ${sda_pin} + scl: ${scl_pin} + frequency: 800kHz + +display: + - platform: ssd1306_i2c + id: oled + model: "SSD1306 128x64" + #reset_pin: GPIO14 #D0 + address: 0x3C + lambda: |- + it.print(0, 0, id(font1), "Delta:"); + it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); + it.print(0, 16, id(font1), "Supply:"); + it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_supply).state); + it.print(0, 32, id(font1), "Return:"); + it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); + it.print(0, 48, id(font1), "Ambient:"); + it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); + +sensor: + - platform: dallas_temp + address: 0xB33C01B607798528 + name: "Return Temperature" + id: hvac_return + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0x0F3C01B6070C1328 + name: "Supply Temperature" + id: hvac_supply + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0xFA3C01B607005B28 + name: "Ambient Temperature" + id: ambient + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: template + name: "Delta Temperature" + id: hvac_delta + lambda: |- + return (id(hvac_supply).state - id(hvac_return).state); + update_interval: 10s + unit_of_measurement: "°F" + state_class: measurement + filters: + - or: + - throttle: 60s + - delta: 1.0 + + - platform: ultrasonic + trigger_pin: ${trigger_pin} + echo_pin: ${echo_pin} + id: ultrasonic_source + #update_interval: 5s + internal: True + filters: + - sliding_window_moving_average: + window_size: 5 + send_every: 5 + send_first_at: 1 + on_value: + then: + - sensor.template.publish: + id: distance_from_bottom + state: !lambda 'return id(ultrasonic_source).state;' + + - sensor.template.publish: + id: distance_from_top + state: !lambda 'return id(ultrasonic_source).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_bottom + name: "Salt Level in CM" + #update_interval: 5s + filters: + - lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;' + on_value: + then: + - sensor.template.publish: + id: level_in_bags + state: !lambda 'return id(distance_from_bottom).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_top + name: "Salt Level From Top in CM" + #update_interval: 5s + filters: + - lambda: 'return (id(ultrasonic_source).state) * 100;' + + - platform: template + unit_of_measurement: "bags" + state_class: measurement + id: level_in_bags + name: "Salt Level in Bags" + #update_interval: 5s + filters: + - lambda: 'return (id(distance_from_bottom).state) / 17.5;' + +binary_sensor: + - platform: gpio + name: "Door" + device_class: door + pin: + number: ${door_pin} + mode: INPUT_PULLUP + + - platform: homeassistant + internal: true + id: light_state + entity_id: light.furnace_room + on_state: + then: + - if: + condition: + lambda: 'return id(light_state).state;' + then: + - logger.log: "The light is on" + else: + - logger.log: "The is off. Turning off display" + - switch.turn_off: display_switch + +switch: + - platform: template + id: display_switch + name: "Display" + lambda: |- + if (id(screen_power)) { + id(oled).turn_on(); + } else { + id(oled).turn_off(); + } + return id(screen_power); + turn_on_action: + - lambda: |- + id(screen_power) = true; + // id(oled).turn_on(); + turn_off_action: + - lambda: |- + id(screen_power) = false; + // id(oled).turn_off(); diff --git a/esphome/archive/new-furnace-room-multisensor.yaml b/esphome/archive/new-furnace-room-multisensor.yaml new file mode 100644 index 0000000..3511543 --- /dev/null +++ b/esphome/archive/new-furnace-room-multisensor.yaml @@ -0,0 +1,229 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v + + +substitutions: + devicename: furnace-room-multisensor + entity_name: furnace_room_multisensor + friendly_name: Furnace Room MultiSensor + comment: Clever MultiSensor + platform: ESP32 + board: esp32dev + static_ip: !secret furnace-room-multisensor-ip + + one_wire_pin: GPIO16 + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO27 + trigger_pin: GPIO33 + echo_pin: GPIO35 + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + +packages: + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml + device_base: !include common/device_base.yaml + ble_proxy: !include common/ble_proxy.yaml + +esphome: + name: ${devicename} + friendly_name: ${friendly_name} + +esp32: + board: ${board} + framework: + type: esp-idf + +# Enable logging +logger: + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +wifi: # Using settings from common/wifi*.yaml + use_address: "192.168.1.230" + +captive_portal: + +esp32_ble_tracker: + +globals: + - id: screen_power + type: bool + restore_value: yes + initial_value: 'true' + +font: + - file: 'CascadiaMonoPL.ttf' + id: font1 + size: 17 + +one_wire: + - platform: gpio + pin: ${one_wire_pin} + +i2c: + # sda: GPIO13 #D1 + # scl: GPIO15 #D2 + sda: ${sda_pin} + scl: ${scl_pin} + frequency: 800kHz + +display: + - platform: ssd1306_i2c + id: oled + model: "SSD1306 128x64" + #reset_pin: GPIO14 #D0 + address: 0x3C + lambda: |- + it.print(0, 0, id(font1), "Delt:"); + it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); + it.print(0, 16, id(font1), "HVAC:"); + it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac).state); + it.print(0, 32, id(font1), "Retn:"); + it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); + it.print(0, 48, id(font1), "Ambt:"); + it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); + +sensor: + - platform: dallas_temp + address: 0xB33C01B607798528 + name: "Return Temperature" + id: hvac_return + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0x0F3C01B6070C1328 + name: "HVAC Temperature" + id: hvac + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0xFA3C01B607005B28 + name: "Furnace Room Temperature" + id: ambient + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: template + name: "HVAC Delta" + id: hvac_delta + lambda: |- + return (id(hvac).state - id(hvac_return).state); + update_interval: 10s + unit_of_measurement: "°F" + state_class: measurement + filters: + - or: + - throttle: 60s + - delta: 1.0 + + - platform: ultrasonic + trigger_pin: ${trigger_pin} + echo_pin: ${echo_pin} + id: ultrasonic_source + #update_interval: 5s + internal: True + filters: + - sliding_window_moving_average: + window_size: 5 + send_every: 5 + send_first_at: 1 + on_value: + then: + - sensor.template.publish: + id: distance_from_bottom + state: !lambda 'return id(ultrasonic_source).state;' + + - sensor.template.publish: + id: distance_from_top + state: !lambda 'return id(ultrasonic_source).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_bottom + name: "Salt Level in CM" + #update_interval: 5s + filters: + - lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;' + on_value: + then: + - sensor.template.publish: + id: level_in_bags + state: !lambda 'return id(distance_from_bottom).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_top + name: "Salt Level From Top in CM" + #update_interval: 5s + filters: + - lambda: 'return (id(ultrasonic_source).state) * 100;' + + - platform: template + unit_of_measurement: "bags" + state_class: measurement + id: level_in_bags + name: "Salt Level in Bags" + #update_interval: 5s + filters: + - lambda: 'return (id(distance_from_bottom).state) / 17.5;' + +binary_sensor: + - platform: gpio + name: "Furnace Room Door" + device_class: door + pin: + number: ${door_pin} + #mode: INPUT_PULLUP + + - platform: homeassistant + internal: true + id: light_state + entity_id: light.furnace_room + on_state: + then: + - if: + condition: + lambda: 'return id(light_state).state;' + then: + - logger.log: "The light is on" + else: + - logger.log: "The is off. Turning off display" + - switch.turn_off: display_switch + +switch: + - platform: template + id: display_switch + name: "HVAC Display Switch" + lambda: |- + if (id(screen_power)) { + id(oled).turn_on(); + } else { + id(oled).turn_off(); + } + return id(screen_power); + turn_on_action: + - lambda: |- + id(screen_power) = true; + // id(oled).turn_on(); + turn_off_action: + - lambda: |- + id(screen_power) = false; + // id(oled).turn_off(); diff --git a/esphome/bed-presence/base.yaml b/esphome/bed-presence/base.yaml deleted file mode 100644 index 45a27da..0000000 --- a/esphome/bed-presence/base.yaml +++ /dev/null @@ -1,80 +0,0 @@ -substitutions: - sensor_gpio_left: GPIO34 - sensor_gpio_right: GPIO35 - -packages: - diagnostics: !include - file: ../esphome-common/diagnostics.yaml - vars: - boot_gpio: GPIO9 - uptime_id: bed_presence_uptime - restart_id: btn_restart - status_id: bed_presence_status - - left_bed_sensor: !include - file: sensor.yaml - vars: - sensor_name: Left - sensor_id: left - sensor_gpio: ${sensor_gpio_left} - - right_bed_sensor: !include - file: sensor.yaml - vars: - sensor_name: Right - sensor_id: right - sensor_gpio: ${sensor_gpio_right} - -binary_sensor: - - platform: template - name: Bed Occupied Both (Fast) - id: bed_occupied_both_fast - device_class: occupancy - icon: mdi:bunk-bed - disabled_by_default: true - lambda: return id(bed_occupied_left_fast).state && id(bed_occupied_right_fast).state; - - - platform: template - name: Bed Occupied Either (Fast) - id: bed_occupied_either_fast - device_class: occupancy - icon: mdi:bunk-bed - disabled_by_default: true - lambda: return id(bed_occupied_left_fast).state || id(bed_occupied_right_fast).state; - - - platform: template - name: Bed Occupied Both - id: bed_occupied_both - device_class: occupancy - icon: mdi:bunk-bed - lambda: return id(bed_occupied_left).state && id(bed_occupied_right).state; - - - platform: template - name: Bed Occupied Either - id: bed_occupied_either - device_class: occupancy - icon: mdi:bunk-bed - lambda: return id(bed_occupied_left).state || id(bed_occupied_right).state; - -switch: - - platform: template - name: Full Range - id: full_range - optimistic: true - restore_mode: RESTORE_DEFAULT_OFF - entity_category: config - icon: mdi:arrow-expand - -select: - - platform: template - name: "Response Speed" - id: response_speed - icon: mdi:speedometer - optimistic: true - restore_value: true - options: - - "Fast" - - "Normal" - - "Slow" - initial_option: "Normal" - entity_category: config \ No newline at end of file diff --git a/esphome/bed-presence/bluetooth-proxy.yaml b/esphome/bed-presence/bluetooth-proxy.yaml deleted file mode 100644 index 4a9be5e..0000000 --- a/esphome/bed-presence/bluetooth-proxy.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# api: -# on_client_connected: -# - esp32_ble_tracker.start_scan: -# continuous: true -# on_client_disconnected: -# - esp32_ble_tracker.stop_scan: - -bluetooth_proxy: - active: true - -esp32_ble_tracker: - id: ble_tracker - scan_parameters: - active: true - continuous: false \ No newline at end of file diff --git a/esphome/bed-presence/diagnostics.yaml b/esphome/bed-presence/diagnostics.yaml deleted file mode 100644 index ef9d79b..0000000 --- a/esphome/bed-presence/diagnostics.yaml +++ /dev/null @@ -1,59 +0,0 @@ -substitutions: - boot_gpio: GPIO9 - boot_id: boot_button - status_id: status_sensor - factory_reset_id: factory_reset_button - restart_id: restart_button - wifi_db_id: wifi_signal_db - wifi_percent_id: wifi_signal_percent - uptime_id: uptime_sensor - -binary_sensor: - - platform: gpio - pin: - number: ${boot_gpio} - mode: INPUT_PULLUP - inverted: true - id: ${boot_id} - internal: true - name: Boot Button - filters: - - delayed_on: 10s - on_press: - then: - - button.press: ${factory_reset_id} - - - platform: status - id: ${status_id} - name: Status - -button: - - platform: factory_reset - id: ${factory_reset_id} - internal: true - - - platform: restart - name: Restart - id: ${restart_id} - entity_category: diagnostic - -sensor: - - platform: wifi_signal # Reports the WiFi signal strength in dB - name: WiFi Signal dB - id: ${wifi_db_id} - update_interval: 60s - - - platform: copy # Reports the WiFi signal strength in % - source_id: ${wifi_db_id} - name: WiFi Signal Percent - id: ${wifi_percent_id} - filters: - - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0); - unit_of_measurement: '%' - entity_category: diagnostic - device_class: "" - - - platform: uptime - type: seconds - id: ${uptime_id} - name: Uptime \ No newline at end of file diff --git a/esphome/bed-presence/sensor.yaml b/esphome/bed-presence/sensor.yaml deleted file mode 100644 index ebb9c0a..0000000 --- a/esphome/bed-presence/sensor.yaml +++ /dev/null @@ -1,240 +0,0 @@ -substitutions: - # Calibrate Trigger Percentile - # This controls how the trigger threshold is set during calibration. During calibration, the unoccupied and occupied - # pressure values are determined. This is the percentage of the difference between those values required to trigger - # the "occupied" state. - # - 0.75 Requires 75% of the occupied pressure to trigger (DEFAULT) - # - 0.50 Set trigger exactly in the middle of unoccupied and occupied pressures - # - 0.25 More sensitive, likely to be triggered by partner - trigger_percentile: '0.75' - - # Window Averaging Samples - # Add a sliding window moving average to the incoming sensor samples. This specifies the number of samples to average - # over. Each sample is 1/2 second. - # - 1 Don't perform averaging - # - 5 Average over 5 samples (2.5 seconds) (DEFAULT) - # - 10 Average over 10 samples (5 seconds) - averaging_window_samples: '5' - - # Fast Sensor Delay - # This controls how long the "Fast" sensor must register "unoccupied" or "occupied" before reporting. Averaging or - # delay is encouraged to prevent frequent false negatives as you shift in bed. - # - 2s Same response as standard sensor - # - 500ms Good starting point for getting speed without too many false negatives - # - 0ms No delay (DEFAULT) - fast_delayed_on: '0ms' - fast_delayed_off: '0ms' - - # Standard Sensor Delay - # This controls how long the standard sensor must register "unoccupied" or "occupied" before reporting. Averaging or - # delay is enocuraged to ensure stability. - standard_delayed_on: '0s' - standard_delayed_off: '1s' - - # Slow Sensor Delay - # This controls how long the "Slow" sensor must register "unoccupied" or "occupied" before reporting. Averaging or - # delay is encouraged to ensure stability. - slow_delayed_on: '2s' - slow_delayed_off: '5s' - - # Reporting Delta - # The sensor must change by this amount before an update is sent (or the reporting_interval_max has been hit) - # - 10.0 Only report very large changes - # - 1.0 Relatively sensitive with much less reporting (DEFAULT) - # - 0.1 Very sensitive, will report frequently - reporting_delta: '1.0' - - # Reporting Interval (Max) - # The max amount of time between sensor reports (even if the value hasn't changed) - reporting_interval_max: '180s' - - # Linear Calibration Points - # Change the linear calibration points for the FSR sensor. These values correspond with the raw pulses per minute from - # the pulse_counter. Only mess with this if you know what you're doing. In standard mode (Full Range = False), the - # sensor is linearly calibrated between calibrate_0 (0%) and calibreate_100 (100%). When Full Range = True, - # calibrate_0 is set to 0. - calibrate_100: '408000' - calibrate_0: '276000' - -binary_sensor: - - platform: template - name: Bed Occupied ${sensor_name} (Fast) - id: bed_occupied_${sensor_id}_fast - device_class: occupancy - icon: mdi:speedometer - disabled_by_default: true - filters: - - delayed_on: ${fast_delayed_on} - - delayed_off: ${fast_delayed_off} - lambda: return id(bed_sensor_${sensor_id}).state > id(val_trigger_${sensor_id}).state; - - - platform: template - name: Bed Occupied ${sensor_name} (Normal) - id: bed_occupied_${sensor_id}_normal - device_class: occupancy - icon: mdi:speedometer-medium - disabled_by_default: true - filters: - - delayed_on: ${standard_delayed_on} - - delayed_off: ${standard_delayed_off} - lambda: return id(bed_sensor_${sensor_id}).state > id(val_trigger_${sensor_id}).state; - - - platform: template - id: bed_occupied_${sensor_id}_slow - name: Bed Occupied ${sensor_name} (Slow) - device_class: occupancy - icon: mdi:speedometer-slow - disabled_by_default: true - filters: - - delayed_on: ${slow_delayed_on} - - delayed_off: ${slow_delayed_off} - lambda: return id(bed_sensor_${sensor_id}).state > id(val_trigger_${sensor_id}).state; - - - platform: template - name: Bed Occupied ${sensor_name} - id: bed_occupied_${sensor_id} - device_class: occupancy - icon: mdi:bed - lambda: |- # Sensor response is user tunable via "Response Speed" - if (id(response_speed).state == "Fast") { - return id(bed_occupied_${sensor_id}_fast).state; - } else if (id(response_speed).state == "Slow") { - return id(bed_occupied_${sensor_id}_slow).state; - } else { - return id(bed_occupied_${sensor_id}_normal).state; - } - -sensor: - - platform: pulse_counter - pin: ${sensor_gpio} - name: ${sensor_name} Pressure - id: bed_sensor_${sensor_id} - update_interval: 0.5s - unit_of_measurement: '%' - icon: mdi:gauge - filters: - - lambda: |- # scale pulses/minute to 0%->100% - float cal_0 = id(full_range).state ? 0 : ${calibrate_0}; - - float val = (x - cal_0) * 100; - float range = ${calibrate_100} - cal_0; - - return val/range; - - clamp: - min_value: 0 - - sliding_window_moving_average: - window_size: ${averaging_window_samples} - send_every: 1 - - or: - - delta: ${reporting_delta} # only send if sensor changes by `reporting_delta` (eliminate sensor noise) - - throttle: ${reporting_interval_max} # but still update every `reporting_interval_max` - - platform: copy - source_id: bed_sensor_${sensor_id} - name: Calibrated ${sensor_name} Pressure - id: bed_sensor_${sensor_id}_calibrated - icon: mdi:scale-balance - disabled_by_default: true - filters: - - lambda: |- # scale between val_unoccupied and val_occupied - float cal_0 = id(val_unoccupied_${sensor_id}).state; - float cal_100 = id(val_occupied_${sensor_id}).state; - - float val = (x - cal_0) * 100; - float range = cal_100 - cal_0; - - return val/range; - - clamp: - max_value: 100 - min_value: 0 - -number: - - platform: template - name: ${sensor_name} Unoccupied Pressure - id: val_unoccupied_${sensor_id} - icon: mdi:gauge-empty - unit_of_measurement: '%' - entity_category: diagnostic - optimistic: true - restore_value: true - initial_value: 0 - min_value: 0 - max_value: 120 - step: 1.0 - mode: box - on_value: - then: - - lambda: |- # Update trigger - id(update_trigger_${sensor_id})->execute(); - - platform: template - name: ${sensor_name} Occupied Pressure - id: val_occupied_${sensor_id} - icon: mdi:gauge-full - unit_of_measurement: '%' - entity_category: diagnostic - optimistic: true - restore_value: true - initial_value: 100 - min_value: 0 - max_value: 120 - step: 1.0 - mode: box - on_value: - then: - - lambda: |- # Update trigger - id(update_trigger_${sensor_id})->execute(); - - platform: template - name: ${sensor_name} Trigger Pressure - id: val_trigger_${sensor_id} - optimistic: true - restore_value: true - initial_value: 50 - min_value: 0 - max_value: 120 - step: 1.0 - mode: box - icon: mdi:gauge - unit_of_measurement: '%' - entity_category: config - -button: - - platform: template - name: Calibrate ${sensor_name} Unoccupied - id: calibration_${sensor_id}_set_unoccupied - icon: mdi:bed-empty - entity_category: config - on_press: - then: - - number.set: - id: val_unoccupied_${sensor_id} - # round to 2 decimal places - value: !lambda return round(id(bed_sensor_${sensor_id}).state * 100)/100.0; - - platform: template - name: Calibrate ${sensor_name} Occupied - id: calibration_${sensor_id}_set_occupied - icon: mdi:bed - entity_category: config - on_press: - then: - - number.set: - id: val_occupied_${sensor_id} - # round to 2 decimal places - value: !lambda return round(id(bed_sensor_${sensor_id}).state * 100)/100.0; - -script: - - id: update_trigger_${sensor_id} - mode: queued - then: - - lambda: |- # Set trigger to x% of difference between min/max - float unoccupied_pressure = id(val_unoccupied_${sensor_id}).state; - float occupied_pressure = id(val_occupied_${sensor_id}).state; - - // calculate new trigger value - float trigger_pressure = unoccupied_pressure + ((occupied_pressure - unoccupied_pressure) * float(${trigger_percentile})); - - // round to 2 decimal places - trigger_pressure = round(trigger_pressure * 100)/100.0; - - // set value - auto call = id(val_trigger_${sensor_id}).make_call(); - call.set_value(trigger_pressure); - call.perform(); \ No newline at end of file diff --git a/esphome/common/binary_sensor/status_sensor.config.yaml b/esphome/common/binary_sensor/status_sensor.config.yaml index 69d3b74..213ace1 100644 --- a/esphome/common/binary_sensor/status_sensor.config.yaml +++ b/esphome/common/binary_sensor/status_sensor.config.yaml @@ -1,3 +1,2 @@ platform: status -name: "${friendly_name} Status" -id: ${entity_name}_status \ No newline at end of file +name: "Status" \ No newline at end of file diff --git a/esphome/common/ble_tracker.yaml b/esphome/common/ble_tracker.yaml index 5dca16b..9424087 100644 --- a/esphome/common/ble_tracker.yaml +++ b/esphome/common/ble_tracker.yaml @@ -1,8 +1 @@ -esp32_ble_tracker: - -binary_sensor: - - platform: ble_presence - ibeacon_uuid: '601c742f-2b19-ed3c-f5fc-0bb31d6c2eac' - ibeacon_major: 100 - ibeacon_minor: 1 - name: "${friendly_name} Pixel 4" \ No newline at end of file +esp32_ble_tracker: \ No newline at end of file diff --git a/esphome/common/button/restart_button.config.yaml b/esphome/common/button/restart_button.config.yaml index ab3c90f..21e9e21 100644 --- a/esphome/common/button/restart_button.config.yaml +++ b/esphome/common/button/restart_button.config.yaml @@ -1,4 +1,3 @@ platform: restart -name: "${friendly_name} Restart" -id: ${entity_name}_restart +name: "Restart" disabled_by_default: false \ No newline at end of file diff --git a/esphome/common/device_base.yaml b/esphome/common/device_base.yaml index 64c9ffc..596c9f0 100644 --- a/esphome/common/device_base.yaml +++ b/esphome/common/device_base.yaml @@ -29,5 +29,5 @@ button: sensor: - <<: !include sensor/uptime_sensor.config.yaml -#text_sensor: -# - <<: !include text_sensor/version_sensor.config.yaml +text_sensor: + - <<: !include text_sensor/version_sensor.config.yaml diff --git a/esphome/common/ethernet.yaml b/esphome/common/ethernet.yaml index 1f8654b..49d3a63 100644 --- a/esphome/common/ethernet.yaml +++ b/esphome/common/ethernet.yaml @@ -3,15 +3,18 @@ ethernet: type: LAN8720 mdc_pin: GPIO23 mdio_pin: GPIO18 - clk_mode: GPIO17_OUT - phy_addr: 0 + clk: + pin: GPIO17 + mode: CLK_OUT power_pin: GPIO5 + phy_addr: 0 manual_ip: static_ip: ${static_ip} gateway: !secret iot_default_gateway subnet: !secret iot_subnet_mask dns1: !secret iot_default_dns1 + dns2: !secret iot_default_dns2 #text_sensor: #- <<: !include text_sensor/ethernet_ip_address.config.yaml diff --git a/esphome/common/hx711_single_verbose.yaml b/esphome/common/hx711_single_verbose.yaml index 3f9c407..780cbce 100644 --- a/esphome/common/hx711_single_verbose.yaml +++ b/esphome/common/hx711_single_verbose.yaml @@ -27,7 +27,7 @@ sensor: id: occupied - platform: template - name: "${friendly_name} Raw Value" + name: "Raw Value" lambda: |- return id(hx711_value_raw).raw_state; unit_of_measurement: w @@ -35,7 +35,7 @@ sensor: state_class: measurement - platform: template - name: "${friendly_name} Auto Tare" + name: "Auto Tare" lambda: |- return id(auto_tare_difference); unit_of_measurement: w @@ -43,7 +43,7 @@ sensor: state_class: measurement - platform: template - name: "${friendly_name} Initial Zero" + name: "Initial Zero" lambda: |- return id(initial_zero); unit_of_measurement: w @@ -95,7 +95,7 @@ sensor: # Mapped value to lbs - platform: template id: hx711_value - name: "${friendly_name} Weight" + name: "Weight" internal: False filters: # apply auto_tare difference @@ -125,7 +125,7 @@ sensor: binary_sensor: - platform: template device_class: occupancy - name: "${friendly_name} Occupied" + name: "Occupied" icon: mdi:bed lambda: |- if ( @@ -137,7 +137,7 @@ binary_sensor: } - platform: template - name: "${friendly_name} HX711 Error" + name: "HX711 Error" id: hx711_error device_class: problem lambda: |- @@ -152,7 +152,7 @@ binary_sensor: switch: - platform: template id: force_occupancy - name: "${friendly_name} Force Occupancy" + name: "Force Occupancy" lambda: |- return id(occupancy_forced); turn_on_action: @@ -166,7 +166,7 @@ switch: id: auto_tare # optimistic: true # assumed_state: true - name: "${friendly_name} Auto Tare" + name: "Auto Tare" lambda: |- return id(auto_tare_enabled); turn_on_action: @@ -179,14 +179,14 @@ switch: button: - platform: template id: manual_tare - name: "${friendly_name} Manual Tare" + name: "Manual Tare" on_press: - lambda: |- id(auto_tare_difference) = id(initial_zero) - id(hx711_value_raw).state; - platform: template id: reset_tare - name: "${friendly_name} Reset Tare" + name: "Reset Tare" on_press: - lambda: |- id(auto_tare_difference) = 0; \ No newline at end of file diff --git a/esphome/common/sensor-test.yaml b/esphome/common/sensor-test.yaml deleted file mode 100644 index 31fc271..0000000 --- a/esphome/common/sensor-test.yaml +++ /dev/null @@ -1,9 +0,0 @@ -filters: - - median: - window_size: 5 - send_every: 2 - send_first_at: 1 - - or: - - throttle: 5min - - delta: 1.0 - - delta: .1 \ No newline at end of file diff --git a/esphome/common/sensor/rssi_sensor.config.yaml b/esphome/common/sensor/rssi_sensor.config.yaml index 56cd4a4..d447e5a 100644 --- a/esphome/common/sensor/rssi_sensor.config.yaml +++ b/esphome/common/sensor/rssi_sensor.config.yaml @@ -1,4 +1,3 @@ platform: wifi_signal -name: ${friendly_name} RSSI -id: ${entity_name}_rssi +name: RSSI update_interval: 60s \ No newline at end of file diff --git a/esphome/common/sensor/uptime_sensor.config.yaml b/esphome/common/sensor/uptime_sensor.config.yaml index c9beebd..ebf9f73 100644 --- a/esphome/common/sensor/uptime_sensor.config.yaml +++ b/esphome/common/sensor/uptime_sensor.config.yaml @@ -1,4 +1,3 @@ platform: uptime -name: ${friendly_name} Uptime -id: ${entity_name}_uptime +name: Uptime disabled_by_default: true \ No newline at end of file diff --git a/esphome/common/text_sensor/ethernet_ip_address.config.yaml b/esphome/common/text_sensor/ethernet_ip_address.config.yaml index b81d803..1e0a2ab 100644 --- a/esphome/common/text_sensor/ethernet_ip_address.config.yaml +++ b/esphome/common/text_sensor/ethernet_ip_address.config.yaml @@ -1,8 +1,7 @@ # Text sensors with general information. platform: template #ip_address: -name: ${friendly_name} IP -id: ${entity_name}_ip +name: IP icon: mdi:ip-network entity_category: diagnostic disabled_by_default: true diff --git a/esphome/common/text_sensor/ethernet_mac_address.config.yaml b/esphome/common/text_sensor/ethernet_mac_address.config.yaml index cd6a59d..ecb61f3 100644 --- a/esphome/common/text_sensor/ethernet_mac_address.config.yaml +++ b/esphome/common/text_sensor/ethernet_mac_address.config.yaml @@ -1,8 +1,7 @@ # Text sensors with general information. platform: template #mac_address: -name: ${friendly_name} Ethernet MAC Address -id: ${entity_name}_ethernet_mac_address +name: Ethernet MAC Address disabled_by_default: true icon: mdi:network entity_category: diagnostic diff --git a/esphome/common/text_sensor/version_sensor.config.yaml b/esphome/common/text_sensor/version_sensor.config.yaml index e9e3544..d8cfe57 100644 --- a/esphome/common/text_sensor/version_sensor.config.yaml +++ b/esphome/common/text_sensor/version_sensor.config.yaml @@ -1,5 +1,6 @@ -# platform: version -# name: ${friendly_name} ESPHome Version +platform: version +name: ESPHome Version # id: ${entity_name}_version -# hide_timestamp: true -# disabled_by_default: true +hide_timestamp: true +disabled_by_default: true +icon: mdi:chip diff --git a/esphome/common/text_sensor/wifi_sensor.config.yaml b/esphome/common/text_sensor/wifi_sensor.config.yaml index 5ce2659..e6cbb96 100644 --- a/esphome/common/text_sensor/wifi_sensor.config.yaml +++ b/esphome/common/text_sensor/wifi_sensor.config.yaml @@ -1,22 +1,18 @@ # Text sensors with general information. platform: wifi_info ip_address: - name: ${friendly_name} IP - id: ${entity_name}_ip + name: IP icon: mdi:ip disabled_by_default: true ssid: - name: ${friendly_name} SSID - id: ${entity_name}_ssid + name: SSID icon: mdi:lan disabled_by_default: true bssid: - name: ${friendly_name} BSSID - id: ${entity_name}_bssid + name: BSSID disabled_by_default: true icon: mdi:router-network mac_address: - name: ${friendly_name} Wifi MAC Address - id: ${entity_name}_wifi_mac_address + name: Wifi MAC Address disabled_by_default: true icon: mdi:wifi-cog \ No newline at end of file diff --git a/esphome/common/touch_sensor_bed_single.yaml b/esphome/common/touch_sensor_bed_single.yaml deleted file mode 100644 index 80c5c2f..0000000 --- a/esphome/common/touch_sensor_bed_single.yaml +++ /dev/null @@ -1,13 +0,0 @@ -esp32_touch: - setup_mode: ${setup_mode} - -binary_sensor: - - platform: esp32_touch - name: "${friendly_name} Occupied" - pin: ${touch_pin} - device_class: occupancy - icon: mdi:bed - threshold: ${threshold} - filters: - - delayed_on: 5s - - delayed_off: 10s diff --git a/esphome/common/wifi.yaml b/esphome/common/wifi.yaml index 657e356..dbf2046 100644 --- a/esphome/common/wifi.yaml +++ b/esphome/common/wifi.yaml @@ -16,7 +16,8 @@ wifi: # Enable fallback hotspot (captive portal) in case wifi connection fails ap: - password: !secret EspHome_AP_PWD + ssid: "${friendly_name}" + password: !secret fallback_ap_password # Enable fast connect fast_connect: true diff --git a/esphome/common/wifi_dhcp.yaml b/esphome/common/wifi_dhcp.yaml index b169877..5b54969 100644 --- a/esphome/common/wifi_dhcp.yaml +++ b/esphome/common/wifi_dhcp.yaml @@ -11,7 +11,8 @@ wifi: # Enable fallback hotspot (captive portal) in case wifi connection fails ap: - password: !secret EspHome_AP_PWD + ssid: "${friendly_name}" + password: !secret fallback_ap_password sensor: - <<: !include sensor/rssi_sensor.config.yaml diff --git a/esphome/common/wifi_no_power_save.yaml b/esphome/common/wifi_no_power_save.yaml index 03ae6b1..25bca77 100644 --- a/esphome/common/wifi_no_power_save.yaml +++ b/esphome/common/wifi_no_power_save.yaml @@ -1,9 +1,8 @@ captive_portal: wifi: - networks: - - ssid: !secret Wifi_SSID - password: !secret Wifi_PWD + ssid: !secret Wifi_SSID + password: !secret Wifi_PWD #- ssid: !secret IoT_Wifi_SSID # password: !secret IoT_Wifi_PWD @@ -15,7 +14,8 @@ wifi: # Enable fallback hotspot (captive portal) in case wifi connection fails ap: - password: !secret EspHome_AP_PWD + ssid: "${friendly_name}" + password: !secret fallback_ap_password # Enable fast connect fast_connect: true diff --git a/esphome/hvac-multisensor-425f4f.yaml b/esphome/hvac-multisensor-425f4f.yaml new file mode 100644 index 0000000..51ee77b --- /dev/null +++ b/esphome/hvac-multisensor-425f4f.yaml @@ -0,0 +1,233 @@ +# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v +substitutions: + devicename: hvac-multisensor-425f4f + entity_name: hvac_multisensor + friendly_name: HVAC MultiSensor + comment: Clever MultiSensor + platform: ESP32 + board: wemos_d1_mini32 + static_ip: !secret hvac-multisensor-ip + + sda_pin: GPIO21 + scl_pin: GPIO22 + door_pin: GPIO19 + one_wire_pin: GPIO14 + trigger_pin: GPIO04 + echo_pin: GPIO13 + + #mdc_pin: GPIO23 + #mdio_pin: GPIO18 + #clk_mode: GPIO17_OUT + #power_pin: GPIO5 + +packages: + #wifi: !include common/wifi_no_power_save.yaml + ethernet: !include common/ethernet.yaml + device_base: !include common/device_base.yaml + ble_proxy: !include common/ble_proxy.yaml + +esphome: + name: ${devicename} + friendly_name: ${friendly_name} + name_add_mac_suffix: false + on_boot: + then: + - lambda: |- + if (id(oled)) { + id(oled_enabled) = true; + } else { + id(oled_enabled) = false; + } + +esp32: + board: ${board} + framework: + type: esp-idf + +web_server: + port: 80 + version: 3 + include_internal: true + +# Enable logging +logger: + level: DEBUG + logs: + sensor: INFO + component: INFO + ultrasonic: INFO + ethernet: DEBUG + +api: # Using settings from common/device_base.yaml + +ota: # Using settings from common/device_base.yaml + +esp32_ble_tracker: + +globals: + - id: oled_enabled + type: bool + restore_value: yes + initial_value: 'false' + + - id: screen_power + type: bool + restore_value: yes + initial_value: 'true' + +font: + - file: 'CascadiaMonoPL.ttf' + id: font1 + size: 17 + +one_wire: + - platform: gpio + pin: ${one_wire_pin} + +i2c: + sda: ${sda_pin} + scl: ${scl_pin} + frequency: 800kHz + +sensor: + - platform: dallas_temp + address: 0xB33C01B607798528 + name: "Return Temperature" + id: hvac_return + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0x0F3C01B6070C1328 + name: "Supply Temperature" + id: hvac_supply + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: dallas_temp + address: 0xFA3C01B607005B28 + name: "Ambient Temperature" + id: ambient + update_interval: 10s + filters: + - lambda: return x * (9.0/5.0) + 32.0; + unit_of_measurement: "°F" + state_class: measurement + + - platform: template + name: "Delta Temperature" + id: hvac_delta + lambda: |- + return (id(hvac_supply).state - id(hvac_return).state); + update_interval: 10s + unit_of_measurement: "°F" + state_class: measurement + filters: + - or: + - throttle: 60s + - delta: 1.0 + + - platform: ultrasonic + trigger_pin: ${trigger_pin} + echo_pin: ${echo_pin} + id: ultrasonic_source + #update_interval: 5s + internal: True + filters: + - sliding_window_moving_average: + window_size: 5 + send_every: 5 + send_first_at: 1 + on_value: + then: + - sensor.template.publish: + id: distance_from_bottom + state: !lambda 'return id(ultrasonic_source).state;' + + - sensor.template.publish: + id: distance_from_top + state: !lambda 'return id(ultrasonic_source).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_bottom + name: "Salt Level in CM" + #update_interval: 5s + filters: + - lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;' + on_value: + then: + - sensor.template.publish: + id: level_in_bags + state: !lambda 'return id(distance_from_bottom).state;' + + - platform: template + unit_of_measurement: "cm" + state_class: measurement + id: distance_from_top + name: "Salt Level From Top in CM" + #update_interval: 5s + filters: + - lambda: 'return (id(ultrasonic_source).state) * 100;' + + - platform: template + unit_of_measurement: "bags" + state_class: measurement + id: level_in_bags + name: "Salt Level in Bags" + #update_interval: 5s + filters: + - lambda: 'return (id(distance_from_bottom).state) / 17.5;' + +display: + - platform: ssd1306_i2c + id: oled + model: "SSD1306 128x64" + #reset_pin: GPIO14 #D0 + address: 0x3C + lambda: |- + it.print(0, 0, id(font1), "Delta:"); + it.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state); + it.print(0, 16, id(font1), "Supply:"); + it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_supply).state); + it.print(0, 32, id(font1), "Return:"); + it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); + it.print(0, 48, id(font1), "Ambient:"); + it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state); + +binary_sensor: + - platform: gpio + name: "Door" + device_class: door + pin: ${door_pin} + +switch: + - platform: template + id: display_switch + name: "Display" + lambda: |- + if (id(screen_power)) { + if (id(oled_enabled)) { + id(oled).turn_on(); + } + } else { + if (id(oled_enabled)) { + id(oled).turn_off(); + } + } + return id(screen_power); + turn_on_action: + - lambda: |- + id(screen_power) = true; + // id(oled).turn_on(); + turn_off_action: + - lambda: |- + id(screen_power) = false; + // id(oled).turn_off(); diff --git a/esphome/nursery-tagreader.yaml b/esphome/nursery-tagreader.yaml index f58cd4a..bfcde34 100644 --- a/esphome/nursery-tagreader.yaml +++ b/esphome/nursery-tagreader.yaml @@ -36,14 +36,14 @@ esphome: # Define switches to control LED and buzzer from HA switch: - platform: template - name: "${friendly_name} Buzzer Enabled" + name: "Buzzer Enabled" id: buzzer_enabled icon: mdi:volume-high optimistic: true restore_mode: restore_default_on entity_category: config - platform: template - name: "${friendly_name} LED enabled" + name: "LED enabled" id: led_enabled icon: mdi:alarm-light-outline optimistic: true @@ -321,38 +321,12 @@ output: binary_sensor: - platform: gpio - name: Nursery Door + name: Door device_class: door pin: mode: INPUT_PULLUP number: D5 -# # - platform: gpio -# # name: "Nursery Closet" -# # device_class: door -# # pin: -# # number: D6 -# # mode: INPUT_PULLUP - - # - platform: status - # name: "${friendly_name} Status" - # entity_category: diagnostic - -# text_sensor: -# - platform: version -# hide_timestamp: true -# name: "${friendly_name} ESPHome Version" -# entity_category: diagnostic -# - platform: wifi_info -# ip_address: -# name: "${friendly_name} IP Address" -# icon: mdi:wifi -# entity_category: diagnostic -# ssid: -# name: "${friendly_name} Connected SSID" -# icon: mdi:wifi-strength-2 -# entity_category: diagnostic - # Define buzzer as output for RTTTL rtttl: output: buzzer @@ -366,7 +340,7 @@ light: flash_transition_length: 500ms type: GRB id: activity_led - name: "${friendly_name} LED" + name: "LED" restore_mode: ALWAYS_OFF diff --git a/lovelace/cameras/view-camera-mbr.yaml b/lovelace/cameras/view-camera-mbr.yaml new file mode 100644 index 0000000..4fff2f6 --- /dev/null +++ b/lovelace/cameras/view-camera-mbr.yaml @@ -0,0 +1,92 @@ +type: conditional +conditions: + - condition: state + entity: sensor.frigate_cam06_camera_fps + state_not: "0" +card: + type: vertical-stack + cards: + - type: custom:advanced-camera-card + cameras_global: + dimensions: + layout: + fit: fill + + status_bar: + style: none + menu: + buttons: + frigate: + enabled: false + style: none + cameras: + - camera_entity: camera.frigate_cam06 + live_provider: go2rtc + id: frigate-cam06 + capabilities: + disable: [] + disable_except: + - live + go2rtc: + stream: rtsp_cam06_sub + modes: + - webrtc + title: MBR Left + icon: mdi:bed-king + always_error_if_entity_unavailable: false + triggers: + motion: false + events: [] + occupancy: false + - camera_entity: camera.frigate_cam07 + live_provider: go2rtc + id: frigate-cam07 + capabilities: + disable: [] + disable_except: + - live + go2rtc: + stream: rtsp_cam07_sub + modes: + - webrtc + title: MBR Right + icon: mdi:bed-king + always_error_if_entity_unavailable: false + triggers: + motion: false + entities: [] + view: + default: live + default_reset: + every_seconds: 5 + after_interaction: true + interaction_mode: all + default_cycle_camera: true + triggers: + filter_selected_camera: false + profiles: [] + grid_options: + columns: full + live: + preload: true + draggable: false + show_image_during_load: false + lazy_load: false + controls: + timeline: + mode: none + thumbnails: + mode: none + builtin: false + next_previous: + style: none + zoomable: false + auto_play: + - selected + transition_effect: slide + display: + mode: single + dimensions: + aspect_ratio_mode: static + aspect_ratio: '16:9' + diff --git a/lovelace/phone/master-bedroom.yaml b/lovelace/phone/master-bedroom.yaml index 90c4dd9..80c4e16 100644 --- a/lovelace/phone/master-bedroom.yaml +++ b/lovelace/phone/master-bedroom.yaml @@ -128,5 +128,6 @@ cards: cards: - type: custom:mushroom-title-card subtitle: Cameras - - !include /config/lovelace/cameras/view-camera-06.yaml - - !include /config/lovelace/cameras/view-camera-07.yaml \ No newline at end of file + - !include /config/lovelace/cameras/view-camera-mbr.yaml + #- !include /config/lovelace/cameras/view-camera-06.yaml + #- !include /config/lovelace/cameras/view-camera-07.yaml \ No newline at end of file