TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
261 stars 44 forks source link

There was an issue fetching that device #106

Closed tc29200 closed 3 years ago

tc29200 commented 3 years ago

Hi, I followed the Eddie step by step guide to integrate smartlife devices in homekit, get the API key, API secret and virtual ID but no joy : "There was an issue fetching that device". I used the @tuya/cli@1.15.0

Here's my log for sudo npm i @tuyapi/cli -g : 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'i', '@tuya/cli', '-g' ] 2 info using npm@6.14.11 3 info using node@v14.15.3 4 verbose npm-session e760d0382a04abbe 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 http fetch GET 404 https://registry.npmjs.org/@tuya%2fcli 276ms 8 http fetch GET 404 https://registry.npmjs.org/@tuya%2fcli 44ms 9 silly fetchPackageMetaData error for @tuya/cli@latest 404 Not Found - GET https://registry.npmjs.org/@tuya%2fcli - Not found 10 timing stage:rollbackFailedOptional Completed in 0ms 11 timing stage:runTopLevelLifecycles Completed in 430ms 12 verbose stack Error: 404 Not Found - GET https://registry.npmjs.org/@tuya%2fcli - Not found 12 verbose stack at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15 12 verbose stack at processTicksAndRejections (internal/process/task_queues.js:93:5) 13 verbose statusCode 404 14 verbose pkgid @tuya/cli@latest 15 verbose cwd /Users/tristancocrelle 16 verbose Darwin 20.2.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "@tuya/cli" "-g" 18 verbose node v14.15.3 19 verbose npm v6.14.11 20 error code E404 21 error 404 Not Found - GET https://registry.npmjs.org/@tuya%2fcli - Not found 22 error 404 23 error 404 '@tuya/cli@latest' is not in the npm registry. 24 error 404 You should bug the author to publish it (or use the name yourself!) 25 error 404 Note that you can also install from a 26 error 404 tarball, folder, http url, or git url. 27 verbose exit [ 1, true ]

Can you help me out ? Thank you.

codetheweb commented 3 years ago

That should be

sudo npm i @tuyapi/cli -g

not

sudo npm i @tuya/cli -g.

tc29200 commented 3 years ago

Error on my comment. I did use sudo npm i @tuyapi/cli -g

codetheweb commented 3 years ago

Ok, did that result in the same NPM install error or something else?

tc29200 commented 3 years ago

thank you for trying to help Codetheweb. The log error was with tuya/cli.

I started all over again : node.js installed. node -v : v14.15.3 npm - v : 6.14.11 sudo npm install -g --unsafe-perm homebridge homebridge-config-ui-x : ok sudo hb-service install npm i @tuyapi/cli -g : ok v 1.15.0 sudo tuya/cli wizard : I gave API key, API secret and virtual ID from Tuya IoT platform Then I get the error message : There was an issue fetching that device. Make sure your account is linked and the ID is correct. What's wrong ?

codetheweb commented 3 years ago

Please re-run the command like this: DEBUG=* sudo tuya-cli wizard and post the output. It should print a more descriptive error message. The most likely cause is that one of the parameters (API key/secret, device ID) is incorrect.

tc29200 commented 3 years ago

It's exactly the same thing : ? The API key from tuya.com: ps8xxxxxxxxxxxxx ? The API secret from tuya.com 8605142xxxxxxxxxxxxxxxxxxxxxx ? Provide a 'virtual ID' of a device currently registered in the app: 700282xxxxxxxxxxx There was an issue fetching that device. Make sure your account is linked and the ID is correct.

codetheweb commented 3 years ago

Oh my bad, sudo isn't preserving the DEBUG environment variable.

Try

export DEBUG=*
sudo -E tuya-cli wizard

?

But you shouldn't need sudo to run tuya-cli since it's not modifying anything on your system.

tc29200 commented 3 years ago

Thanx. I got this error message :

[ Error: you don't have access to this API at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:73:31) at EventEmitter. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38) at processTicksAndRejections (internal/process/task_queues.js:93:5), Error: you don't have access to this API at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:73:31) at EventEmitter. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38) at processTicksAndRejections (internal/process/task_queues.js:93:5), Error: you don't have access to this API at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:73:31) at EventEmitter. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38) at processTicksAndRejections (internal/process/task_queues.js:93:5) ] There was an issue fetching that device. Make sure your account is linked and the ID is correct.

codetheweb commented 3 years ago

Looks like you may have not fully completed step 4 of the setup instructions.

tc29200 commented 3 years ago

Excellent. I got the keys ! Thank you so much.

codetheweb commented 3 years ago

Glad you got it working. 👍