milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
217 stars 93 forks source link

BN-LINK in-Wall Dual Electrical Outlets w/ USB misreported in HomeKit #472

Closed SemoTech closed 1 year ago

SemoTech commented 1 year ago

Describe the bug After two BN-LINK Dual-Outlet + USB devices were each registered in the Smart Life App, and once the TuyaWebPlatform bridge was scanned and added to HomeKit, each dual-outlet device was presented as a single outlet, and the USB ports are missing.

Steps To Reproduce

  1. Register BN-LINK in-Wall Electrical Dual Outlet + USB (https://www.amazon.com/gp/product/B07KZSG2CT) to Smart Life App
  2. From "Device Information" section in Smart Life App for each dual-outlet device, get the "Virtual ID"
  3. Add Virtual ID to TuyaWeb Homebridge Plugin and define device as [Outlet]
  4. Setup TuyaWeb as child bridge.
  5. Once TuyaWeb bridge QR is scanned into HomeKit, each "dual-outlet" is added as a single outlet for each device.
  6. The ON/OFF toggle in HomeKit for each device controls only the 1st plug/outlet of each dual-outlet device!
  7. There is no control for the 2nd plug of each dual outlet device or the USB port.

Plugin needs discrete dual individual outlet controls per device, for example as presented by Meross since HomeKit does support showing 2 switches together (see Meross Smart Plug example screenshot below), as well as USB on/off support if possible.

image

Plugin Version homebridge-tuya-web v1.1.2

Homebridge Config REDACTED CONFIG:

       {
            "name": "TuyaWebPlatform",
            "options": {
                "username": "email@domain.com",
                "password": "afqfafq3fqfq3g",
                "countryCode": "1",
                "platform": "smart_life"
            },
            "defaults": [
                {
                    "id": "302746194y1",
                    "device_type": "outlet"
                },
                {
                    "id": "68376520472,
                    "device_type": "outlet"
                }
            ],
            "scenes": false,
            "platform": "TuyaWebPlatform",
            "_bridge": {
                "username": "0A:BE:3C:52:AA:B8",
                "port": 52942
            }
        }

Device Config

Additional Context

Both BN-LINK dual-outlet devices & their respective USB ports are individually presented, can be controlled and function perfectly while using the Smart Life App.

milo526 commented 1 year ago

Please post the result of the steps under "How to check whether the api this library uses can control your device".

Without this it is hard for me to help you with regards to this specific issue.

SemoTech commented 1 year ago

Thank you for the API steps @milo526, here is the redacted python script output:

{
   "header":{
      "code":"SUCCESS",
      "payloadVersion":1
   },
   "payload":{
      "devices":[
         {
            "data":{
               "online":true,
               "state":false
            },
            "dev_type":"switch",
            "ha_type":"switch",
            "icon":"https://images.tuyaus.com/smart/icon/ay1497774171616QiQ8R/159048417984bf5d8fff9.png",
            "id":"68376520472",
            "name":"R Garage Dual Outlet w USB - B"
         },
         {
            "data":{
               "online":true,
               "state":false
            },
            "dev_type":"switch",
            "ha_type":"switch",
            "icon":"https://images.tuyaus.com/smart/icon/ay1497774171616QiQ8R/159048417984bf5d8fff9.png",
            "id":"302746194y1",
            "name":"R Garage Dual Outlet w USB - A"
         }
      ],
      "scenes":[

      ]
   }
}

Is there any other App I could use for this device type to yield more info (dual vs sIngle outlet)? Smart Life does see these devices correctly: image

Thank you.

milo526 commented 1 year ago

You might be better of using the first-party homebridge integration from Tuya

https://github.com/tuya/tuya-homebridge

SemoTech commented 1 year ago

Brilliant @milo526 it works perfectly now! My sincere thanks!

I installed and setup a child bridge using the Tuya 1st party integration and their Tuya IoT cloud account, then registered the Smart Life App in the cloud account to gain access to the devices configured via Smart Life.

Now all 3 options are accessible in HomeKit as "Power Strips" for both plugs & USB on each of the BN-Link Outlets! image