Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TUYA Binding | API permission package error | Device not discovered #589

Open
cd-tronic opened this issue Sep 4, 2024 · 1 comment

Comments

@cd-tronic
Copy link

First of all: I created a Tuya Cloud account and followed all instructions on the docs.
Adding the Cloud Account to OH worked fine. But no devices got discovered.
After setting the Loglevel to "DEBUG" i got this message every 5 seconds:

[DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener: Received MessageWrapper{commandType=BROADCAST_LPV34, content='DiscoveryMessage{ip='192.168.100.119', deviceId='bfa6b9267dc1d5562anlkg', active=2, ability=0, mode=0, encrypt=true, productKey='abb8kaxcphfzkwsg', version='3.4', token= true, wf_cfg=true}'}
I then changed loglevel to TRACE and started searching for devices. The Logs shows the following:

2024-08-28 16:45:06.651 [TRACE] [ding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/users/eu1724765998599WwnVh/devices?from=&page_no=1&page_size=100': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.54.v20240208, Signature-Headers: client_id, t: 1724856306650, client_id: dxkwxfg4vqrsps5h7g5j, sign: CC1419959B27265510A91B65AA62096C9B1EF8F0C3AB6E02E8795C9E3C71297C, access_token: 0dca559f7c6922696368ffd784120ba3, sign_method: HMAC-SHA256}, Content = {null}

2024-08-28 16:45:06.885 [TRACE] [a.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/users/eu1724765998599WwnVh/devices?from=&page_no=1&page_size=100': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 754, Connection: keep-alive, Date: Wed, 28 Aug 2024 14:45:06 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com,https://platform.tuya.com, Gateway-Info: highway, Server: Sec, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"active_time":1724766112,"biz_type":0,"category":"znrb","create_time":1724766112,"icon":"smart/icon/bay1637720139432gd6R/835c8f12f579e6ac1bd0acc170824cd5.png","id":"bfa6b9267dc1d5562anlkg","ip":"217.142.18.121","lat":"49.2416","local_key":"7hu\u003er[.Uv-qvFeH[","lon":"12.6869","model":"","name":"WP Pool","online":true,"owner_id":"202742480","product_id":"abb8kaxcphfzkwsg","product_name":"Heat Pump","status":[{"code":"switch","value":true},{"code":"temp_set","value":320},{"code":"temp_current","value":256},{"code":"work_state","value":"standby"}],"sub":false,"time_zone":"+02:00","uid":"eu1724765998599WwnVh","update_time":1724849519,"uuid":"326719f21e6675b1"}],"success":true,"t":1724856306870,"tid":"1e0f8d2b654c11ef883136d89ae34f8e"}}

2024-08-28 16:45:06.889 [TRACE] [ding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfa6b9267dc1d5562anlkg': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.54.v20240208, Signature-Headers: client_id, t: 1724856306888, client_id: dxkwxfg4vqrsps5h7g5j, sign: 5D8FA1F0CF7452E52724E544F5FA192BE7D09D9B6D6C5521635F2E89CB898933, access_token: 0dca559f7c6922696368ffd784120ba3, sign_method: HMAC-SHA256}, Content = {null}

2024-08-28 16:45:06.984 [TRACE] [a.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfa6b9267dc1d5562anlkg': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 231, Connection: keep-alive, Date: Wed, 28 Aug 2024 14:45:06 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com,https://platform.tuya.com, Gateway-Info: highway, Server: Sec, Strict-Transport-Security: max-age=31536000}, Content = {{"code":60009001,"msg":"API permission package error. For the solution, see https://developer.tuya.com/en/docs/iot/authentication-method?id=Ka49gbaxjygox.","success":false,"t":1724856306971,"tid":"1e217e45654c11ef95a3c283ae9aa908"}}

It looks like something changed on TUYA side. Also the "Authorization" API is not available any more. I added "Authorization Token Management API" instead.

I managed to get my TUYA Heat Pump controlled by adding the device manually and entering all the DPs by myself.

Here is my community post to this issue.
Also Check the message of ReasonX and my answer on his post.
https://community.openhab.org/t/smarthome-j-tuya-binding-for-openhab-4/147193/124?u=cd-tronic

@Amrom
Copy link

Amrom commented Oct 9, 2024

I have the same error
Looks to me that it's the same issue as this
/v1.0/iot-03/devices needs to be replaced to /v1.0/devices here
@J-N-K @rogrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants