Battery low management

This commit is contained in:
2026-04-09 10:42:28 +02:00
parent 383a48cdf5
commit 8b64c0a986

View File

@@ -34,8 +34,11 @@ esp8266:
board: d1_mini_lite board: d1_mini_lite
# Enable logging (for development) # Enable logging (for development)
# NOTE: Logs on the same pin of addressable leds, so may display wrong colors when enabled
# logger: # logger:
deep_sleep:
api: api:
reboot_timeout: 0s reboot_timeout: 0s
@@ -109,6 +112,11 @@ sensor:
- 850.0 -> 100.0 - 850.0 -> 100.0
- min: - min:
send_first_at: 3 send_first_at: 3
on_value_range:
- below: 5.0
then:
- script.execute: battery_low
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm
@@ -245,3 +253,23 @@ script:
default: default:
return "mario:d=4,o=5,b=100:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6"; return "mario:d=4,o=5,b=100:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6";
} }
- id: battery_low
then:
- logger.log: "Executing Battery Low script"
# Turn lughts on red
- light.turn_on:
id: hexagon_sections
brightness: 100%
red: 100%
green: 0%
blue: 0%
- delay: 1s
# Play battery low tune
- rtttl.play:
rtttl: Battery Low:d=8,o=6,b=600:c6,p,c5,p,2c4
- delay: 5s
- light.turn_off: hexagon_sections
- delay: 1s
# Suspend device to avoid draining battery
- deep_sleep.enter: