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.
This commit is contained in:
CeeWeasel
2025-07-20 12:33:08 -04:00
parent 4e0e55ac3c
commit 75fb9c2ab8
31 changed files with 1315 additions and 600 deletions
@@ -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
@@ -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();
+59 -61
View File
@@ -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();
@@ -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();
+222
View File
@@ -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();
@@ -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();