name: Advanced energy monitoring smartplug
entities:
  - entity: switch
    class: outlet
    dps:
      - id: 1
        type: boolean
        name: switch
      - id: 21
        type: integer
        name: test_bit
  - entity: time
    category: config
    translation_key: timer
    dps:
      - id: 9
        type: integer
        name: second
        range:
          min: 0
          max: 86400
      - id: 41
        type: string
        name: cycle_timer
      - id: 42
        type: string
        name: random_timer
  - 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
        optional: true
  - entity: sensor
    category: diagnostic
    class: power
    dps:
      - id: 19
        name: sensor
        type: integer
        class: measurement
        force: true
        unit: W
        mapping:
          - scale: 10
      - id: 24
        type: integer
        name: calibration
        optional: true
  - entity: sensor
    category: diagnostic
    class: voltage
    dps:
      - id: 20
        name: sensor
        type: integer
        force: true
        class: measurement
        unit: V
        mapping:
          - scale: 10
      - id: 22
        type: integer
        name: calibration
        optional: true
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 26
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 26
        type: bitfield
        name: fault_code
  - 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: switch
    name: Overcharge cutoff
    category: config
    icon: "mdi:battery-charging"
    dps:
      - id: 46
        type: boolean
        name: switch
