name: Energy meter
products:
  - id: tadm13agjigbdtxd
    manufacturer: Gaqqee
    model: KWS-302-WF
  - id: bjawzodf
    manufacturer: Gaqqee
    model: KWS-303-WF
entities:
  - entity: sensor
    class: energy
    dps:
      - id: 105
        type: integer
        name: sensor
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 1000
      - id: 116
        type: string
        name: state_flag
      - id: 117
        type: string
        name: flag_save
        optional: true
      - id: 123
        type: integer
        name: add_ele
        optional: true
  - entity: switch
    category: config
    dps:
      - id: 16
        type: boolean
        name: switch
  - entity: sensor
    class: voltage
    category: diagnostic
    dps:
      - id: 101
        type: integer
        name: sensor
        unit: V
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: current
    category: diagnostic
    dps:
      - id: 102
        type: integer
        name: sensor
        unit: A
        class: measurement
        mapping:
          - scale: 1000
  - entity: sensor
    class: power
    category: diagnostic
    dps:
      - id: 103
        type: integer
        name: sensor
        unit: W
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    class: duration
    category: diagnostic
    dps:
      - id: 104
        type: integer
        optional: true
        name: sensor
        unit: min
        class: measurement
  - entity: sensor
    class: power_factor
    category: diagnostic
    dps:
      - id: 106
        type: integer
        optional: true
        name: sensor
        unit: "%"
        class: measurement
  - entity: sensor
    class: frequency
    category: diagnostic
    dps:
      - id: 107
        type: integer
        name: sensor
        unit: Hz
        class: measurement
  - entity: sensor
    class: temperature
    category: diagnostic
    dps:
      - id: 108
        type: integer
        optional: true
        name: sensor
        unit: C
        class: measurement
  - entity: number
    name: Low voltage
    category: config
    class: voltage
    dps:
      - id: 109
        type: integer
        optional: true
        name: value
        unit: V
        range:
          min: 100
          max: 220
  - entity: number
    name: Overvoltage
    class: voltage
    category: config
    dps:
      - id: 110
        type: integer
        optional: true
        name: value
        unit: V
        range:
          min: 130
          max: 290
  - entity: number
    name: Overcurrent
    category: config
    class: current
    dps:
      - id: 111
        type: integer
        optional: true
        name: value
        unit: A
        range:
          min: 0
          max: 100000
        mapping:
          - scale: 1000
  - entity: number
    name: Power off time
    category: config
    translation_key: timer
    class: duration
    dps:
      - id: 112
        type: integer
        name: value
        optional: true
        unit: min
        range:
          min: 0
          max: 60000
        mapping:
          - step: 30
  - entity: number
    name: Over energy
    category: config
    class: energy
    dps:
      - id: 113
        type: integer
        optional: true
        name: value
        unit: kWh
        range:
          min: 0
          max: 99999999
        mapping:
          - scale: 1000
  - entity: number
    name: Over power
    category: config
    class: power
    dps:
      - id: 114
        type: integer
        optional: true
        name: value
        unit: kW
        range:
          min: 0
          max: 22000
        mapping:
          - scale: 1000
  - entity: number
    name: Over temperature
    category: config
    class: temperature
    dps:
      - id: 115
        type: integer
        optional: true
        name: value
        unit: C
        range:
          min: -20
          max: 150
  - entity: button
    name: Clear flag
    category: config
    dps:
      - id: 118
        type: boolean
        name: button
        optional: true
  - entity: number
    translation_key: timer
    name: Screen timeout
    class: duration
    category: config
    icon: "mdi:television-ambient-light"
    dps:
      - id: 119
        type: integer
        optional: true
        name: value
        unit: min
        range:
          min: 0
          max: 59
  - entity: button
    translation_key: factory_reset
    category: config
    hidden: true
    dps:
      - id: 120
        type: boolean
        name: button
        optional: true
  - entity: time
    translation_key: timer
    category: config
    dps:
      - id: 121
        type: integer
        name: second
        optional: true
        range:
          min: 0
          max: 86400
  - entity: switch
    name: Schedule
    category: config
    dps:
      - id: 122
        type: boolean
        name: switch
        optional: true
  - entity: binary_sensor
    class: problem
    category: diagnostic
    hidden: unavailable
    dps:
      - id: 10
        type: bitfield
        optional: true
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - dps_val: null
            value: false
          - value: true
      - id: 10
        type: bitfield
        optional: true
        name: fault_code
      - id: 10
        type: bitfield
        optional: true
        name: available
        mapping:
          - dps_val: null
            value: false
          - value: true
  - entity: select
    name: Screen orientation
    icon: "mdi:screen-rotation"
    category: config
    hidden: unavailable
    dps:
      - id: 124
        type: boolean
        optional: true
        name: option
        mapping:
          - dps_val: false
            value: Normal
          - dps_val: true
            value: Inverted
          - value: Normal
            hidden: true
      - id: 10
        type: bitfield
        optional: true
        name: available
        mapping:
          - dps_val: null
            value: false
          - value: true
  - entity: select
    translation_key: initial_state
    category: config
    hidden: unavailable
    dps:
      - id: 125
        type: string
        optional: true
        name: option
        mapping:
          - dps_val: "off"
            value: "off"
          - dps_val: "on"
            value: "on"
          - dps_val: memory
            value: memory
      - id: 10
        type: bitfield
        optional: true
        name: available
        mapping:
          - dps_val: null
            value: false
          - value: true
