yaml tidyups and warning removals

This commit is contained in:
root
2026-01-24 14:06:52 +13:00
parent 9bbde16d8d
commit c104187d62
44 changed files with 391 additions and 124 deletions
+8 -4
View File
@@ -108,16 +108,18 @@ esphome:
# Restore "Last Trip" text from persisted epoch (if any)
- lambda: |-
if (id(last_trip_epoch) > 0) {
auto t = time::ESPTime::from_epoch_local(id(last_trip_epoch));
time_t tt = (time_t) id(last_trip_epoch);
struct tm tm;
localtime_r(&tt, &tm);
char buf[24];
t.strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S");
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
id(ts_last_trip).publish_state(buf);
} else {
id(ts_last_trip).publish_state("Never");
}
# Apply Power Restore Mode selector (Always ON / Always OFF / Previous State)
- lambda: |-
std::string mode = id(sel_restore_mode).state;
std::string mode = id(sel_restore_mode).current_option();
if (mode == "Always ON") {
id(relay_virtual).turn_on();
} else if (mode == "Always OFF") {
@@ -151,6 +153,7 @@ status_led:
pin:
number: GPIO8
inverted: true
ignore_strapping_warning: true # GPIO08: This just supresses a warning, we know what we are doing
##########################################################################################
# UART BUS
@@ -550,6 +553,7 @@ binary_sensor:
number: GPIO9
mode: INPUT_PULLUP
inverted: true
ignore_strapping_warning: true # GPIO09: This just supresses a warning, we know what we are doing
name: "${button_1_name}"
on_press:
- switch.toggle: relay_virtual
@@ -743,7 +747,7 @@ script:
if (f > 1.0f) f = 1.0f;
int slow_ms = ${led_flash_slow_ms};
int fast_ms = ${led_flash_fast_ms};
if (slow_ms < fast_ms) { int t = slow_ms; slow_ms = fast_ms; fast_ms = t; } # ensure slow >= fast
if (slow_ms < fast_ms) { int t = slow_ms; slow_ms = fast_ms; fast_ms = t; } // ensure slow >= fast
int period = slow_ms - (int)((slow_ms - fast_ms) * f);
id(_blink_period_ms) = period;
# Blink with 50% duty cycle at the computed period