name: Energy meter
products:
  - id: ntwmuj82anq1l92i
    manufacturer: SmartMCB
    model: SMT006-10
entities:
  - entity: switch
    translation_key: breaker
    dps:
      - id: 16
        type: boolean
        name: switch
      - id: 19
        type: string
        name: breaker_number
        optional: true
  - entity: sensor
    class: energy
    dps:
      - id: 1
        type: integer
        name: sensor
        class: total_increasing
        unit: kWh
        mapping:
          - scale: 100
  - 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
      - id: 9
        type: bitfield
        name: description
        mapping:
          - dps_val: 0
            value: OK
          - dps_val: 1
            value: Short circuit
          - dps_val: 2
            value: Surge
          - dps_val: 4
            value: Overload
          - dps_val: 8
            value: Earth leak
          - dps_val: 16
            value: High temperature
          - dps_val: 32
            value: Fire
          - dps_val: 64
            value: High power
          - dps_val: 128
            value: Self test
          - dps_val: 256
            value: Over current
          - dps_val: 512
            value: Unbalanced
          - dps_val: 1024
            value: Over voltage
          - dps_val: 2048
            value: Undervoltage
          - dps_val: 4096
            value: Phase fault
          - dps_val: 8192
            value: Outage
          - dps_val: 16384
            value: Magnetism
          - dps_val: 32768
            value: Low credit
          - dps_val: 65536
            value: Credit expired
  - entity: switch
    name: Prepay
    category: config
    icon: "mdi:hand-coin"
    dps:
      - id: 11
        type: boolean
        name: switch
  - entity: button
    name: Energy reset
    category: config
    class: restart
    dps:
      - id: 12
        type: boolean
        name: button
  - entity: sensor
    name: Balance energy
    category: diagnostic
    class: energy_storage
    icon: "mdi:home-lightning-bolt"
    dps:
      - id: 13
        type: integer
        name: sensor
        unit: kWh
        mapping:
          - scale: 100
  - entity: sensor
    class: voltage
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: V
        mask: "FFFF0000000000000000"
        mapping:
          - scale: 10
  - entity: sensor
    class: current
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: A
        mask: "0000FFFFFF0000000000"
        mapping:
          - scale: 1000
  - entity: sensor
    class: power
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: kW
        mask: "0000000000FFFFFF0000"
        mapping:
          - scale: 1000
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 103
        type: integer
        name: sensor
        unit: C
        class: measurement
  - entity: sensor
    translation_key: leakage_current
    class: current
    category: diagnostic
    dps:
      - id: 15
        type: integer
        name: sensor
        unit: mA
        class: measurement
        optional: true
