diff --git a/include/automations/tesla_charge_failsafe.yaml b/include/automations/tesla_charge_failsafe.yaml index fdeb39d..7e71e44 100644 --- a/include/automations/tesla_charge_failsafe.yaml +++ b/include/automations/tesla_charge_failsafe.yaml @@ -1,12 +1,15 @@ - alias: Tesla failsafe charge trigger: - - platform: template + - 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 }} # 1 time = 3600 sekunder + {{ (deadline_ts - now_ts) <= 3600 }} - condition: - condition: numeric_state entity_id: sensor.tesla_kwh_needed above: 0 @@ -14,4 +17,4 @@ action: - service: switch.turn_on target: - entity_id: switch.home_charging \ No newline at end of file + entity_id: switch.home_charging