-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
"tuya-cli link" results in Device(s) failed to be registered! / Error: permission deny #595
Comments
I'm getting the exact same error when I try to add a new device. |
Having this same exact issue. |
Scratch that...I think I figured it out. When you login to the iot.tuya.com interface, click on "Cloud" and then the project you created. You should have created a Cloud Authorization, but you also need to create an App Authorization by clicking on that tab and adding an authorization for the custom App you created earlier. (I'm making a lot of assumptions here :) ) The issue is that your Cloud Project doesn't know anything about the App you created. They're completely separate..you have to let your Cloud project know about your App by authorizing it. |
@waverly360 Thank you for the hint, tried a bit around, but not really advancing. Did you manage to add a link between app and project, and then get further? When I go to cloud->development->my project->authorization->App Authorization->Add Authorization, then 3 authorization types are possible (ios, android, other), I did not get further with adding authorizations for all 3. Most logic choice seems 'Android'. Selecting that one, a sha1 hash is requested, that can apparently be anything, in a format like this: "ec:59:b4:32[..]". Application ID should apparently be same as 'schema', for me "comfluxsmartapp". Values "Authorization Name" and "Description" are apparently just for personal reference. As the docs on https://github.com/codetheweb/tuyapi say, some names in the menus are no longer matching. So for people like me who have not yet used this successfully, it makes things much harder as we have not even played this through in the past. |
@christianhorn You're not wrong about the documentation. My issue (and possibly a lot of folk's issues) is that there are a few different ways to go about this, and I just happened to end up down this path. Heck, I initially started with trying to replace the firmware on all of my Tuya controlled DayBetter bulbs so I could use local control..and ended up down the path of using Local Tuya with the original firmware....I digress :). So, first of all, I ended up using the "Cloud API Explorer" to test things out, specifically the "Get App Details" option. It was a bit easier to do than going back to the CLI everytime. (Tuya IOT Platform->Cloud->API Explorer->Smart Home Device System->Application Management->Get App Details). You can put your schema name in the text box and see if things are linked properly. If it's not, you'll get this: While a successful call looks like this: So first, once you've created your "App", you shouldn't need to do anything else from that section. All of the linking and authorizing should happen from within the "Cloud" section. (You might need to go back to the "App" section to get your id/password info...I'm in the interface now and struggling to recall) Now go into your Cloud project that you created (Tuya IOT Platform->Cloud->Development->Your Custom Project). Here is where I found things to get tricky. Within your project you have several tabs: Overview, Authorization, Service API, Assets, Users, Devices. ***One of the things that messed me up early on is the fact that some of these tabs would cause my browser to refresh, and prevent me from actually going into those sections. Specifically, the Assets/Users/Devices pages seemed to do this, and I would have to re-login and even close my browser at times. All of the following steps should be done within your custom project (some may or may not be needed and the order maybe slightly different...it's hard to remember 😆 ): Authorization->Cloud Authorization - Click "Add Authorization" and follow any additional instructions Authorization->App Authorization - Click "Add Authorization" and pick either the "Tuya IoT App SDK" for iOS or Android (I found the iOS ones easier because you don't have to come up with a SHA Hash. It doesn't matter which you pick I don't think...the bundle identifier/auth name/description can all be anything, but you may need them in a later step. Service API - These were already populated for me, but for the record I have IoT Core, Authorization Token Management, Smart Home Scene Linkage, and Data Dashboard Service. Devices->Link Tuya App Account->Add App Account - This is the part I missed for so long. This will throw a QR code that you will need to scan into the Tuya Smart app on your phone. Open up the Tuya Smart app, click on the profile icon in the bottom right, and then click on the [-] icon in the top right to do this. Devices->Link My App->Add Apps->Link the fake app you created earlier. (I used "Automatic Link" and gave it "Read, write, and Manage" but you might not need to give it full permissions? I think at this point, if you try the test above, you will no longer get a permission denied message. |
As a subsequent note, I think this is what led me down the right path to get this working, even though I hadn't intended to use the project itself: https://pypi.org/project/tinytuya/ There maybe instructions there I neglected to add here. |
@waverly360 Wooho, thanks a bunch for putting this together! I can only encourage others who hit the issue reported to go through the steps from @waverly360 , and if succeeding to send a pull request to update the instructions. While these are not updated, consuming the official steps and the pieces from @waverly360 here seem like the way to go. |
Hey, just to add to this issue for others that are finding this thread:
I hope this will be helpful for someone down the line. |
@s0x00c Great hints! I think I got messages whenever using the wrong data center, so that was easy to debug. I was also using a different app - but also "TUYA Smart' app does not find my device. |
Adding to this: I never figured out the linking command in my case, but I am able to communicate with the plug via CLI because the QR code scanning linked the plug for me.
|
I had a similar issue with permission deny on this step, and I realized I'm chosen wrong data center. So you can find a match here Please note, after changing the datacenter, in Cloud Project you need re-link again under the Devices tab |
Describe the bug
Executing
results in this:
I modified api credentials intentionally and got other errors, so authentication by these should not be the problem. I executed the "tuya-cli link" command on 3 different systems (2x x86-64/Fedora36, 1x raspi4), all with this result. One of the systems was only to the WLAN connected which I use as parameters on the command line, that did not help either.
To Reproduce
Steps to reproduce the behaviour, at least for me with the Tuya-user created as per instructions:
Expected behaviour
Device should be registered.
Debug Output
api-key, api-secret ans wlan-password in the following were changed into [..] .
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: