AMoo-Miki / homebridge-tuya-lan

Homebridge plugin for IoT devices that use Tuya Smart's platform
MIT License
204 stars 52 forks source link

Support new Tuya Firmware #61

Closed eugenet8k closed 5 years ago

eugenet8k commented 5 years ago

Hi guys,

Not sure if this issue was raised already. But after a recent upgrade of Tuya devices to the latest firmware (it's different ver per manufacturer) the Homebridge plugin stopped working correctly. It does show devices online, but all commands sent are ignored.

It seems the problem was addressed in tuyapi (https://github.com/codetheweb/tuyapi/issues/175). But I can't see if that package is a dependency of this module. Do you work with that api? If so would you be able to use an updated version?

Thanks for all help with the plugin. It's a great functionality, too bad does not work at the moment...

paschalis-mpeis commented 5 years ago

So it looks like this project (github) states that it's deprecated, and we should use homebridge-tuya-lan instead.

However, the homebridge-tuya project was updated a few days ago, and it does support the new firmware version. I've just tested it with 2nice/GO Smart/Smart Life Smart-Wifi-Plugs and it works!

I switched to that project for now, until this one gets updated!

Cheers!

rangerek commented 5 years ago

Thanks for letting know :) will use both then (as this one supports my garage opener)

AMoo-Miki commented 5 years ago

Please give the latest rc release a shot by doing npm i -g homebridge-tuya-lan@rc. It includes logic to understand this newer API.

A known issue is that the current state is not reported by some devices; they however work fine as soon as you interact with them. I have reached out to Tuya for a solution.

The Setup Instructions have changed in case you need to obtain a fresh id and key.

eugenet8k commented 5 years ago

Hi @AMoo-Miki, thanks for the rc! I tried it with my few bulbs EXTSUD: Smart Wifi Bulb Socket GU10 (that I call "Kitchen Stove Light") and it doesn't seem to improve things. When I send any command from iOS Home app it doesn't affect the light state. The homebridge log does show some errors at first but then later it seems it connected to my lights (unless I misread things):

[9/14/2019, 9:07:23 AM] [TuyaLan] Discovered a device that has not been configured yet (06530174cc50e31b9061).
[9/14/2019, 9:07:23 AM] [TuyaLan] Discovered a device that has not been configured yet (34082301cc50e3d05a3a).
[9/14/2019, 9:07:25 AM] [TuyaLan] Discovered a device that has not been configured yet (00340810c44f338dbc6d).
[9/14/2019, 9:07:43 AM] [TuyaLan] Marked Kitchen Stove Light 2 unreachable by faulting Service.Kitchen Stove Light 2.On
[9/14/2019, 9:07:43 AM] [TuyaLan] Marked Kitchen Stove Light 1 unreachable by faulting Service.Kitchen Stove Light 1.On
[9/14/2019, 9:07:43 AM] [TuyaLan] Starting discovery...
[TuyaDiscovery] Discovery started on port 6666.
[TuyaDiscovery] Discovery started on port 6667.
[9/14/2019, 9:07:43 AM] [TuyaLan] Discovered a device that has not been configured yet (01056532c44f3380c331).
[9/14/2019, 9:07:43 AM] [TuyaLan] Discovered Kitchen Stove Light 2 (01802003cc50e3501bae) identified as RGBTWLight (3.1)
[9/14/2019, 9:07:43 AM] [TuyaLan] Connected to Kitchen Stove Light 2
[9/14/2019, 9:07:43 AM] [TuyaLan] Ready to handle Kitchen Stove Light 2 (RGBTWLight:3.1) with signature {"1":false,"2":"colour","3":40,"4":255,"5":"871600000AFF93","6":"00ff0000000000","7":"ffff500100ff00","8":"ffff8003ff000000ff000000ff000000000000000000","9":"ffff5001ff0000","10":"ffff0505ff000000ff00ffff00ff00ff0000ff000000"}
[TuyaAccessory] Color format for Kitchen Stove Light 2 (3.1) identified as HEXHSB (length: 14).
[9/14/2019, 9:07:46 AM] [TuyaLan] Discovered Kitchen Stove Light 1 (01734776807d3a7e4dbd) identified as RGBTWLight (3.1)
[9/14/2019, 9:07:46 AM] [TuyaLan] Connected to Kitchen Stove Light 1
[9/14/2019, 9:07:46 AM] [TuyaLan] Ready to handle Kitchen Stove Light 1 (RGBTWLight:3.1) with signature {"1":false,"2":"colour","3":25,"4":0,"5":"7F1600000AFF8D","6":"00ff0000000000","7":"ffff500100ff00","8":"ffff8003ff000000ff000000ff000000000000000000","9":"ffff5001ff0000","10":"ffff0505ff000000ff00ffff00ff00ff0000ff000000"}
[TuyaAccessory] Color format for Kitchen Stove Light 1 (3.1) identified as HEXHSB (length: 14).
[TuyaAccessory] Sending Kitchen Stove Light 1 {"1":true}
[TuyaAccessory] Sending Kitchen Stove Light 2 {"1":true}
[TuyaAccessory] Sending Kitchen Stove Light 2 {"1":false}
[TuyaAccessory] Sending Kitchen Stove Light 1 {"1":false}
[TuyaAccessory] Sending Kitchen Stove Light 1 {"1":true}
[TuyaAccessory] Sending Kitchen Stove Light 1 {"2":"colour","5":"452d8c00ffad8c"}
[TuyaAccessory] setColorTemperature: 0

all these commands I see in log did not change the light state. Here is my config.json

    {
      "platform": "TuyaLan",
      "devices": [
        {
          "name": "Kitchen Stove Light 1",
          "type": "RGBTWLight",
          "manufacturer": "EXTSUD",
          "model": "Smart Wifi Bulb Socket GU10",
          "id": "01734776807d3a7e4dbd",
          "key": "a3267df701f144dd"
        },
        {
          "name": "Kitchen Stove Light 2",
          "type": "RGBTWLight",
          "manufacturer": "EXTSUD",
          "model": "Smart Wifi Bulb Socket GU10",
          "id": "01802003cc50e3501bae",
          "key": "203fd1cc9defd786"
        }
      ]
    }

UPDATED:

Sorry, it was my bad! I did not run through new Setup Instructions after I did and got updated id and key for those devices it started to work! Thank you so much for your contributions and make this Homebridge plugin working again!

AMoo-Miki commented 5 years ago

@eugenet8k, I am glad to hear that things are working now. Best of luck.

eugenet8k commented 5 years ago

@AMoo-Miki thank you so much for the new tool tuya-lan-find! It was a dramatically better experience than using anyproxy.

AMoo-Miki commented 5 years ago

Good to know :) My pleasure.