diff --git a/include/automations/tesla_deadline.yaml b/include/automations/tesla_deadline.yaml new file mode 100644 index 0000000..85df104 --- /dev/null +++ b/include/automations/tesla_deadline.yaml @@ -0,0 +1,35 @@ +- alias: Tesla set charge deadline at 13:00 + id: tesla_set_charge_deadline_daily + trigger: + - platform: time + at: "13:05:00" + + action: + - service: input_datetime.set_datetime + target: + entity_id: input_datetime.tesla_charge_deadline + data: + datetime: > + {{ (now() + timedelta(days=1)) + .replace(hour=7, minute=0, second=0, microsecond=0) }} + + mode: single + + +- alias: Tesla set charge deadline when plugged in + id: tesla_set_charge_deadline_on_plug + trigger: + - platform: state + entity_id: binary_sensor.snowywhite_charger + to: "on" + + action: + - service: input_datetime.set_datetime + target: + entity_id: input_datetime.tesla_charge_deadline + data: + datetime: > + {{ (now() + timedelta(days=1)) + .replace(hour=7, minute=0, second=0, microsecond=0) }} + + mode: single