jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
978 stars 173 forks source link

Account links, but doesn't recognise devices. #100

Closed Alex-Programs closed 1 year ago

Alex-Programs commented 2 years ago

Hello, I followed the instructions, and have the: device id data centre asset name asset email asset password access id/client id access secret/client secret user id

When looking at my user, it doesn't seem to have identified my one linked device (A smart switch): image

image

I would appreciate some help.

Thanks for making this project.

jasonacox commented 2 years ago

Did you add your devices to the Smart Life app?

If you try python3 -m tinytuya wizard using the access id/secret, what error do you get?

tomungh commented 2 years ago

I have the same problem. I thought it might be because I'd used the Tuya Smart app and not Smart Life, but after moving a device to the Smart Life app with a new account and adding that app account to the website it still shows 0 devices.

The error from the wizard is "permission deny", and if I choose the wrong region I get "cross-region access is not allowed"

tomungh commented 2 years ago

The answer was under another issue. I needed to change my project's datacentre to Central Europe to show devices in the UK.

jasonacox commented 2 years ago

Thanks @Alan-James - I'm glad you got it to twork. I do wish there was a better way help with the setup. Let me know if you have any ideas.

tomungh commented 2 years ago

In the docs after scanning the qr code you could add a mention that if the number of devices shows as zero you may have chosen the wrong data centre.

It would also be worth mentioning that if you have your devices in the Tuya Smart app then that works just as well as the Smart Life one, no need to switch apps. The other app is this one https://play.google.com/store/apps/details?id=com.tuya.smart

Also while setting up I noticed some popups on the tuya site saying they'd merged a bunch more features into the IoT core so the other APIs might not be needed now. I didn't bother testing that though.

In general the documentation is very good and I'm controlling my devices already.

jasonacox commented 2 years ago

Thanks @Alan-James! I updated the instructions based on your advice. If you can, take a look and let me know if this makes sense: https://github.com/jasonacox/tinytuya#setup-wizard---getting-local-keys

tomungh commented 2 years ago

Hi @jasonacox, It does make sense, and should help, but you can edit your project to change the data centre rather than create a new one. You can also choose multiple data centres when editing, so @AlexAndHisScripts could just choose them all and see if that solves his problem.

jasonacox commented 2 years ago

Thanks @Alan-James , that's a good point. However, there have been several issues like #96 that indicate that even with multiple data centres selected, you might get denied during the Wizard setup process. It seems that Tuya is aggressive about regions. If you call from an IP that looks like it is outside of the region they expect, it will be denied. TinyTuya cloud functions and the wizard, use region to determine the API endpoint hostname to use (per Tuya's documentation) so the IP restrictions/denials may be more related to that than the data centre you choose in the IoT platform.

In any case, thank you for the the help! I'll update the instructions about "editing" the project instead of "creating a new one".