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 #C4:7C:8D:6D:3E:AE
sensor: 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 - platform: ultrasonic
trigger_pin: GPIO13 trigger_pin: GPIO13
echo_pin: GPIO14 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: substitutions:
devicename: furnace-room-multisensor devicename: furnace-room-multisensor
entity_name: furnace_room_multisensor entity_name: furnace_room_multisensor
friendly_name: Furnace Room MultiSensor friendly_name: Furnace Room MultiSensor
comment: Clever MultiSensor
platform: ESP32 platform: ESP32
board: nodemcu-32s board: wemos_d1_mini32
static_ip: !secret furnace-room-multisensor-ip 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: packages:
#wifi: !include common/wifi.yaml #wifi: !include common/wifi_no_power_save.yaml
ethernet: !include common/olimex-evb.yaml ethernet: !include common/ethernet.yaml
device_base: !include common/device_base.yaml device_base: !include common/device_base.yaml
ble_proxy: !include common/ble_proxy.yaml ble_proxy: !include common/ble_proxy.yaml
esp32: esphome:
board: esp32-poe-iso name: ${devicename}
friendly_name: ${friendly_name}
esp32:
board: ${board}
framework:
type: esp-idf
# Enable logging
logger: logger:
level: DEBUG
logs: api: # Using settings from common/device_base.yaml
dallas.sensor: NONE
sensor: NONE ota: # Using settings from common/device_base.yaml
esp32_ble_tracker:
globals: globals:
- id: screen_power - id: screen_power
@@ -32,14 +56,13 @@ font:
id: font1 id: font1
size: 17 size: 17
dallas_temp: one_wire:
- pin: - platform: gpio
number: GPIO5 #D4 pin: ${one_wire_pin}
update_interval: 10s
i2c: i2c:
sda: GPIO13 #D1 sda: ${sda_pin}
scl: GPIO15 #D2 scl: ${scl_pin}
frequency: 800kHz frequency: 800kHz
display: display:
@@ -49,48 +72,51 @@ display:
#reset_pin: GPIO14 #D0 #reset_pin: GPIO14 #D0
address: 0x3C address: 0x3C
lambda: |- 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.printf(128, 0, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_delta).state);
it.print(0, 16, id(font1), "HVAC:"); it.print(0, 16, id(font1), "Supply:");
it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac).state); it.printf(128, 16, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_supply).state);
it.print(0, 32, id(font1), "Retn:"); it.print(0, 32, id(font1), "Return:");
it.printf(128, 32, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(hvac_return).state); 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); it.printf(128, 48, id(font1), TextAlign::TOP_RIGHT, "%.1f°F", id(ambient).state);
sensor: sensor:
- platform: dallas - platform: dallas_temp
address: 0xB33C01B607798528 address: 0xB33C01B607798528
name: "Return Temperature" name: "Return Temperature"
id: hvac_return id: hvac_return
update_interval: 10s
filters: filters:
- lambda: return x * (9.0/5.0) + 32.0; - lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F" unit_of_measurement: "°F"
state_class: measurement state_class: measurement
- platform: dallas - platform: dallas_temp
address: 0x0F3C01B6070C1328 address: 0x0F3C01B6070C1328
name: "HVAC Temperature" name: "Supply Temperature"
id: hvac id: hvac_supply
update_interval: 10s
filters: filters:
- lambda: return x * (9.0/5.0) + 32.0; - lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F" unit_of_measurement: "°F"
state_class: measurement state_class: measurement
- platform: dallas - platform: dallas_temp
address: 0xFA3C01B607005B28 address: 0xFA3C01B607005B28
name: "Furnace Room Temperature" name: "Ambient Temperature"
id: ambient id: ambient
update_interval: 10s
filters: filters:
- lambda: return x * (9.0/5.0) + 32.0; - lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F" unit_of_measurement: "°F"
state_class: measurement state_class: measurement
- platform: template - platform: template
name: "HVAC Delta" name: "Delta Temperature"
id: hvac_delta id: hvac_delta
lambda: |- lambda: |-
return (id(hvac).state - id(hvac_return).state); return (id(hvac_supply).state - id(hvac_return).state);
update_interval: 10s update_interval: 10s
unit_of_measurement: "°F" unit_of_measurement: "°F"
state_class: measurement state_class: measurement
@@ -99,37 +125,9 @@ sensor:
- throttle: 60s - throttle: 60s
- delta: 1.0 - 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 - platform: ultrasonic
trigger_pin: GPIO33 #D7 trigger_pin: ${trigger_pin}
echo_pin: GPIO35 #D8 echo_pin: ${echo_pin}
id: ultrasonic_source id: ultrasonic_source
#update_interval: 5s #update_interval: 5s
internal: True internal: True
@@ -182,10 +180,10 @@ sensor:
binary_sensor: binary_sensor:
- platform: gpio - platform: gpio
name: "Furnace Room Door" name: "Door"
device_class: door device_class: door
pin: pin:
number: GPIO3 #D5 number: ${door_pin}
mode: INPUT_PULLUP mode: INPUT_PULLUP
- platform: homeassistant - platform: homeassistant
@@ -206,7 +204,7 @@ binary_sensor:
switch: switch:
- platform: template - platform: template
id: display_switch id: display_switch
name: "HVAC Display Switch" name: "Display"
lambda: |- lambda: |-
if (id(screen_power)) { if (id(screen_power)) {
id(oled).turn_on(); 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();
-80
View File
@@ -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
-15
View File
@@ -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
-59
View File
@@ -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
-240
View File
@@ -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();
@@ -1,3 +1,2 @@
platform: status platform: status
name: "${friendly_name} Status" name: "Status"
id: ${entity_name}_status
+1 -8
View File
@@ -1,8 +1 @@
esp32_ble_tracker: 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"
@@ -1,4 +1,3 @@
platform: restart platform: restart
name: "${friendly_name} Restart" name: "Restart"
id: ${entity_name}_restart
disabled_by_default: false disabled_by_default: false
+2 -2
View File
@@ -29,5 +29,5 @@ button:
sensor: sensor:
- <<: !include sensor/uptime_sensor.config.yaml - <<: !include sensor/uptime_sensor.config.yaml
#text_sensor: text_sensor:
# - <<: !include text_sensor/version_sensor.config.yaml - <<: !include text_sensor/version_sensor.config.yaml
+5 -2
View File
@@ -3,15 +3,18 @@ ethernet:
type: LAN8720 type: LAN8720
mdc_pin: GPIO23 mdc_pin: GPIO23
mdio_pin: GPIO18 mdio_pin: GPIO18
clk_mode: GPIO17_OUT clk:
phy_addr: 0 pin: GPIO17
mode: CLK_OUT
power_pin: GPIO5 power_pin: GPIO5
phy_addr: 0
manual_ip: manual_ip:
static_ip: ${static_ip} static_ip: ${static_ip}
gateway: !secret iot_default_gateway gateway: !secret iot_default_gateway
subnet: !secret iot_subnet_mask subnet: !secret iot_subnet_mask
dns1: !secret iot_default_dns1 dns1: !secret iot_default_dns1
dns2: !secret iot_default_dns2
#text_sensor: #text_sensor:
#- <<: !include text_sensor/ethernet_ip_address.config.yaml #- <<: !include text_sensor/ethernet_ip_address.config.yaml
+10 -10
View File
@@ -27,7 +27,7 @@ sensor:
id: occupied id: occupied
- platform: template - platform: template
name: "${friendly_name} Raw Value" name: "Raw Value"
lambda: |- lambda: |-
return id(hx711_value_raw).raw_state; return id(hx711_value_raw).raw_state;
unit_of_measurement: w unit_of_measurement: w
@@ -35,7 +35,7 @@ sensor:
state_class: measurement state_class: measurement
- platform: template - platform: template
name: "${friendly_name} Auto Tare" name: "Auto Tare"
lambda: |- lambda: |-
return id(auto_tare_difference); return id(auto_tare_difference);
unit_of_measurement: w unit_of_measurement: w
@@ -43,7 +43,7 @@ sensor:
state_class: measurement state_class: measurement
- platform: template - platform: template
name: "${friendly_name} Initial Zero" name: "Initial Zero"
lambda: |- lambda: |-
return id(initial_zero); return id(initial_zero);
unit_of_measurement: w unit_of_measurement: w
@@ -95,7 +95,7 @@ sensor:
# Mapped value to lbs # Mapped value to lbs
- platform: template - platform: template
id: hx711_value id: hx711_value
name: "${friendly_name} Weight" name: "Weight"
internal: False internal: False
filters: filters:
# apply auto_tare difference # apply auto_tare difference
@@ -125,7 +125,7 @@ sensor:
binary_sensor: binary_sensor:
- platform: template - platform: template
device_class: occupancy device_class: occupancy
name: "${friendly_name} Occupied" name: "Occupied"
icon: mdi:bed icon: mdi:bed
lambda: |- lambda: |-
if ( if (
@@ -137,7 +137,7 @@ binary_sensor:
} }
- platform: template - platform: template
name: "${friendly_name} HX711 Error" name: "HX711 Error"
id: hx711_error id: hx711_error
device_class: problem device_class: problem
lambda: |- lambda: |-
@@ -152,7 +152,7 @@ binary_sensor:
switch: switch:
- platform: template - platform: template
id: force_occupancy id: force_occupancy
name: "${friendly_name} Force Occupancy" name: "Force Occupancy"
lambda: |- lambda: |-
return id(occupancy_forced); return id(occupancy_forced);
turn_on_action: turn_on_action:
@@ -166,7 +166,7 @@ switch:
id: auto_tare id: auto_tare
# optimistic: true # optimistic: true
# assumed_state: true # assumed_state: true
name: "${friendly_name} Auto Tare" name: "Auto Tare"
lambda: |- lambda: |-
return id(auto_tare_enabled); return id(auto_tare_enabled);
turn_on_action: turn_on_action:
@@ -179,14 +179,14 @@ switch:
button: button:
- platform: template - platform: template
id: manual_tare id: manual_tare
name: "${friendly_name} Manual Tare" name: "Manual Tare"
on_press: on_press:
- lambda: |- - lambda: |-
id(auto_tare_difference) = id(initial_zero) - id(hx711_value_raw).state; id(auto_tare_difference) = id(initial_zero) - id(hx711_value_raw).state;
- platform: template - platform: template
id: reset_tare id: reset_tare
name: "${friendly_name} Reset Tare" name: "Reset Tare"
on_press: on_press:
- lambda: |- - lambda: |-
id(auto_tare_difference) = 0; id(auto_tare_difference) = 0;
-9
View File
@@ -1,9 +0,0 @@
filters:
- median:
window_size: 5
send_every: 2
send_first_at: 1
- or:
- throttle: 5min
- delta: 1.0
- delta: .1
@@ -1,4 +1,3 @@
platform: wifi_signal platform: wifi_signal
name: ${friendly_name} RSSI name: RSSI
id: ${entity_name}_rssi
update_interval: 60s update_interval: 60s
@@ -1,4 +1,3 @@
platform: uptime platform: uptime
name: ${friendly_name} Uptime name: Uptime
id: ${entity_name}_uptime
disabled_by_default: true disabled_by_default: true
@@ -1,8 +1,7 @@
# Text sensors with general information. # Text sensors with general information.
platform: template platform: template
#ip_address: #ip_address:
name: ${friendly_name} IP name: IP
id: ${entity_name}_ip
icon: mdi:ip-network icon: mdi:ip-network
entity_category: diagnostic entity_category: diagnostic
disabled_by_default: true disabled_by_default: true
@@ -1,8 +1,7 @@
# Text sensors with general information. # Text sensors with general information.
platform: template platform: template
#mac_address: #mac_address:
name: ${friendly_name} Ethernet MAC Address name: Ethernet MAC Address
id: ${entity_name}_ethernet_mac_address
disabled_by_default: true disabled_by_default: true
icon: mdi:network icon: mdi:network
entity_category: diagnostic entity_category: diagnostic
@@ -1,5 +1,6 @@
# platform: version platform: version
# name: ${friendly_name} ESPHome Version name: ESPHome Version
# id: ${entity_name}_version # id: ${entity_name}_version
# hide_timestamp: true hide_timestamp: true
# disabled_by_default: true disabled_by_default: true
icon: mdi:chip
@@ -1,22 +1,18 @@
# Text sensors with general information. # Text sensors with general information.
platform: wifi_info platform: wifi_info
ip_address: ip_address:
name: ${friendly_name} IP name: IP
id: ${entity_name}_ip
icon: mdi:ip icon: mdi:ip
disabled_by_default: true disabled_by_default: true
ssid: ssid:
name: ${friendly_name} SSID name: SSID
id: ${entity_name}_ssid
icon: mdi:lan icon: mdi:lan
disabled_by_default: true disabled_by_default: true
bssid: bssid:
name: ${friendly_name} BSSID name: BSSID
id: ${entity_name}_bssid
disabled_by_default: true disabled_by_default: true
icon: mdi:router-network icon: mdi:router-network
mac_address: mac_address:
name: ${friendly_name} Wifi MAC Address name: Wifi MAC Address
id: ${entity_name}_wifi_mac_address
disabled_by_default: true disabled_by_default: true
icon: mdi:wifi-cog icon: mdi:wifi-cog
@@ -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
+2 -1
View File
@@ -16,7 +16,8 @@ wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails # Enable fallback hotspot (captive portal) in case wifi connection fails
ap: ap:
password: !secret EspHome_AP_PWD ssid: "${friendly_name}"
password: !secret fallback_ap_password
# Enable fast connect # Enable fast connect
fast_connect: true fast_connect: true
+2 -1
View File
@@ -11,7 +11,8 @@ wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails # Enable fallback hotspot (captive portal) in case wifi connection fails
ap: ap:
password: !secret EspHome_AP_PWD ssid: "${friendly_name}"
password: !secret fallback_ap_password
sensor: sensor:
- <<: !include sensor/rssi_sensor.config.yaml - <<: !include sensor/rssi_sensor.config.yaml
+4 -4
View File
@@ -1,9 +1,8 @@
captive_portal: captive_portal:
wifi: wifi:
networks: ssid: !secret Wifi_SSID
- ssid: !secret Wifi_SSID password: !secret Wifi_PWD
password: !secret Wifi_PWD
#- ssid: !secret IoT_Wifi_SSID #- ssid: !secret IoT_Wifi_SSID
# password: !secret IoT_Wifi_PWD # password: !secret IoT_Wifi_PWD
@@ -15,7 +14,8 @@ wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails # Enable fallback hotspot (captive portal) in case wifi connection fails
ap: ap:
password: !secret EspHome_AP_PWD ssid: "${friendly_name}"
password: !secret fallback_ap_password
# Enable fast connect # Enable fast connect
fast_connect: true fast_connect: true
+233
View File
@@ -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();
+4 -30
View File
@@ -36,14 +36,14 @@ esphome:
# Define switches to control LED and buzzer from HA # Define switches to control LED and buzzer from HA
switch: switch:
- platform: template - platform: template
name: "${friendly_name} Buzzer Enabled" name: "Buzzer Enabled"
id: buzzer_enabled id: buzzer_enabled
icon: mdi:volume-high icon: mdi:volume-high
optimistic: true optimistic: true
restore_mode: restore_default_on restore_mode: restore_default_on
entity_category: config entity_category: config
- platform: template - platform: template
name: "${friendly_name} LED enabled" name: "LED enabled"
id: led_enabled id: led_enabled
icon: mdi:alarm-light-outline icon: mdi:alarm-light-outline
optimistic: true optimistic: true
@@ -321,38 +321,12 @@ output:
binary_sensor: binary_sensor:
- platform: gpio - platform: gpio
name: Nursery Door name: Door
device_class: door device_class: door
pin: pin:
mode: INPUT_PULLUP mode: INPUT_PULLUP
number: D5 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 # Define buzzer as output for RTTTL
rtttl: rtttl:
output: buzzer output: buzzer
@@ -366,7 +340,7 @@ light:
flash_transition_length: 500ms flash_transition_length: 500ms
type: GRB type: GRB
id: activity_led id: activity_led
name: "${friendly_name} LED" name: "LED"
restore_mode: ALWAYS_OFF restore_mode: ALWAYS_OFF
+92
View File
@@ -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'
+3 -2
View File
@@ -128,5 +128,6 @@ cards:
cards: cards:
- type: custom:mushroom-title-card - type: custom:mushroom-title-card
subtitle: Cameras subtitle: Cameras
- !include /config/lovelace/cameras/view-camera-06.yaml - !include /config/lovelace/cameras/view-camera-mbr.yaml
- !include /config/lovelace/cameras/view-camera-07.yaml #- !include /config/lovelace/cameras/view-camera-06.yaml
#- !include /config/lovelace/cameras/view-camera-07.yaml