name: EV charger
products:
  - id: hytatexziwaifxj1
    name: Feyree 32A 85-264V EV charger
  - id: emvuyyax4lekiooj
    name: Feyree A_32A_1L ChargePoint
primary_entity:
  entity: sensor
  class: enum
  translation_key: status
  icon: "mdi:ev-station"
  dps:
    - id: 101
      type: string
      name: sensor
      mapping:
        - dps_val: no_connect
          value: available
        - dps_val: connect
          value: plugged_in
        - dps_val: charing
          value: charging
        - dps_val: wait_rfid
          value: waiting_for_authorization
        - dps_val: finish
          value: charged
        - dps_val: wait_charing
          value: waiting
        - dps_val: error
          value: fault
    - id: 3
      type: string
      optional: true
      name: charger_status
    - id: 11
      type: string
      optional: true
      name: alarm_set_1
    - id: 12
      type: string
      optional: true
      name: alarm_set_2
    - id: 14
      type: string
      optional: true
      name: mode
      mapping:
        - dps_val: charge_now
        - dps_val: charge_pct
        - dps_val: charge_energy
        - dps_val: charge_schedule
    - id: 15
      type: integer
      optional: true
      name: balance_energy
      unit: kWh
    - id: 18
      type: boolean
      optional: true
      name: switch
    - id: 23
      type: string
      optional: true
      name: system_version
    - id: 25
      type: integer
      optional: true
      name: charge_energy_once
      unit: kWh
    - id: 27
      type: string
      optional: true
      name: online_state
    - id: 105
      type: boolean
      optional: true
      name: require_authorization
secondary_entities:
  - entity: sensor
    name: Alarm event
    icon: 'mdi:alert-outline'
    class: enum
    dps:
      - id: 10
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: "Ready"
          - dps_val: 1
            value: "Under voltage protection"
          - dps_val: 2
            value: "Over voltage protection"
          - dps_val: 4
            value: "Over current protection"
          - dps_val: 8
            value: "Protective earth error"
          - dps_val: 16
            value: "Temperature is to high"
          - dps_val: 32
            value: "Control pilot line error"
          - dps_val: 64
            value: "Leak"
          - dps_val: 128
            value: "Relay socket"
          - dps_val: 256
            value: "Protective earth error 2"
          - dps_val: 512
            value: "Plug temperature is to high."
          - dps_val: 1024
            value: "PCB temperature is to high."
          - dps_val: 2048
            value: "Core temperature is to high."
          - dps_val: 4096
            value: "ESB"
          - dps_val: 8192
            value: "Socket protective earth error"
          - dps_val: 16384
            value: "Socket leakage"
          - dps_val: 32768
            value: "Socket temperature is to high."
  - entity: button
    name: Clear energy
    class: restart
    category: config
    dps:
      - id: 16
        type: boolean
        name: button
        optional: true
  - entity: button
    name: Clear event
    class: restart
    category: config
    dps:
      - id: 20
        type: boolean
        name: button
        optional: true
  - entity: number
    name: Set charge current
    icon: "mdi:ev-plug-type2"
    dps:
      - id: 102
        type: integer
        name: value
        unit: A
        range:
          min: 8
          max: 32
  - entity: switch
    name: Leak enable
    category: config
    dps:
      - id: 103
        type: boolean
        optional: true
        force: true
        name: switch
        mapping:
          - dps_val: false
            value: false
            default: true
          - dps_val: true
            value: true
  - entity: number
    name: Charge delay
    category: config
    icon: "mdi:car-clock"
    dps:
      - id: 104
        type: integer
        name: value
        unit: h
        range:
          min: 0
          max: 15
  - entity: switch
    name: Power switch
    icon: "mdi:power"
    category: config
    dps:
      - id: 105
        type: boolean
        optional: true
        force: true
        name: switch
  - entity: sensor
    class: energy
    dps:
      - id: 106
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 10
  - entity: sensor
    class: voltage
    category: diagnostic
    dps:
      - id: 107
        type: integer
        name: sensor
        unit: V
        class: measurement
  - entity: sensor
    class: current
    dps:
      - id: 108
        type: integer
        name: sensor
        unit: A
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: power
    dps:
      - id: 109
        type: integer
        name: sensor
        unit: kW
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 110
        type: integer
        name: sensor
        unit: C
        class: measurement
        mapping:
          - scale: 10
  - entity: number
    name: Leakage calibration
    category: config
    dps:
      - id: 111
        type: integer
        name: value
        optional: true
        force: true
        range:
          min: 20
          max: 250
        mapping:
          - dps_val: 20
            value: 20
            default: true
  - entity: switch
    name: Charging enable
    icon: "mdi:ev-station"
    dps:
      - id: 112
        type: boolean
        name: switch
  - entity: sensor
    name: Charging time
    class: duration
    category: diagnostic
    dps:
      - id: 113
        type: integer
        name: sensor
        unit: h
        class: measurement
        mapping:
          - scale: 10
  - entity: number
    name: Charging duration
    category: config
    icon: "mdi:car-clock"
    dps:
      - id: 114
        type: integer
        name: value
        unit: h
        range:
          min: 0
          max: 15
