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: blueprint:
name: Smart Battery Charging - Reusable Controller name: Smart Battery Charging - Reusable Controller
description: >- 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. critical-battery response, fault notifications, and diagnostics.
Verify the switch and battery sensor before enabling real switching. Verify the switch and battery sensor before enabling real switching.
Temperature thresholds apply to battery temperature in Celsius, not room temperature. 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 domain: automation
input: input:
battery_sensor: battery_sensor:
@ -53,6 +58,9 @@ blueprint:
mode: box mode: box
max_sensor_age: max_sensor_age:
name: Maximum battery sensor update age (minutes; 0 disables) 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 default: 180
selector: selector:
number: number:
@ -128,6 +136,9 @@ blueprint:
mode: slider mode: slider
enable_fault_notifications: enable_fault_notifications:
name: Create Home Assistant persistent 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 default: true
selector: selector:
boolean: {} boolean: {}
@ -264,7 +275,10 @@ actions:
message: >- message: >-
{{ fault_reason | trim }}. Battery={{ battery_raw }}%, {{ fault_reason | trim }}. Battery={{ battery_raw }}%,
temperature={{ temperature_c if temperature_enabled | bool(false) else 'not configured' }}, 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: - if:
- condition: template - condition: template
value_template: "{{ notifications_enabled | bool(false) and not fault | bool(false) }}" value_template: "{{ notifications_enabled | bool(false) and not fault | bool(false) }}"
@ -277,7 +291,7 @@ actions:
- condition: template - condition: template
value_template: >- value_template: >-
{{ logging_enabled | bool(false) and {{ logging_enabled | bool(false) and
(fault | bool(false) or desired_action | trim != 'hold') }} desired_action | trim != 'hold' }}
then: then:
- action: logbook.log - action: logbook.log
data: data: