tuya / tuya-homebridge

Homebridge custom plugin for controlling Powered by Tuya (PBT) devices in HomeKit. This plugin is officially maintained by the Tuya Developer Team.
MIT License
332 stars 168 forks source link

No devices returned from Tuya #352

Closed mynameisbrendan closed 1 year ago

mynameisbrendan commented 1 year ago

Describe the bug My TUYA devices stopped responding recently. I suspect this was triggered by the 6 month expiry of my Tuya IOT core package. I have since requested and have been approved (over 24 hours ago) for IOT core license for another 6 months.

There are no errors in my homebridge logs for Tuya, however I notice that the response to the /v1.0/iot-01/associated-users/devices API has no devices. I tried deleting a few of my TUYA devices from the HB cache and they have not returned.

I also get no devices from this API if I run it in the Tuya IOT debug tool, however if I call v1.0/users/{uid}/devices I do get my device list.

Any suggestions on how to resolve this, or is there a setting to use this alternate API for the Homebridge plugin?

Evidence:

image

image

[4/13/2023, 9:08:24 AM] [TuyaPlatform] Restarting child bridge... [4/13/2023, 9:08:24 AM] Got SIGTERM, shutting down child bridge process... [4/13/2023, 9:08:29 AM] [TuyaPlatform] Child bridge process ended [4/13/2023, 9:08:29 AM] [TuyaPlatform] Process Ended. Code: 143, Signal: null [4/13/2023, 9:08:36 AM] [TuyaPlatform] Restarting Process... [4/13/2023, 9:08:37 AM] [TuyaPlatform] Launched child bridge with PID 17308 [4/13/2023, 9:08:37 AM] Registering platform 'homebridge-tuya-platform.TuyaPlatform' [4/13/2023, 9:08:37 AM] [TuyaPlatform] Loaded homebridge-tuya-platform v1.5.0 child bridge successfully [4/13/2023, 9:08:37 AM] Loaded 1 cached accessories from cachedAccessories.0E7A5689099B. Initializing TuyaPlatform... TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaeu.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":61,"username":"XXXXXXXXXXX","password":"XXXXXXXXXXXX","schema":"tuyaSmart"}, headers = {"t":"1681340917621","client_id":"XXXXXXXXXXXXXXX","nonce":"f4b04070-d986-11ed-b2d6-8f16c0293437","Signature-Headers":"client_id","sign":"C6FFA6E371401BF4A99B6BAA8859D32FDF6DB658DA7BC28D31BA26C263DB7B1E","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.5.0"} [4/13/2023, 9:08:37 AM] Homebridge v1.6.0 (HAP v0.11.0) (TuyaPlatform) is running on port 52430. TuyaOpenAPI response: {"result":{"access_token":"30fd251275f4bfeb832c845464e5396f","expire_time":7200,"platform_url":"https://openapi.tuyaeu.com","refresh_token":"a0471fb5aae80881f9bc35287175f964","uid":"XXXXXXXXXXXXXXXXXX"},"success":true,"t":1681340918997,"tid":"f5af7f09d98611ed8a08b26d52c09642"} path = /v1.0/iot-01/associated-users/actions/authorized-login TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaeu.com, path = /v1.0/iot-01/associated-users/devices, params = {"size":100}, body = null, headers = {"t":"1681340918781","client_id":"XXXXXXXXXXXXXXXXXXXXX","nonce":"f4b04070-d986-11ed-b2d6-8f16c0293437","Signature-Headers":"client_id","sign":"907C311EDE7644958E200EE237FED991B3BBBB00B165057BD1404E5D3790FFC3","sign_method":"HMAC-SHA256","access_token":"30fd251275f4bfeb832c845464e5396f","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.5.0"} **TuyaOpenAPI response: {"result":{"devices":[],"total":0},"success":true,"t":1681340919836,"tid":"f63473ffd98611edb0f7762acebe122c"} path = /v1.0/iot-01/associated-users/devices** TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaeu.com, path = /v1.0/iot-03/open-hub/access-config, params = null, body = {"uid":"XXXXXXXXXXXXXXXXXXXX","link_id":"f4c3c870-d986-11ed-b2d6-8f16c0293437","link_type":"mqtt","topics":"device","msg_encrypted_version":"1.0"}, headers = {"t":"1681340919615","client_id":"pvv8mwd7dgahm797gxdg","nonce":"f4b04070-d986-11ed-b2d6-8f16c0293437","Signature-Headers":"client_id","sign":"B6A0C2DD219FEDAC23D54D7A2782F454F6E65696DC8A278B465B4F933A9255AF","sign_method":"HMAC-SHA256","access_token":"30fd251275f4bfeb832c845464e5396f","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.5.0"} TuyaOpenAPI response: {"result":{"client_id":"cloud_3e329a2c43e7c0f4f3289e47ffedd206","expire_time":7200,"password":"d43856ec0d4e6cc5cb9452991cb83fc7","sink_topic":{"device":"cloud/token/out/{device_id}"},"source_topic":{"device":"cloud/token/in/532196a33773df444a03c37c2727bddf"},"url":"ssl://m1.tuyaeu.com:8883","username":"cloud_532196a33773df444a03c37c2727bddf"},"success":true,"t":1681340920875,"tid":"f6d55bded98611ed93dec2bd506f6b85"} path = /v1.0/iot-03/open-hub/access-config TuyaOpenMQ connecting: ssl://m1.tuyaeu.com:8883 TuyaOpenMQ connected TuyaOpenMQ onMessage: topic = cloud/token/in/532196a33773df444a03c37c2727bddf, message = {"data":{"dataId":"de61d94f-95de-4f14-ae0b-c57b5cde73ab","devId":"73050322500291bdd1b3","productKey":"jhpmwtl30x7i3sts","status":[{"3":76}]},"protocol":4,"pv":"2.0","sign":"86d913d3f7f2bf072d8a7a0fed2f3e04","t":1681340922}

github-actions[bot] commented 1 year ago

Thank you for your feedback, we will solve this issue soon

RileyEv commented 1 year ago

I'm seeing exactly the same error, and I also got an extended IoT Core license and then it stopped listing devices. I also don't get devices listed from EU/v1.0/iot-01/associated-users/devices, but do get them in EU/v1.0/users/{uid}/devices.

mynameisbrendan commented 1 year ago

I should add that I have tried removing and re-adding my app into the IoT Tuya platform, and creating a new project. Neither restored the device list via this API.

mynameisbrendan commented 1 year ago

Update - This issue has self-resolved. This API is now returning devices again. I don't know if this was an issue at Tuya or just something that takes a few days after extending the IOT core subscription.