substitutions:
  name: "car-charger"
  friendly_name: "Car charger"

esphome:
  area: "Garage"

packages:
  device_base: !include templates/mystrom.yaml
  time: !include templates/time.yaml

switch:
  - platform: template
    name: "Failsafe schedule"
    id: failsafe_schedule
    restore_mode: RESTORE_DEFAULT_ON
    optimistic: true

time:
- platform: sntp
  id: sntp_time
  servers: !secret sntp_servers
  timezone: Europe/Zurich
  on_time:
    - seconds: 0
      minutes: 1
      hours: 0-6,19-23
      then:
        - if:
            condition:
              - switch.is_on: failsafe_schedule
              - switch.is_off: mystrom_relay
            then:
              - logger.log: >-
                  Power relay is off during T2, assuming automation failure and
                  correcting
              - switch.turn_on: mystrom_relay
