more small fixes and consolidating the driveway

This commit is contained in:
CeeWeasel
2025-07-20 16:39:50 -04:00
parent 0baf98f917
commit ca1082899b
25 changed files with 254 additions and 540 deletions
+82 -60
View File
@@ -11,11 +11,10 @@ substitutions:
sda_pin: GPIO21
scl_pin: GPIO22
door_pin: GPIO19
one_wire_pin: GPIO14
trigger_pin: GPIO04
echo_pin: GPIO12
echo_pin: GPIO13
#mdc_pin: GPIO23
#mdio_pin: GPIO18
#clk_mode: GPIO17_OUT
@@ -30,14 +29,35 @@ packages:
esphome:
name: ${devicename}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
on_boot:
- priority: -100
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
@@ -46,6 +66,11 @@ 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
@@ -65,27 +90,12 @@ i2c:
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"
name: "Return"
id: hvac_return
icon: mdi:home-thermometer-outline
update_interval: 10s
filters:
- lambda: return x * (9.0/5.0) + 32.0;
@@ -94,8 +104,9 @@ sensor:
- platform: dallas_temp
address: 0x0F3C01B6070C1328
name: "Supply Temperature"
name: "Supply"
id: hvac_supply
icon: mdi:thermostat
update_interval: 10s
filters:
- lambda: return x * (9.0/5.0) + 32.0;
@@ -104,8 +115,9 @@ sensor:
- platform: dallas_temp
address: 0xFA3C01B607005B28
name: "Ambient Temperature"
name: "Ambient"
id: ambient
icon: mdi:home-thermometer
update_interval: 10s
filters:
- lambda: return x * (9.0/5.0) + 32.0;
@@ -113,8 +125,9 @@ sensor:
state_class: measurement
- platform: template
name: "Delta Temperature"
name: "Delta"
id: hvac_delta
icon: mdi:thermometer-lines
lambda: |-
return (id(hvac_supply).state - id(hvac_return).state);
update_interval: 10s
@@ -151,6 +164,8 @@ sensor:
state_class: measurement
id: distance_from_bottom
name: "Salt Level in CM"
icon: mdi:arrow-collapse-up
disabled_by_default: true
#update_interval: 5s
filters:
- lambda: 'return (0.94 - (id(ultrasonic_source).state)) * 100;'
@@ -165,6 +180,8 @@ sensor:
state_class: measurement
id: distance_from_top
name: "Salt Level From Top in CM"
icon: mdi:arrow-collapse-down
disabled_by_default: true
#update_interval: 5s
filters:
- lambda: 'return (id(ultrasonic_source).state) * 100;'
@@ -174,49 +191,54 @@ sensor:
state_class: measurement
id: level_in_bags
name: "Salt Level in Bags"
icon: mdi:counter
disabled_by_default: true
#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:
number: ${door_pin}
mode: INPUT_PULLUP
pin: ${door_pin}
filters:
- invert:
- 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();
# switch:
# - platform: template
# id: display_switch
# name: "Display"
# lambda: |-
# if (id(oled_enabled)) {
# 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();