name: eMylo meter
products:
  - id: nqbs1onwskmmmaac
    name: EAI-90
primary_entity:
  entity: sensor
  class: energy
  dps:
    - id: 1
      type: integer
      name: sensor
      unit: kWh
      class: total_increasing
      mapping:
        - scale: 100
    - id: 6
      type: string
      name: phase_a
      optional: true
      force: true
    - id: 10
      type: bitfield
      name: fault_code
    - id: 17
      type: string
      name: alarm
      optional: true
secondary_entities:
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 10
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: switch
    name: Prepayment
    category: config
    icon: "mdi:cash"
    dps:
      - id: 12
        type: boolean
        name: switch
  - entity: sensor
    name: Prepaid energy
    category: diagnostic
    dps:
      - id: 13
        type: integer
        name: sensor
        unit: kWh
        optional: true
        mapping:
          - scale: 100
  - entity: button
    name: Clear energy
    class: restart
    category: config
    dps:
      - id: 14
        type: boolean
        name: button
        optional: true
  - entity: number
    name: Charge energy
    category: config
    icon: "mdi:cash"
    dps:
      - id: 15
        type: integer
        name: value
        unit: kWh
        optional: true
        range:
          min: 0
          max: 50000
  - entity: switch
    dps:
      - id: 16
        type: boolean
        name: switch
  - entity: button
    name: Clear event
    class: restart
    category: config
    dps:
      - id: 20
        type: boolean
        name: button
        optional: true
  - entity: sensor
    name: Voltage A
    class: voltage
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: V
        mapping:
          - mask: "FFFF000000000000"
            scale: 10
  - entity: sensor
    name: Current A
    class: current
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: A
        mapping:
          - mask: "0000FFFFFF000000"
            scale: 1000
  - entity: sensor
    name: Power A
    class: power
    category: diagnostic
    dps:
      - id: 6
        type: base64
        name: sensor
        optional: true
        unit: kW
        mapping:
          - mask: "0000000000FFFFFF"
            scale: 1000
