Files
N22/include/automations/tesla_charge_failsafe.yaml
T
claus 5a9db0b8c2 improve(automation): increase reliability of tesla charging control
- Change mode to restart to prevent skipped runs
- Replace failsafe template trigger with time_pattern
- Add plugged-in condition to avoid unnecessary switching
- Add explicit deadline validation condition

Result:
- More reliable execution of charging logic
- Prevents missed failsafe activation
- Reduces unnecessary charger toggling
2026-03-17 06:18:50 +01:00

21 lines
523 B
YAML

- alias: Tesla failsafe charge
trigger:
- platform: time_pattern
minutes: "/5"
condition:
- condition: template
value_template: >
{% set deadline_ts = as_timestamp(states('input_datetime.tesla_charge_deadline')) %}
{% set now_ts = as_timestamp(now()) %}
{{ (deadline_ts - now_ts) <= 3600 }}
- condition: numeric_state
entity_id: sensor.tesla_kwh_needed
above: 0
action:
- service: switch.turn_on
target:
entity_id: switch.home_charging