cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open chrisjshull opened this issue 3 years ago • 5 comments

~> 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.

chrisjshull avatar Mar 21 '21 03:03 chrisjshull

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

codetheweb avatar Mar 21 '21 17:03 codetheweb

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.

chrisjshull avatar Mar 21 '21 18:03 chrisjshull

It looks like you might have missed step 5 here.

codetheweb avatar Mar 21 '21 20:03 codetheweb

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."?

chrisjshull avatar Mar 21 '21 20:03 chrisjshull

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.

kingtao1024 avatar Apr 14 '22 08:04 kingtao1024