rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.87k stars 552 forks source link

Support for plug devices with multiple individual outlets in each device #1716

Open Aephir opened 4 months ago

Aephir commented 4 months ago

The problem

I have some dual WiFi plugs that show in Tuya developer page as:

"category": "pc"
"product_id": "p2tjkvgdhvuadnlj"

Each device has two independently controllable outlets, but I can't seem to get that to be the case in Home Assistant

Environment

Steps to reproduce

  1. Add new device
  2. Fill in details (Host, Device ID, Local Key)
  3. Select "switch" (auto selected)
  4. Regardless of what you choose in the "Configure Entity" page, you only get one "switch" in Home Assistant, even though the device itself has two (that can be used from Core Tuya integration)

DP dump

{
"1":"Switch 1",
"2":"Switch 2",
"9":"Countdown1",
"10":"Countdown2",
"17":"Increase electricity",
"18":"Current current",
"19":"Current power",
"20":"Current voltage",
"21":"test bit",
"22":"voltage coe",
"23":"electric coe",
"24":"power coe",
"25":"electricity coe",
"38":"Relay Status",
"39":"Indicate Light",
"40":"Child Lock",
"41":"Cycle Time",
"42":"Random Time",
"43":"Inching Switch"
}

Provide Home Assistant traceback/logs

NA

Additional information

NA

JJKing42 commented 3 months ago

This is not a bug and the solution to your problem is very simple.

Edit your device, add a switch entity with the datapoint 2.

Remember that when you add a new device, you are required at least one entity in the setup, and then you have the option to add more entities. This does not mean another device. Just more entities for your device.