name: Energy meter
products:
  - id: i55reuttymjocx0j
    manufacturer: Ketotek
    model: KTEM06pro
entities:
  - entity: sensor
    translation_key: energy_consumed
    class: energy
    dps:
      - id: 1
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
      - id: 108
        type: string
        name: breaker_id
  - entity: sensor
    translation_key: power_x
    translation_placeholders:
      x: A
    class: power
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        unit: kW
        class: measurement
        mask: "00FFFFFF0000000000000000000000"
        mapping:
          - scale: 1000
      - id: 106
        type: integer
        name: multiplier
        optional: true
  - entity: binary_sensor
    name: Power direction A
    translation_key: direction
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        mask: "010000000000000000000000000000"
  - entity: sensor
    name: Reactive power A
    class: reactive_power
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        unit: var
        class: measurement
        mask: "0000000000FFFFFF00000000000000"
  - entity: binary_sensor
    name: Reactive power direction A
    translation_key: direction
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        mask: "000000000100000000000000000000"
  - entity: sensor
    name: Power factor A
    class: power_factor
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        class: measurement
        mask: "0000000000000000FFFF0000000000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: current_x
    translation_placeholders:
      x: A
    class: current
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        unit: A
        class: measurement
        mask: "00000000000000000000FFFFFF0000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: voltage_x
    translation_placeholders:
      x: A
    class: voltage
    category: diagnostic
    dps:
      - id: 6
        type: base64
        optional: true
        name: sensor
        unit: V
        class: measurement
        mask: "00000000000000000000000000FFFF"
        mapping:
          - scale: 10
  - entity: sensor
    translation_key: power_x
    translation_placeholders:
      x: B
    class: power
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        unit: kW
        class: measurement
        mask: "00FFFFFF0000000000000000000000"
        mapping:
          - scale: 1000
  - entity: binary_sensor
    name: Power direction B
    translation_key: direction
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        mask: "010000000000000000000000000000"
  - entity: sensor
    name: Reactive power B
    class: reactive_power
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        unit: var
        class: measurement
        mask: "0000000000FFFFFF00000000000000"
  - entity: binary_sensor
    name: Reactive power direction B
    translation_key: direction
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        mask: "000000000100000000000000000000"
  - entity: sensor
    name: Power factor B
    class: power_factor
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        class: measurement
        mask: "0000000000000000FFFF0000000000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: current_x
    translation_placeholders:
      x: B
    class: current
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        unit: A
        class: measurement
        mask: "00000000000000000000FFFFFF0000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: voltage_x
    translation_placeholders:
      x: B
    class: voltage
    category: diagnostic
    dps:
      - id: 7
        type: base64
        optional: true
        name: sensor
        unit: V
        class: measurement
        mask: "00000000000000000000000000FFFF"
        mapping:
          - scale: 10
  - entity: sensor
    translation_key: power_x
    translation_placeholders:
      x: C
    class: power
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        unit: kW
        class: measurement
        mask: "00FFFFFF0000000000000000000000"
        mapping:
          - scale: 1000
  - entity: binary_sensor
    name: Power direction C
    translation_key: direction
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        mask: "010000000000000000000000000000"
  - entity: sensor
    name: Reactive power C
    class: reactive_power
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        unit: var
        class: measurement
        mask: "0000000000FFFFFF00000000000000"
  - entity: binary_sensor
    name: Reactive power direction C
    translation_key: direction
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        mask: "000000000100000000000000000000"
  - entity: sensor
    name: Power factor C
    class: power_factor
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        class: measurement
        mask: "0000000000000000FFFF0000000000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: current_x
    translation_placeholders:
      x: C
    class: current
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        unit: A
        class: measurement
        mask: "00000000000000000000FFFFFF0000"
        mapping:
          - scale: 1000
  - entity: sensor
    translation_key: voltage_x
    translation_placeholders:
      x: C
    class: voltage
    category: diagnostic
    dps:
      - id: 8
        type: base64
        optional: true
        name: sensor
        unit: V
        class: measurement
        mask: "00000000000000000000000000FFFF"
        mapping:
          - scale: 10
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 9
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 9
        type: bitfield
        name: fault_code
  - entity: switch
    name: Prepayment
    category: config
    icon: "mdi:hand-coin"
    dps:
      - id: 11
        type: boolean
        name: switch
  - entity: button
    name: Clear energy
    category: config
    dps:
      - id: 12
        type: boolean
        optional: true
        name: button
      - id: 11
        type: boolean
        name: available
  - entity: sensor
    name: Balance energy
    category: diagnostic
    dps:
      - id: 13
        type: integer
        name: sensor
        unit: kWh
        class: measurement
        mapping:
          - scale: 100
      - id: 11
        type: boolean
        name: available
  - entity: number
    name: Charge energy
    category: config
    class: energy
    dps:
      - id: 14
        type: integer
        optional: true
        persist: false
        name: value
        unit: kWh
        range:
          min: 0
          max: 999999
        mapping:
          - dps_val: null
            value: 0
      - id: 11
        type: boolean
        name: available
  - entity: sensor
    translation_key: leakage_current
    class: current
    category: diagnostic
    dps:
      - id: 15
        type: integer
        optional: true
        name: sensor
        unit: mA
        class: measurement
        mapping:
          - scale: 10
  - entity: switch
    icon: "mdi:fuse"
    dps:
      - id: 16
        type: boolean
        name: switch
      - id: 17
        type: string
        optional: true
        name: alarm_set_1
      - id: 18
        type: string
        optional: true
        name: alarm_set_2
  - entity: sensor
    class: energy
    dps:
      - id: 101
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
  - entity: sensor
    translation_key: energy_produced
    class: energy
    dps:
      - id: 102
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
  - entity: sensor
    class: power
    category: diagnostic
    dps:
      - id: 103
        type: integer
        name: sensor
        unit: kW
        class: measurement
        mapping:
          - scale: 1000
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 104
        type: integer
        optional: true
        name: sensor
        unit: C
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: frequency
    category: diagnostic
    dps:
      - id: 105
        type: integer
        name: sensor
        unit: Hz
        class: measurement
        mapping:
          - scale: 100
  - entity: time
    translation_key: timer
    category: config
    dps:
      - id: 107
        type: integer
        optional: true
        name: minute
        range:
          min: 0
          max: 1440
  - entity: sensor
    class: reactive_power
    category: diagnostic
    dps:
      - id: 110
        type: integer
        name: sensor
        unit: var
        class: measurement
      - id: 109
        type: integer
        name: energy_kvarh
        mapping:
          - scale: 100
  - entity: sensor
    class: power_factor
    category: diagnostic
    dps:
      - id: 111
        type: integer
        name: sensor
        class: measurement
        mapping:
          - scale: 1000
