smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 24 forks source link

[Tuya] skill id invalid from tuya cloud #421

Closed BigGeorgeTx closed 1 year ago

BigGeorgeTx commented 1 year ago

I have been using the Tuya binding for a while. I noticed I was getting error message from the Tuya cloud, so I just disabled it because my existing devices work fine locally. Then I bought a new Tuya device. I can log into iot.tuya.com and see the new device, but I am unable to get the binding to auto detect and create a new thing.

This is what I see in the log: 2022-11-18 14:26:56.793 [TRACE] [ding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaus.com/v1.0/iot-01/associated-users/actions/authorized-login': Method = {POST}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, access_token: , sign_method: HMAC-SHA256, Signature-Headers: client_id, t: 1668803216789, client_id: teg4k8qkb9s7ys9dpd9f, sign: 04952B2AA551765AB125B34AC9B3647822E064023C15F3A610784F665FD4AEDD, Content-Type: application/json}, Content = {{"username":"xxxx@xxxxxx.com","password":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","country_code":1,"schema":"smartLife"}} 2022-11-18 14:26:56.882 [TRACE] [a.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaus.com/v1.0/iot-01/associated-users/actions/authorized-login': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 113, Connection: keep-alive, Date: Fri, 18 Nov 2022 20:26:56 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, Gateway-Info: highway, Server: Tuya-Sec, Strict-Transport-Security: max-age=31536000}, Content = {{"code":2406,"msg":"skill id invalid","success":false,"t":1668803216846,"tid":"58e52cb5677f11ed954a6ebb44969c0f"}} 2022-11-18 14:26:56.884 [WARN ] [ding.tuya.internal.cloud.TuyaOpenAPI] - Request failed: Result{timestamp=1668803216846, code=2406, msg=skill id invalid, success=false, result=null}, no token received

I tried restarting the binding. When that didn't work, I tried stopping openhab, clearing the cache and starting openHAB. When that didn't work, I tried rebooting my Pi4B running openhabian.

I searched the internet and it seems like this is a Data Center / Country code problem, but I'm in the US which is Western America Datacenter and Country code 1, which is what I have in the binding UI. I'm running out of troubleshooting ideas.

BigGeorgeTx commented 1 year ago

I don't use the email associated with my Tuya IOT account very often, but searched it for Tuya and found a Service Notification:

`Dear developer,

Your subscription IoT Core, Cloud Develop Base Resource Trial has 0.00% available. Once the quota limit is exceeded, the usage overage will be billed.

If you want to raise the limit,

you can click the link below to upgrade your plan.

https://www.tuya.com/vas/tmpl/apply?code=IOT_CORE_V2

You are the account owner of the Tuya IoT Platform and have the right to be notified of any change in your subscription plan. If you do not use the service mentioned above in your business, please ignore this email.

If you are unclear about how to proceed, please contact your account manager or file a service ticket.

This is an automated email, please do not reply to this email. If you have any questions, please email us at service@tuya.com`

I don't want to have to pay Tuya to make this work. I will poke around their site and see what I find.

BigGeorgeTx commented 1 year ago

Based on the above, I clicked on the "Upgrade IoT Core Plan" button on the main Cloud page. That gave me the option of "purchasing" another free 1 month trial, which I did. I also noticed that my last 1 month trial lasted from 1 Jan 2022 to 18 Aug 2022, which is probably when I started having the problem.

It didn't resolve the problem immediately. I tried taking the account thing offline for 5 minutes. That didn't help. Neither did restarting the bundle. Neither did restarting openHAB (systemctl restart openhab). I then tried stopping openHAB, cleaning the cache (sudo openhab-cli clean-cache) and then starting openHAB. No luck.

Perhaps Tuya needs a little time for my new "subscription" to replicate through their servers. Or perhaps I'm barking up the wrong tree.

Update: the next day, still not working

BigGeorgeTx commented 1 year ago

I'm wondering if I should create a new Tuya account, using a different email address?

BigGeorgeTx commented 1 year ago

Tried creating a new Tuya IOT account. Devices are visible in the new account on Tuya cloud, but still getting same error in openHAB.

@J-N-K Any suggestions? Thanks

J-N-K commented 1 year ago

Frankly, I have no idea. It still works for me with the account I created when developing the binding.

Did you try unlinking in the cloud project, unlinking in the app and re-linking? It seems that helped, even with an old project.

BigGeorgeTx commented 1 year ago

Thanks for getting back to me so quickly.

I did as you suggested (logged out of Smart Life App on phone and iPad, unlinked the Tuya App (Tuya IOT/Cloud/Project /Devices/Link Tuya App). When I relinked (first in the iPhone App because the Tuya Cloud Link Tuya App asked me to scan in the app the QR code displayed on the web browser window), the account thing came back on line!

And a couple of minutes later, my new device was in the Thing Inbox.

Thanks for your help.