make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.38k stars 530 forks source link

Support for [Ledvance Wifi Smart Plug] #422

Closed MarciPain closed 1 year ago

MarciPain commented 1 year ago
name: Ledvance Wifi Smart Plug
primary_entity:
  entity: switch
  class: outlet
  dps:
    - id: 1
      type: boolean
      name: switch
    - id: 9
      type: integer
      name: timer
    - id: 17
      type: integer
      name: add_ele
      read_only: true
      optional: true
    - id: 18
      type: integer
      name: current_a
      read-only: true
      mapping:
        - scale: 1000
    - id: 19
      type: integer
      name: current_power_w
      read-only: true
      mapping:
        - scale: 10
    - id: 20
      type: integer
      name: voltage_v
      read-only: true
      mapping:
        - scale: 10
    - id: 21
      type: bitfield
      name: factory_test
      optional: true
    - id: 22
      type: integer
      name: voltage_calibration
      optional: true
    - id: 23
      type: integer
      name: current_calibration
      optional: true
    - id: 24
      type: integer
      name: power_calibration
      optional: true
    - id: 25
      type: integer
      name: energy_calibration
      optional: true
secondary_entities:
  - entity: sensor
    category: diagnostic
    class: voltage
    name: Voltage
    dps:
      - id: 20
        name: sensor
        type: integer
        class: measurement
        unit: V
        mapping:
          - scale: 10
  - entity: sensor
    category: diagnostic
    class: current
    name: Current
    dps:
      - id: 18
        name: sensor
        type: integer
        class: measurement
        unit: mA
  - entity: sensor
    category: diagnostic
    class: power
    name: Power
    dps:
      - id: 19
        name: sensor
        type: integer
        class: measurement
        unit: W
        mapping:
          - scale: 10
  - entity: number
    category: config
    name: Countdown Timer
    optional: true
    icon: "mdi:timer"
    dps:
      - id: 9
        type: integer
        name: value
        unit: min
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 60
            step: 60
  - entity: select
    category: config
    name: Initial state
    icon: "mdi:toggle-switch"
    dps:
      - id: 38
        type: string
        name: option
        mapping:
          - dps_val: "on"
            value: "On"
          - dps_val: "off"
            value: "Off"
          - dps_val: memory
            value: "Last State"
make-all commented 1 year ago

This is almost a smarrtplugv2_energy device, so I have made some dps in that config optional in order to also cover this device.

MarciPain commented 1 year ago

Not working: image

make-all commented 1 year ago

I made the test bit and energy sensor optional as well (the latter seems to only report infrequently on many devices, and the former is not really useful, so no issue if it is not there)