mqtt:
  select:
    - name: evcc_mode
      unique_id: uniqueid__evcc_mode_select
      icon: mdi:tune-variant
      state_topic: "evcc/loadpoints/1/mode"
      command_topic: "evcc/loadpoints/1/mode/set"
      availability_topic: "evcc/status"
      options:
        - "off"
        - "now"
        - "minpv"
        - "pv"

  #############################################################################

  sensor:
    - name: evcc_charge_power_w
      unique_id: uniqueid__evcc_charge_power_w
      icon: mdi:car-electric
      state_topic: "evcc/loadpoints/1/chargePower"
      value_template: "{{ value | round(0) }}"
      unit_of_measurement: "W"
      state_class: measurement
      availability_topic: "evcc/status"

    - name: evcc_charged_energy_kwh
      unique_id: uniqueid__evcc_charged_energy_kwh
      icon: mdi:battery-charging-high
      state_topic: "evcc/loadpoints/1/chargedEnergy"
      value_template: "{{ (value | float / 1000) | round(4) }}"
      unit_of_measurement: "kWh"
      availability_topic: "evcc/status"

    - name: evcc_remaining_energy_kwh
      unique_id: uniqueid_evcc_remaining_energy_kwh
      icon: mdi:battery-charging-high
      state_topic: "evcc/loadpoints/1/chargeRemainingEnergy"
      value_template: "{{ (value | float / 1000) | round(4) }}"
      unit_of_measurement: "kWh"
      availability_topic: "evcc/status"


    - name: evcc_total_charged_energy_grid_kwh
      unique_id: uniqueid__evcc_total_charged_energy_grid_kwh
      icon: mdi:battery-charging-high
      state_topic: "evcc/site/statistics/total/chargedKWh"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "kWh"
      availability_topic: "evcc/status"
      device_class: "energy"
      state_class: "total_increasing"

    #############################################################################

    - name: evcc_phases_active
      unique_id: uniqueid__evcc_phases_active
      icon: mdi:backburger
      state_topic: "evcc/loadpoints/1/phasesActive"
      value_template: "{{ value | round(0) }}"
      availability_topic: "evcc/status"

    - name: evcc_charge_duration_s
      unique_id: uniqueid__evcc_charge_duration_s
      icon: mdi:timer-settings-outline
      state_topic: "evcc/loadpoints/1/chargeDuration"
      value_template: "{{ value | round(0) }}"
      unit_of_measurement: "s"
      availability_topic: "evcc/status"

    #############################################################################

    - name: evcc_charge_current_l1_a
      unique_id: uniqueid__evcc_charge_current_l1_a
      icon: mdi:current-ac
      state_topic: "evcc/loadpoints/1/chargeCurrents/l1"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "A"
      availability_topic: "evcc/status"

    - name: evcc_charge_current_l2_a
      unique_id: uniqueid__evcc_charge_current_l2_a
      icon: mdi:current-ac
      state_topic: "evcc/loadpoints/1/chargeCurrents/l2"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "A"
      availability_topic: "evcc/status"

    - name: evcc_charge_current_l3_a
      unique_id: uniqueid__evcc_charge_current_l3_a
      icon: mdi:current-ac
      state_topic: "evcc/loadpoints/1/chargeCurrents/l3"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "A"
      availability_topic: "evcc/status"

    #############################################################################

    - name: evcc_pv_power_w
      unique_id: uniqueid__evcc_pc_power_w
      icon: mdi:home-lightning-bolt-outline
      state_topic: "evcc/site/pvPower"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "W"
      availability_topic: "evcc/status"

    - name: evcc_vehicle_soc
      unique_id: uniqueid__evcc_vehicle_soc
      icon: mdi:home-lightning-bolt-outline
      state_topic: "evcc/loadpoints/1/vehicleSoc"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "%"
      availability_topic: "evcc/status"
    
    - name: evcc_grid_power_w
      unique_id: uniqueid__evcc_grid_power_w
      icon: mdi:home-lightning-bolt-outline
      state_topic: "evcc/site/gridPower"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "W"
      availability_topic: "evcc/status"

    - name: evcc_home_power_w
      unique_id: uniqueid__evcc_home_power_w
      icon: mdi:home-lightning-bolt-outline
      state_topic: "evcc/site/homePower"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "W"
      availability_topic: "evcc/status"

    #############################################################################

    - name: evcc_savings_self_consumption_percent
      unique_id: uniqueid__evcc_savings_self_consumption_percent
      icon: mdi:cash-multiple
      state_topic: "evcc/site/savingsSelfConsumptionPercent"
      value_template: "{{ value | round(1) }}"
      unit_of_measurement: "%"
      availability_topic: "evcc/status"

    #############################################################################

  binary_sensor:
    - name: evcc_loadpoint_enabled
      unique_id: uniqueid__evcc_loadpoint_enabled
      icon: mdi:ev-station
      state_topic: "evcc/loadpoints/1/enabled"
      payload_on: "true"
      payload_off: "false"
      #device_class: problem
      availability_topic: "evcc/status"

    - name: evcc_loadpoint_connected
      unique_id: uniqueid__evcc_loadpoint_connected
      icon: mdi:ev-station
      state_topic: "evcc/loadpoints/1/connected"
      payload_on: "true"
      payload_off: "false"
      #device_class: problem
      availability_topic: "evcc/status"

    - name: evcc_loadpoint_charging
      unique_id: uniqueid__evcc_loadpoint_charging
      icon: mdi:ev-station
      state_topic: "evcc/loadpoints/1/charging"
      payload_on: "true"
      payload_off: "false"
      #device_class: problem
      availability_topic: "evcc/status"

  #############################################################################

  number:
    

    - name: evcc_target_soc
      unique_id: uniqueid__evcc_target_soc
      icon: mdi:current-ac
      state_topic: "evcc/loadpoints/1/targetSoc"
      command_topic: "evcc/loadpoints/1/targetSoc/set"
      availability_topic: "evcc/status"
      min: 0
      max: 100
      step: 1
      unit_of_measurement: "%"

    - name: evcc_max_current
      unique_id: uniqueid__evcc_max_current
      icon: mdi:current-ac
      state_topic: "evcc/loadpoints/1/maxCurrent"
      command_topic: "evcc/loadpoints/1/maxCurrent/set"
      availability_topic: "evcc/status"
      min: 6
      max: 16
      step: 0.25
      unit_of_measurement: "A"

    - name: evcc_residual_power
      unique_id: uniqueid__evcc_residual_power
      icon: mdi:label-percent-outline
      state_topic: "evcc/site/residualPower"
      command_topic: "evcc/site/residualPower/set"
      availability_topic: "evcc/status"
      min: -5000
      max: +5000
      unit_of_measurement: "W"

#############################################################################
homeassistant:
  customize:
    number.evcc_min_current:
      friendly_name: "Garage Wallbox Min Ström"
    select.evcc_mode:
      friendly_name: "Laddbox  mode"

