unable to connect my devices
Hi team First of all great work ! The SCAN works perfectly great. I can detect 2 of my devices. I also get that warning : DEVICE KEY required to poll for status snapshot.json contains my 2 devices with the correct data.
first problem, when I run the wizard, I get this error 👍 Error from Tuya server: Error from Tuya Cloud: Code 1106: 'permission deny' Check DeviceID and Region
I checked all the parameters all seem to be ok
then, if I edit the sample and change the device ID, IP, Local key (version is fine) .. I get this error 👍 set_status() result {'Error': 'Network Error: Unable to Connect', 'Err': '901', 'Payload': None}
Could you guide me in order to fix this issue ?
Thanks a lot !
regards
Hi @fes-h ! Tuya recently changed the permissions for their API, so you need to upgrade tinytuya to v1.12.3 or above to get the wizard to work again. You can check what the currently installed version is with python -m tinytuya -h and upgrade if needed with pip install --upgrade tinytuya.
Since you were getting that permission deny error, what did you use for your local key? The devices won't respond if the key is incorrect.
Hi, thanks a lot for your quick response ! The version I am using seem to be ok : 1.12.4
regarding the key I ran the "python -m tinytuya wizard " command, and provided all the info. The error I am getting when I validate is : "Error from Tuya server: Error from Tuya Cloud: Code 1106: 'permission deny' Check DeviceID and Region"
When I run this command again, the settings are ok on screen.. but get another permission denied error.. so I suspect I need to fix this first.
So to answer your question (what did you use for local key), my understanding is that don't have it yet due to the error. They key I provided in the wizard were (copy/paste) taken in the overview section.
Will recheck asap my config.. but of course if there is something obvious let me know.
Thanks a lot !
Best regard fred
It sounds like either a) the wrong Region was entered, b) the Device ID entered is wrong, or c) the device is not linked with your Tuya developer account. I'd run the wizard again with debugging turned on, and enter the word scan as the device ID:
python -m tinytuya wizard -d
Enter n at Use existing credentials (Y/n)
Enter scan at Enter any Device ID
Make sure you select the correct region at Enter Your Region
Since debugging is turned on, it should tell you which URL is failing. The first call should be to something like DEBUG:https://openapi.tuyaus.com:443 "GET /v1.0/token?grant_type=1 HTTP/1.1", and the next should be DEBUG:https://openapi.tuyaus.com:443 "GET /v1.0/devices/####### HTTP/1.1".
Hi, Thanks a lot. Regarding the FIRST GET I have this 👍 DEBUG:GET: URL=https://openapi-weaz.tuyaeu.com/v1.0/token?grant_type=1 HEADERS={'Content-type': 'application/json', 'Signature-Headers': 'Content-type', 'secret': '4xxxxxxxx', 'client_id': 'nxxxxx', 'sign': '44148A37703D9A4[redacted]', 't': '1682153830455', 'sign_method': 'HMAC-SHA256', 'mode': 'cors'} response code=200 text={"result":{"access_token":"a4[redacted]","expire_time":7200,"refresh_token":"08[redacted]","uid":"bay165[redacted]"},"success":true,"t":1682153830630,"tid":"aacaacace0eb11edb0eb92b981dea67b"} token=None
Then on the next one, this is where I get the permission DENIED
DEBUG:GET: URL=https://openapi-weaz.tuyaeu.com/v1.0/devices/9b7cc920e59eda6e92wfvw HEADERS={'Content-type': 'application/json', 'Signature-Headers': 'Content-type', 'client_id': 'nzzzz', 'sign': '71B8E4CD3B9FFFEA4[redacted]', 't': '1682153830636', 'sign_method': 'HMAC-SHA256', 'mode': 'cors', 'access_token': 'a4zzzz'} response code=200 text={"code":1106,"msg":"permission deny","success":false,"t":1682153830840,"tid":"aadb56d5e0eb11ed89772e10dea43dda"} token=a41[redacted] DEBUG:Error from Tuya Cloud: 'permission deny' DEBUG:ERROR Error Response from Tuya Cloud - 913 - payload: "Error from Tuya Cloud: Code 1106: 'permission deny'"
=> Note here that I changed for this comment part of the secret data, so don't be afraid if secrets, ids are not the same
regarding the device, the identifier is : 9b7cc920e59eda6e92wfvw. the device is connected. If I query it though API Exlorer, I can get the status with no error.
I will review the full config later today or tomorrow, and let you know. want to make sure I did not miss a step in your process.
Thanks again !
regards
When you query it though API Explorer, what is the curl URL it is showing? I.e. curl --request GET "https://openapi.tuyaus.com/v1.0/iot-03/devices/#####/specification"
Hi This is what I get : curl --request GET "https://openapi-weaz.tuyaeu.com/v1.0/iot-03/devices/9b7cc920e59eda6e92wfvw/specification" --header "sign_method: HMAC-SHA256" --header "client_id: ngabc" --header "t: 1682251871729" --header "mode: cors" --header "Content-Type: application/json" --header "sign: 850CA0DBF4E48D43CC9EC278ABAFE5777DCB1D5EFFD06BBAF1E3FF9D6819EAAC" --header "access_token: 5b228ece801560793c0fbed95d0a8450"
Thanks ! fred
Well, I'm all out of ideas :( Perhaps @jasonacox can think of something I missed?
HI @fes-h - this is interesting. The IoT settings may not be correct. Make sure these API service are set up:
How-to guide: https://github.com/jasonacox/tinytuya/files/8145832/Tuya.IoT.API.Setup.pdf
SERVICE API: Under "Service API" ensure these APIs are listed: IoT Core, Authorization and Smart Home Scene Linkage. To be sure, click subscribe again on every service. Very important: disable popup blockers otherwise subscribing won't work without providing any indication of a failure. Make sure you authorize your Project to use those APIs: Click "Service API" tab Click "Go to Authorize" button Select the API Groups from the dropdown and click Subscribe (screenshot)
Hi
thanks a lot.
It seem to be ok even if the GUI is a bit different on my side. Allow me to share the screenshot

then

I can definitely share my screen if you want to have a quick view ;-)
Thanks a lot
regards fred
Hi Fred,
Yes, those look good. In the past, there have been issues with datacenter mis-match based on where people are located. It doesn't line up to geography very well (some eu are really eu-w even if they aren't in the West).
I just noticed this above and it shows you are set to eu-w:
This is what I get : curl --request GET "https://openapi-weaz.tuyaeu.com/v1.0/iot-03/devices/9b7cc920e59eda6e92wfvw/specification"
First, check the data centers that are selected for you - and if possible select all of them, but at least both for Europe:
When you ran wizard did you use eu or eu-w? Try again but use the opposite one you used before.