Update automation/Battery_control/smart_battery_charging.yaml

-added temeprature safety v4
This commit is contained in:
Dejan 2026-10-26 05:43:31 +00:00
parent 1abb00bc35
commit 07923142e1

View file

@ -1,10 +1,15 @@
blueprint:
name: Smart Battery Charging - Reusable Controller
description: >-
v3: Reusable charging controller with optional battery temperature protection,
v4: Notify-only offline policy, optional battery temperature protection,
critical-battery response, fault notifications, and diagnostics.
Verify the switch and battery sensor before enabling real switching.
Temperature thresholds apply to battery temperature in Celsius, not room temperature.
Offline or stale battery telemetry never automatically restores charging.
When telemetry is invalid, the existing power-switch state is preserved,
except that unsafe or invalid configured temperature forces charging OFF.
Inspect the device manually before restoring power.
Battery temperature is ignored completely when no sensor is configured.
domain: automation
input:
battery_sensor:
@ -53,6 +58,9 @@ blueprint:
mode: box
max_sensor_age:
name: Maximum battery sensor update age (minutes; 0 disables)
description: >-
Stale battery telemetry raises a notification and blocks normal charging
commands. It never automatically turns power back on.
default: 180
selector:
number:
@ -128,6 +136,9 @@ blueprint:
mode: slider
enable_fault_notifications:
name: Create Home Assistant persistent fault notifications
description: >-
Notify on missing or stale battery telemetry, invalid temperature,
unavailable switch, or invalid charging thresholds.
default: true
selector:
boolean: {}
@ -264,7 +275,10 @@ actions:
message: >-
{{ fault_reason | trim }}. Battery={{ battery_raw }}%,
temperature={{ temperature_c if temperature_enabled | bool(false) else 'not configured' }},
switch={{ switch_state }}. Check device and Home Assistant.
switch={{ switch_state }}. Offline policy: notify only; no automatic
power restoration. Inspect the device and restore power manually
if safe. If a configured temperature sensor is invalid or outside
the safe range, charging is forced OFF.
- if:
- condition: template
value_template: "{{ notifications_enabled | bool(false) and not fault | bool(false) }}"
@ -277,7 +291,7 @@ actions:
- condition: template
value_template: >-
{{ logging_enabled | bool(false) and
(fault | bool(false) or desired_action | trim != 'hold') }}
desired_action | trim != 'hold' }}
then:
- action: logbook.log
data: