name: EV charger
products:
  - id: xp3yag6huzpatstp
    manufacturer: SEVR
    model: X1 7kW
entities:
  - entity: sensor
    translation_key: status
    class: enum
    icon: "mdi:ev-station"
    dps:
      - id: 3
        type: string
        name: sensor
        mapping:
          - dps_val: charger_free
            value: available
          - dps_val: charger_insert
            value: plugged_in
          - dps_val: charger_free_fault
            value: fault_unplugged
          - dps_val: charger_wait
            value: waiting
          - dps_val: charger_charging
            value: charging
          - dps_val: charger_pause
            value: paused
          - dps_val: charger_end
            value: charged
          - dps_val: charger_fault
            value: fault
      - id: 23
        type: string
        name: system_version
      - id: 33
        type: string
        optional: true
        name: mode_set
  - entity: sensor
    class: energy
    dps:
      - id: 1
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
  - entity: number
    name: Charge current
    category: config
    class: current
    dps:
      - id: 4
        type: integer
        name: value
        unit: A
        range:
          min: 6
          max: 32
  - entity: sensor
    name: Phase A power
    class: power
    category: diagnostic
    hidden: true
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: kW
        mask: "0000000000FFFFFF"
        mapping:
          - scale: 1000
  - entity: sensor
    class: voltage
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: V
        mask: "FFFF000000000000"
        mapping:
          - scale: 10
  - entity: sensor
    class: current
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: A
        mask: "0000FFFFFF000000"
        mapping:
          - scale: 1000
  - entity: sensor
    class: power
    category: diagnostic
    dps:
      - id: 9
        type: integer
        name: sensor
        optional: true
        unit: kW
        class: measurement
        mapping:
          - scale: 1000
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 10
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 10
        type: bitfield
        name: fault_code
  - entity: text
    name: Alarm set 1
    category: config
    icon: "mdi:alarm"
    hidden: true
    dps:
      - id: 11
        type: string
        optional: true
        name: value
  - entity: text
    name: Alarm set 2
    category: config
    icon: "mdi:alarm"
    hidden: true
    dps:
      - id: 12
        type: string
        optional: true
        name: value
  - entity: sensor
    name: Connection state
    class: enum
    icon: "mdi:ev-plug-type2"
    category: diagnostic
    dps:
      - id: 13
        type: string
        name: sensor
        mapping:
          - dps_val: controlpi_12v
            value: Standby
          - dps_val: controlpi_12v_pwm
            value: Communication initialising
          - dps_val: controlpi_9v
            value: Vehicle detected
          - dps_val: controlpi_9v_pwm
            value: Vehicle connected
          - dps_val: controlpi_6v
            value: Ready to charge
          - dps_val: controlpi_6v_pwm
            value: Charging
          - dps_val: controlpi_error
            value: Error
  - entity: select
    translation_key: charging_mode
    category: config
    dps:
      - id: 14
        type: string
        name: option
        mapping:
          - dps_val: charge_now
            value: immediate
          - dps_val: charge_pct
            value: charge_to_percent
          - dps_val: charge_energy
            value: fixed_charge
          - dps_val: charge_schedule
            value: scheduled_charge
          - dps_val: charge_delay
            value: delayed_charge
  - entity: sensor
    name: Energy remaining
    class: energy_storage
    category: diagnostic
    dps:
      - id: 15
        type: integer
        name: sensor
        unit: kWh
        class: measurement
        mapping:
          - scale: 100
  - entity: number
    name: Charge energy
    category: config
    class: energy_storage
    dps:
      - id: 17
        type: integer
        optional: true
        name: value
        unit: kWh
        range:
          min: 1
          max: 2000000
        mapping:
          - scale: 100
      - id: 14
        type: string
        name: available
        mapping:
          - dps_val: charge_energy
            value: true
          - value: false
  - entity: switch
    icon: "mdi:power"
    dps:
      - id: 18
        type: boolean
        name: switch
  - entity: number
    name: Charging period start
    category: config
    icon: "mdi:clock-start"
    dps:
      - id: 19
        type: hex
        optional: true
        name: value
        mask: "FF00"
        unit: h
        range:
          min: 0
          max: 24
      - id: 14
        type: string
        name: available
        mapping:
          - dps_val: charge_schedule
            value: true
          - value: false
  - entity: number
    name: Charging period end
    category: config
    icon: "mdi:clock-end"
    dps:
      - id: 19
        type: hex
        optional: true
        name: value
        mask: "00FF"
        unit: h
        range:
          min: 0
          max: 24
      - id: 14
        type: string
        name: available
        mapping:
          - dps_val: charge_schedule
            value: true
          - value: false
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 24
        type: integer
        name: sensor
        unit: C
        class: measurement
  - entity: sensor
    name: Last charge
    category: diagnostic
    dps:
      - id: 25
        type: integer
        optional: true
        name: sensor
        unit: kWh
        mapping:
          - scale: 100
  - entity: switch
    category: config
    name: Live updates
    icon: "mdi:chart-bar"
    dps:
      - id: 27
        type: string
        name: switch
        mapping:
          - dps_val: online
            value: true
          - dps_val: offline
            value: false
          - value: false
            hidden: true
  - entity: number
    name: Delay
    class: duration
    category: config
    dps:
      - id: 28
        type: integer
        optional: true
        name: value
        unit: h
        range:
          min: 0
          max: 12
      - id: 14
        type: string
        name: available
        mapping:
          - dps_val: charge_delay
            value: true
          - value: false
  - entity: number
    name: Load balancing limit
    category: config
    icon: "mdi:scale-balance"
    dps:
      - id: 102
        type: integer
        name: value
        range:
          min: 0
          max: 10000000
      - id: 101
        type: boolean
        name: available
  - entity: switch
    name: Load balancing
    icon: "mdi:scale-balance"
    category: config
    dps:
      - id: 103
        type: boolean
        name: switch
      - id: 101
        type: boolean
        name: available
  - entity: select
    name: Load balancing type
    icon: "mdi:scale-balance"
    category: config
    dps:
      - id: 104
        type: string
        name: option
        mapping:
          - dps_val: W
            value: Power (W)
          - dps_val: A
            value: Current (A)
      - id: 101
        type: boolean
        name: available
  - entity: event
    name: Load balance warning
    icon: "mdi:scale-balance"
    dps:
      - id: 105
        type: string
        name: event
        mapping:
          - dps_val: noalarms
            value: null
          - dps_val: suspendevse
            value: Suspended
          - dps_val: recharging
            value: Recharging
