title: Tesla
path: tesla
icon: mdi:car-electric
cards:

  # 🔋 Batteri & Opladning
  - type: vertical-stack
    cards:
      - type: gauge
        entity: sensor.batteri
        name: Batteri
        min: 0
        max: 100
        severity:
          green: 50
          yellow: 20
          red: 0
        unit: '%'

      - type: gauge
        entity: sensor.raekkevidde_km
        name: Rækkevidde
        min: 0
        max: 600
        severity:
          green: 400
          yellow: 150
          red: 0
        unit: 'km'

      - type: entities
        entities:
          - entity: binary_sensor.snowywhite_charging
            name: Oplader nu?
          - entity: sensor.charging_rate_km_h
            name: Ladehastighed (km/t)
          - entity: sensor.energy_added_kwh
            name: Energi tilføjet (kWh)
          - entity: sensor.snowywhite_charger_power
            name: Charger power (kW)
          - entity: sensor.snowywhite_time_charge_complete
            name: Forventet fuld opladning

      - type: horizontal-stack
        cards:
          - type: button
            name: Start opladning
            icon: mdi:flash
            tap_action:
              action: call-service
              service: script.tesla_force_start_charging

          - type: button
            name: Stop opladning
            icon: mdi:flash-off
            tap_action:
              action: call-service
              service: script.tesla_force_stop_charging

  # 🕒 Opladningsplan
  - type: entities
    title: Opladningsplan
    entities:
      - entity: input_boolean.tesla_manual_override
        name: Manuel override
      - entity: binary_sensor.tesla_charge_now
        name: Skal lade nu
      - entity: sensor.tesla_charge_plan
        name: Billigste vindue
      - entity: sensor.tesla_charge_hours_needed
        name: Timer nødvendige
      - entity: input_datetime.tesla_charge_deadline
        name: Klar senest
      - entity: input_datetime.tesla_last_start
        name: Sidste start
      - entity: number.snowywhite_charge_limit
        name: Lademål
      - entity: binary_sensor.snowywhite_charger
        name: Tilsluttet lader

  # 📈 Faktisk opladning
  - type: history-graph
    title: Faktisk opladning sidste 24 timer
    entities:
      - entity: sensor.charging_numeric
        name: Lader nu
      - entity: sensor.charging_rate_km_h
        name: Ladehastighed
      - entity: sensor.energy_added_kwh
        name: Energi tilføjet
    hours_to_show: 24
    refresh_interval: 60

  # 🚗 Døre & Lås
  - type: entities
    title: Døre & Lås
    entities:
      - binary_sensor.snowywhite_doors
      - binary_sensor.snowywhite_windows
      - binary_sensor.snowywhite_parking_brake
      - binary_sensor.snowywhite_user_present
      - sensor.snowywhite_shift_state

  # 🌡️ Temperatur
  - type: horizontal-stack
    cards:
      - type: sensor
        entity: sensor.snowywhite_temperature_inside
        name: Inde (°C)
      - type: sensor
        entity: sensor.snowywhite_temperature_outside
        name: Ude (°C)

  # 📍 Lokation / Ankomst
  - type: entities
    title: Ankomst / Distance
    entities:
      - sensor.snowywhite_arrival_time
      - sensor.snowywhite_distance_to_arrival

  # 🔧 Vedligeholdelse / Alerts
  - type: entities
    title: Vedligeholdelse / Alerts
    entities:
      - sensor.snowywhite_tpms_front_left
      - sensor.snowywhite_tpms_front_right
      - sensor.snowywhite_tpms_rear_left
      - sensor.snowywhite_tpms_rear_right
      - sensor.snowywhite_data_last_update_time
