name: Energy monitoring smartplug
products:
  - id: 2iepauebcvo74ujc
    name: Aubess 20A
  - id: wrz6vzch8htux2zp
    name: Elivco CB2S-16DL
  - id: 3lbgj7cu27nsmh0w
    name: AT-Q-SY2-JWT
  - id: cipuwutzfuqk3iru
    name: UNSH SMKG-KNL
  - id: azpywu5zfg5wyzpn
    name: EARU 1P Breaker
primary_entity:
  entity: switch
  class: outlet
  dps:
    - id: 1
      type: boolean
      name: switch
    - id: 21
      type: integer
      name: test_bit
    - id: 26
      type: bitfield
      name: fault_code
    - id: 42
      type: base64
      name: cycle_timer
      optional: true
    - id: 43
      type: base64
      name: random_timer
      optional: true
    - id: 44
      type: base64
      name: inching
      optional: true
secondary_entities:
  - entity: number
    category: config
    translation_key: timer
    dps:
      - id: 9
        type: integer
        name: value
        unit: min
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 60
            step: 60
  - entity: sensor
    category: diagnostic
    name: Energy
    dps:
      - id: 17
        name: sensor
        type: integer
        unit: Wh
        optional: true
      - id: 25
        type: integer
        name: calibration
        # seems to be present even when 17 is missing, but for consistency
        optional: true
  - entity: sensor
    category: diagnostic
    class: current
    dps:
      - id: 18
        name: sensor
        type: integer
        class: measurement
        force: true
        unit: mA
      - id: 23
        type: integer
        name: calibration
  - entity: sensor
    category: diagnostic
    class: power
    dps:
      - id: 19
        name: sensor
        type: integer
        class: measurement
        force: true
        unit: W
        mapping:
          - scale: 10
            constraint: switch
            conditions:
              - dps_val: false
                value: 0
      - id: 1
        type: boolean
        name: switch
      - id: 24
        type: integer
        name: calibration
  - entity: sensor
    category: diagnostic
    class: voltage
    dps:
      - id: 20
        name: sensor
        type: integer
        class: measurement
        force: true
        unit: V
        mapping:
          - scale: 10
      - id: 22
        type: integer
        name: calibration
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 26
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: select
    category: config
    translation_key: initial_state
    dps:
      - id: 38
        type: string
        name: option
        mapping:
          - dps_val: "on"
            value: "on"
          - dps_val: "off"
            value: "off"
          - dps_val: memory
            value: memory
  - entity: lock
    translation_key: child_lock
    category: config
    dps:
      - id: 41
        type: boolean
        name: lock
        optional: true
  - entity: select
    name: Light mode
    category: config
    icon: "mdi:lightbulb"
    dps:
      - id: 40
        type: string
        name: option
        mapping:
          - dps_val: relay
            value: State
          - dps_val: pos
            value: Position
          - dps_val: none
            value: "Off"
          - dps_val: "on"
            value: "On"
  - entity: switch
    name: Overcharge protection
    category: config
    dps:
      - id: 39
        type: boolean
        name: switch
        optional: true
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 47
        type: integer
        optional: true
        name: sensor
        unit: C
        class: measurement
