# Wegwerf-Testinstanz fuer DataMetric360.
# Bildet die Entitaeten der HACS-Integration TommiG1/HA_VAG-EU-Data-Act nach,
# damit das pyscript-Backend echte Werte sieht. Ueber die input_*-Helfer sind
# die Werte zur Laufzeit aenderbar (Fahrterkennung, Reifenzaehler, Tankerkennung
# haengen an @state_trigger).

default_config:

# Die App laeuft unter einer anderen Adresse als Home Assistant. Ohne diese
# Freigabe lehnt der Browser jede Anfrage ab, noch bevor sie den Server
# erreicht (CORS). Gilt genauso im Echtbetrieb - siehe
# ../homeassistant/REVERSE_PROXY.md.
http:
  cors_allowed_origins:
    - http://localhost:4173      # Vorschau des Produktionsbuendels
    - http://localhost:5173      # Entwicklungsserver
    - capacitor://localhost      # native Huelle iOS
    - ionic://localhost          # native Huelle Android

pyscript:
  allow_all_imports: true

panel_custom:
  - name: audi-dashboard-panel
    sidebar_title: Mein Audi
    sidebar_icon: mdi:car-sports
    module_url: /local/audi-dashboard-panel.js?v=1
    embed_iframe: false
    trust_external_script: false

input_number:
  test_kilometerstand:
    name: Test Kilometerstand
    min: 0
    max: 999999
    step: 1
    initial: 48250
    mode: box
  test_tankfuellstand:
    name: Test Tankfuellstand
    min: 0
    max: 100
    step: 1
    initial: 62
    mode: box
  test_reichweite:
    name: Test Reichweite
    min: 0
    max: 1200
    step: 1
    initial: 385
    mode: box

input_text:
  test_wlan:
    name: Test WLAN
    initial: Zuhause
    max: 60

input_boolean:
  test_tuer_vl:
    name: Test Tuer vorne links
  test_fenster_vl:
    name: Test Fenster vorne links
  test_entriegelt:
    name: Test entriegelt

template:
  - sensor:
      - name: "iPhone WiFi Connection"
        unique_id: test_iphone_wifi
        state: "{{ states('input_text.test_wlan') }}"
      - name: "Audi RS 4 Avant Mileage"
        unique_id: test_audi_mileage
        state: "{{ states('input_number.test_kilometerstand') | int(0) }}"
        unit_of_measurement: km
        state_class: total_increasing
      - name: "Audi RS 4 Avant Fuel Level"
        unique_id: test_audi_fuel
        state: "{{ states('input_number.test_tankfuellstand') | int(0) }}"
        unit_of_measurement: "%"
      - name: "Audi RS 4 Avant Range Primary"
        unique_id: test_audi_range
        state: "{{ states('input_number.test_reichweite') | int(0) }}"
        unit_of_measurement: km
      - name: "Audi RS 4 Avant Oil Change Due"
        unique_id: test_audi_oil_due
        state: "2027-03-14T00:00:00+00:00"
        device_class: timestamp
      - name: "Audi RS 4 Avant Oil Change Distance"
        unique_id: test_audi_oil_dist
        state: "-11750"
        unit_of_measurement: km
      - name: "Audi RS 4 Avant Inspection Due"
        unique_id: test_audi_insp_due
        state: "2027-03-14T00:00:00+00:00"
        device_class: timestamp
      - name: "Audi RS 4 Avant Inspection Distance"
        unique_id: test_audi_insp_dist
        state: "-11750"
        unit_of_measurement: km
  - binary_sensor:
      - name: "Audi RS 4 Avant Front Left Door"
        unique_id: test_audi_door_fl
        state: "{{ is_state('input_boolean.test_tuer_vl', 'on') }}"
        device_class: door
      - name: "Audi RS 4 Avant Front Right Door"
        unique_id: test_audi_door_fr
        state: "off"
        device_class: door
      - name: "Audi RS 4 Avant Rear Left Door"
        unique_id: test_audi_door_rl
        state: "off"
        device_class: door
      - name: "Audi RS 4 Avant Rear Right Door"
        unique_id: test_audi_door_rr
        state: "off"
        device_class: door
      - name: "Audi RS 4 Avant Front Left Window"
        unique_id: test_audi_win_fl
        state: "{{ is_state('input_boolean.test_fenster_vl', 'on') }}"
        device_class: window
      - name: "Audi RS 4 Avant Front Right Window"
        unique_id: test_audi_win_fr
        state: "off"
        device_class: window
      - name: "Audi RS 4 Avant Rear Left Window"
        unique_id: test_audi_win_rl
        state: "off"
        device_class: window
      - name: "Audi RS 4 Avant Rear Right Window"
        unique_id: test_audi_win_rr
        state: "off"
        device_class: window
      - name: "Audi RS 4 Avant Front Left Door Lock"
        unique_id: test_audi_lock_fl
        state: "{{ is_state('input_boolean.test_entriegelt', 'on') }}"
        device_class: lock
      - name: "Audi RS 4 Avant Front Right Door Lock"
        unique_id: test_audi_lock_fr
        state: "off"
        device_class: lock
      - name: "Audi RS 4 Avant Rear Left Door Lock"
        unique_id: test_audi_lock_rl
        state: "off"
        device_class: lock
      - name: "Audi RS 4 Avant Rear Right Door Lock"
        unique_id: test_audi_lock_rr
        state: "off"
        device_class: lock
      - name: "Audi RS 4 Avant Tailgate"
        unique_id: test_audi_tailgate
        state: "off"
        device_class: door
      - name: "Audi RS 4 Avant Tailgate Lock"
        unique_id: test_audi_tailgate_lock
        state: "off"
        device_class: lock
      - name: "Audi RS 4 Avant Hood"
        unique_id: test_audi_hood
        state: "off"
        device_class: door
      - name: "Audi RS 4 Avant Hood Lock"
        unique_id: test_audi_hood_lock
        state: "off"
        device_class: lock

input_button:
  test_refresh:
    name: Test Refresh Now
