TuyaAPI / cli

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

There was an issue fetching that device. Make sure your account is linked and the ID is correct. #115

Open chrisjshull opened 3 years ago

chrisjshull commented 3 years ago
~> tuya-cli wizard
? The API key from tuya.com: xxx
? The API secret from tuya.com xxx
? Provide a 'virtual ID' of a device currently registered in the app: xxx
There was an issue fetching that device. Make sure your account is linked and the ID is correct.
~> tuya-cli -V
1.15.2

Have triple checked. I am sure I've followed the directions for the key / secret / virtual id.

codetheweb commented 3 years ago

Please run DEBUG=* tuya-cli wizard and post the output.

chrisjshull commented 3 years ago
bash-3.2$ DEBUG=* tuya-cli wizard
? The API key from tuya.com: xxx
? The API secret from tuya.com xxx
? Provide a 'virtual ID' of a device currently registered in the app: xxx
[
  Error: you don't have access to this API
      at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:74:31)
      at EventEmitter.<anonymous> (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38)
      at processTicksAndRejections (node:internal/process/task_queues:94:5),
  Error: you don't have access to this API
      at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:74:31)
      at EventEmitter.<anonymous> (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38)
      at processTicksAndRejections (node:internal/process/task_queues:94:5),
  Error: you don't have access to this API
      at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:74:31)
      at EventEmitter.<anonymous> (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38)
      at processTicksAndRejections (node:internal/process/task_queues:94:5),
  Error: you don't have access to this API
      at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/openapi/dist/api.js:74:31)
      at EventEmitter.<anonymous> (/Users/chrisjshull/homebrew/lib/node_modules/@tuyapi/cli/node_modules/got/dist/source/as-promise.js:87:38)
      at processTicksAndRejections (node:internal/process/task_queues:94:5)
]
There was an issue fetching that device. Make sure your account is linked and the ID is correct.
codetheweb commented 3 years ago

It looks like you might have missed step 5 here.

chrisjshull commented 3 years ago

Aha! I missed the part in 5 about authorizing the project.

Anyway, should https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md#linking-a-tuya-device-with-smart-link be linked from the readme for this project?

And can a better error be output for this case than "There was an issue fetching that device. Make sure your account is linked and the ID is correct."?

kingtao1024 commented 2 years ago

I have the same error,could you please help me check the log as follow?thank you very much!

[Error: GET_TOKEN_FAILED 2007, your ip(1**...0) cross-region access is not allowed at TuyaOpenApiClient. (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuya/tuya-connector-nodejs/lib/core/client.js:123:35) at step (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuya/tuya-connector-nodejs/lib/core/client.js:52:23) at Object.next (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuya/tuya-connector-nodejs/lib/core/client.js:33:53) at fulfilled (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuya/tuya-connector-nodejs/lib/core/client.js:24:58) at processTicksAndRejections (node:internal/process/task_queues:96:5),

There was an issue fetching that device. Make sure your account is linked and the ID is correct.