sponsortoken: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODEzODIyNTYsImlhdCI6MTY4Njc3NDI1NiwiaXNzIjoiZXZjYy5pbyIsInN1YiI6Im1pbHZlcnQifQ.HUEmc0NSPt9x5MbOHUAGU6bp3H3E3qwu6O6BAHH9FvE

log: error
#levels:
#  car: trace

interval: 30s

vehicles:
  - name: car
    type: custom
    title: id4
    capacity: 79 # kWh
    soc:
      source: mqtt
      topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/domains/charging/batteryStatus/currentSOC_pct
    range:
      source: mqtt
      topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/domains/fuelStatus/rangeStatus/primaryEngine/remainingRange_km
    odometer:
      source: mqtt
      topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/domains/measurements/odometerStatus/odometer
    climater:
      source: go
      vm: shared
      script: |
        remoteClimateState != "off"
      in:
        - name: remoteClimateState
          type: string
          config:
            source: mqtt
            topic: weconnect/0/vehicles/WVGZZZE2ZPE051949/domains/climatisation/climatisationStatus/climatisationState


chargers:
  - name: wallbox
    type: easee
    user: simon+easee@milvert.com
    password: X7#aEzjlEysBgl
    charger: EHCNF485

loadpoints:
  - title: Garage
    charger: wallbox
    vehicle: car
    mode: pv
    phases: 3
    mincurrent: 6
    maxcurrent: 16
    enable:
      threshold: 0
      delay: 15s
    disable:
      threshold: 500
      delay:
        2m

site:
  title: Hemma
  meters:
    pv:
      - pv
    grid: my_grid

meters:
  - name: pv
    type: custom
    power:
      source: mqtt
      topic: inverter/measure/active_power
      # jq: .value
    energy:
      source: mqtt
      topic: inverter/calculated/accumulated_yield_energy
      # jq: .value
      timeout: 1h
    currents:
      - source: mqtt
        topic: inverter/measure/phase_A_current
        #  jq: .value
      - source: mqtt
        topic: inverter/measure/phase_B_current
        # jq: .value
      - source: mqtt
        topic: inverter/measure/phase_C_current
        # jq: .value

  - name: my_grid
    type: custom
    power:
      source: calc
      add:
       - source: mqtt
         topic: dsmr/reading/electricity_currently_returned
         scale: -1000
       - source: mqtt
         topic: dsmr/reading/electricity_currently_delivered
         scale: 1000
    energy:
      source: calc
      add:
       - source: mqtt
         topic: dsmr/reading/electricity_returned_1
         scale: 0.001
       - source: mqtt
         topic: dsmr/reading/electricity_delivered_1
         scale: -0.001

    currents:
      - source: calc
        add:
        - source: mqtt
          topic: dsmr/reading/phase_currently_delivered_l1
          scale: -1
        - source: mqtt
          topic: dsmr/reading/phase_currently_returned_l1
      - source: calc
        add:
        - source: mqtt
          topic: dsmr/reading/phase_currently_delivered_l2
          scale: -1
        - source: mqtt
          topic: dsmr/reading/phase_currently_returned_l2
      - source: calc
        add:
        - source: mqtt
          topic: dsmr/reading/phase_currently_delivered_l3
          scale: -1
        - source: mqtt
          topic: dsmr/reading/phase_currently_returned_l3

influx:
  url: http://influx:8086
  database: Car
  token: H7m068KDh84kcmmkz3fy-dEsKoeYv90rnNXIidPZoBy240Jzdbr2uDtGveiuDz4rGK4jmMI8J00zVwgIBYJxXA==
  org: milvert

mqtt:
  broker: mqtt:1883
  user: simon
  password: bajsa123
  topic: evcc
