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

Tuya Plugin not working, Smartlife is connected via Tuya #278

Closed LoneStar1845 closed 1 year ago

LoneStar1845 commented 1 year ago

Hello,

The smart life products connected via Tuya are not picking up. Can you please ensure my configuration is correct and advise on what to do to get it working.

Thank you

github-actions[bot] commented 1 year ago

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

mattlqx commented 1 year ago

Same here. A couple of days ago the plugin stopped working.

From debug logs:

TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"xxx@xxx.xxx","password":"xxxx","schema":"smartlife"}, headers = {"t":"1662394652509","client_id":"xxxx","nonce":"3ea81480-2d36-11ed-8d19-2572eec4e3d3","Signature-Headers":"client_id","sign":"xxxx","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.5.0"}

TuyaOpenAPI response: {"code":1106,"msg":"permission deny","success":false,"t":1662394653121,"tid":"3f3d6a752d3611ed92604a665330a847"} path = /v1.0/iot-01/associated-users/actions/authorized-login
TypeError: Cannot destructure property 'access_token' of 'res.result' as it is undefined.
    at TuyaSHOpenAPI._refreshAccessTokenIfNeed (/homebridge/node_modules/homebridge-tuya-platform/lib/tuyashopenapi.js:49:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at TuyaSHOpenAPI.request (/homebridge/node_modules/homebridge-tuya-platform/lib/tuyashopenapi.js:145:7)
    at TuyaSHOpenAPI.getDevices (/homebridge/node_modules/homebridge-tuya-platform/lib/tuyashopenapi.js:63:15)
    at TuyaPlatform.initTuyaSDK (/homebridge/node_modules/homebridge-tuya-platform/index.js:90:19)

Attention⚠️ ⚠️ ⚠️ ! You get an error!
Failed to get device information. Please check if the config.json is correct.
mattlqx commented 1 year ago

Okay, figured out how to fix it.

I reset my Smart Life password to a new one that didn't include dashes and it started working again. In the app, it says 6-20 letters and numbers. Maybe they started some sort of enforcement of that in the authorize endpoint and it doesn't work with older passwords. Just a guess.

four43 commented 1 year ago

Oh dear, this doesn't sound like very high quality software...

benoitzohar commented 1 year ago

@mattlqx Did you do anything else besides changing the Smart Life password?

~I have the same issue and removing the dashes in the SmartLife account pw + the Tuya account pw, and then re-linking both together, does not fix the issue unfortunately :/~

[Edit: I simply forgot to change the password in the homebridge config too 🤦 It all works now! Thanks a lot for this, I would have spent hours trying to figure this out!]

LoneStar1845 commented 1 year ago

I used the other Tuya plugin. (Tuya Web) instead of the certified Tuya plugin and it fixed everything. Didn't even need the Tuya info, just my smart life login info.

Thank you,

Garrett Patterson

On Fri, Nov 11, 2022 at 5:47 PM Ben Zohar @.***> wrote:

@mattlqx https://github.com/mattlqx Did you do anything else besides changing the Smart Life password?

I have the same issue and removing the dashes in the SmartLife account pw

  • the Tuya account pw, and then re-linking both together, does not fix the issue unfortunately :/

— Reply to this email directly, view it on GitHub https://github.com/tuya/tuya-homebridge/issues/278#issuecomment-1312270269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDXEZSPRVWJX73WVORNVIDWH3LI7ANCNFSM6AAAAAAQDQ3SV4 . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 1 year ago

Stale issue. we will close the issue soon. If this issue has not been resolved, please update the issue and contact us in time.