tuyapi icon indicating copy to clipboard operation
tuyapi copied to clipboard

Device(s) Failed to be registered!

Open rbyers8252 opened this issue 8 years ago • 102 comments

I've created the Tuya account and obtained the ID and Key from the site.

When I go to add a device I get the following error. × Device(s) failed to be registered! Error: Timed out wating for device(s) to connect to cloud at Promise (C:\Users\xxxxxx\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules@tuyapi\cloud\index.js:275:12) at

I'm using this smart plug https://www.amazon.com/gp/product/B07CHMDP1G/ref=oh_aui_detailpage_o09_s00?ie=UTF8&psc=1 with the Smart Life app. Running Charles on my iPhone I can confirm it's communicating through the Tuya Cloud. I put the switch in pairing mode but the wizard never finds it. Instantly can add it back to the Smart Life app though.

I use the iOS APP KEY from Tuya for apikey in the wizard and iOS APP Secret from Tuya for apisecret in the wizard. Am I doing something wrong?

rbyers8252 avatar Aug 16 '18 01:08 rbyers8252

@rbyers8252 everything sounds good...

I'm not sure what shell you're using on Windows, but can you please set the environment variable DEBUG to *, run the linking wizard again, and post the output?

codetheweb avatar Aug 16 '18 01:08 codetheweb

Very strangely, setting the environment var DEBUG to * already did the trick for me.

ghost avatar Aug 16 '18 17:08 ghost

Not an expert with all of this. Been a long time since I did a bunch of this. How do I set the environment var debug to * ?

rbyers8252 avatar Aug 16 '18 17:08 rbyers8252

I managed to find it for windows cmd SET DEBUG=* or $env:DEBUG = "*" for powershell I have the same error and I got a minute of this.

`- Registering devices(s)... @tuyapi/cloud Sending parameters: +202ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '6kkpgqusqcttueoa3502kj6vujbd0pya64u7t7l3k5h4', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'my ios app key', @tuyapi/cloud time: 1534504445, @tuyapi/cloud postData: '{"token":"cWW0KWZt"}', @tuyapi/cloud sid: 'az15344262526951vjKzyby31f70b89116d7c63518372b15a642803f', @tuyapi/cloud sign: 'dd7454007571175f79633aa0766a611f' } +3ms

  • Registering devices(s)... @tuyapi/cloud Received response: +530ms @tuyapi/cloud {"result":[],"t":1534504449201,"success":true,"status":"ok"} @tuyapi/cloud +5ms | Registering devices(s)... @tuyapi/cloud Sending parameters: +204ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '6kkpgqusqcttueoa3502kj6vujbd0pya64u7t7l3k5h4', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'my ios app key', @tuyapi/cloud time: 1534504446, @tuyapi/cloud postData: '{"token":"cWW0KWZt"}', @tuyapi/cloud sid: 'az15344262526951vjKzyby31f70b89116d7c63518372b15a642803f', @tuyapi/cloud sign: '02154a22499d79e19e792893c72d6068' } +5ms | Registering devices(s)... @tuyapi/cloud Received response: +489ms @tuyapi/cloud {"result":[],"t":1534504449907,"success":true,"status":"ok"} @tuyapi/cloud +5ms / Registering devices(s)... @tuyapi/cloud Sending parameters: +203ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '6kkpgqusqcttueoa3502kj6vujbd0pya64u7t7l3k5h4', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'my ios app key', @tuyapi/cloud time: 1534504447, @tuyapi/cloud postData: '{"token":"cWW0KWZt"}', @tuyapi/cloud sid: 'az15344262526951vjKzyby31f70b89116d7c63518372b15a642803f', @tuyapi/cloud sign: '605009dd21ab4e4e29f1419266edfe2d' } +2ms / Registering devices(s)... @tuyapi/cloud Received response: +533ms @tuyapi/cloud {"result":[],"t":1534504450647,"success":true,"status":"ok"} @tuyapi/cloud +4ms × Device(s) failed to be registered! Error: Timed out wating for device(s) to connect to cloud at Promise (C:\Users\Stephen\AppData\Roaming\npm\node_modules@tuyapi\cli\node_modules@tuyapi\cloud\index.js:275:12) at `

with no registration

stephenmhall avatar Aug 17 '18 11:08 stephenmhall

If I register it through the app is it the

@tuyapi/cloud deviceId: '6kkpgqusqcttueoa3502kj6vujbd0pya64u7t7l3k5h4', that I need to use the API?

stephenmhall avatar Aug 17 '18 11:08 stephenmhall

@BenjaminKauer if possible, could you run a few tests and see if setting DEBUG=* is the only reason it worked? If so, that's a rather strange bug that needs to be fixed.

@stephenmhall what's your configuration? Does the computer you're running the tool from have a (enabled) wireless card?

Sometimes devices get "stuck", and unplugging then plugging them back in seems to help.

codetheweb avatar Aug 18 '18 01:08 codetheweb

@stephenmhall what's your configuration? Does the computer you're running the tool from have a (enabled) wireless card?

Ok can I assume from this my PC has to be on the wifi not lan? Now I think about it of course it needs a wifi connection as it will need to connect to the plug before it gets placed on my network. Sorry fundamental misunderstanding from me there. I have wifi but disabled, I will have another go.

stephenmhall avatar Aug 18 '18 09:08 stephenmhall

well, a lot of it looks to be working but it never registers.

`- Registering devices(s)... @tuyapi/cloud Sending parameters: +0ms @tuyapi/cloud { a: 'tuya.m.user.email.register', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584771, @tuyapi/cloud postData: '{"countryCode":"AZ","email":"[email protected]","passwd":"8ac4253450b2e0eccdfe0fa24036b6d5"}', @tuyapi/cloud sign: 'ae425b03f88f2fadf1fa6015d14aa676' } +2ms | Registering devices(s)... @tuyapi/cloud Received response: +858ms @tuyapi/cloud {"t":1534584773312,"success":false,"errorCode":"USER_NAME_IS_EXIST","status":"error","errorMsg":"Username exists."} @tuyapi/cloud +4ms @tuyapi/cloud Sending parameters: +3ms @tuyapi/cloud { a: 'tuya.m.user.email.password.login', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584772, @tuyapi/cloud postData: '{"countryCode":"AZ","email":"[email protected]","passwd":"8ac4253450b2e0eccdfe0fa24036b6d5"}', @tuyapi/cloud sign: '0e79cffff18b546803ceec5c6c2e57e9' } +1ms | Registering devices(s)... @tuyapi/cloud Received response: +578ms @tuyapi/cloud {"result":{"timezone":"","tempUnit":1,"sid":"az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5","uid":"az1534422526951vKzyb","nickname":"","phoneCode":"AZ","email":"[email protected]","snsNickname":"","improveCompanyInfo":false,"dataVersion":0,"sex":0,"accountType":1,"mobile":"","headPic":"","ecode":"z5z453311141424z","domain":{"deviceHttpUrl":"http://a.tuyaus.com","deviceHttpsUrl":"https://a2.tuyaus.com","deviceMediaMqttUrl":"s.tuyaus.com","deviceMqttsUrl":"m2.tuyaus.com","gwApiUrl":"http://a.gw.tuyaus.com/gw.json","gwMqttUrl":"mq.gw.tuyaus.com","mobileApiUrl":"https://a1.tuyaus.com","mobileMediaMqttUrl":"s.tuyaus.com","mobileMqttUrl":"mq.mb.tuyaus.com","mobileMqttsUrl":"m1.tuyaus.com","pxApiUrl":"http://px.tuyaus.com","regionCode":"AZ"},"timezoneId":"","userType":1,"partnerIdentity":"p1095947","username":"[email protected]"},"t":1534584773911,"success":true,"status":"ok"} @tuyapi/cloud +4ms @tuyapi/cloud Sending parameters: +3ms @tuyapi/cloud { a: 'tuya.m.device.token.create', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584773, @tuyapi/cloud postData: '{"timeZone":"-05:00"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'd8af7efbc00f1722c04fe150e0ece126' } +1ms / Registering devices(s)... @tuyapi/cloud Received response: +547ms @tuyapi/cloud {"result":{"secret":"WU1C","token":"M4byJnXr"},"t":1534584774466,"success":true,"status":"ok"} @tuyapi/cloud +1ms @tuyapi/link:wizard Token: { secret: 'WU1C', token: 'M4byJnXr' } +0ms @tuyapi/link:manual Sending SmartLink initialization packets +0ms @tuyapi/link:wizard Polling cloud for details on token... +5ms @tuyapi/cloud Sending parameters: +12ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584773, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'ae16b8a5a59f20c9787b0e1a7785aa86' } +1ms / Registering devices(s)... @tuyapi/cloud Received response: +544ms @tuyapi/cloud {"result":[],"t":1534584775017,"success":true,"status":"ok"} @tuyapi/cloud +4ms

  • Registering devices(s)... @tuyapi/cloud Sending parameters: +203ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584774, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '6a68734d6e61cf5caee959cd7123dccc' } +4ms
  • Registering devices(s)... @tuyapi/cloud Received response: +526ms @tuyapi/cloud {"result":[],"t":1534584775761,"success":true,"status":"ok"} @tuyapi/cloud +4ms | Registering devices(s)... @tuyapi/cloud Sending parameters: +205ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584775, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '2e2059d4bf06cf422beb8eaa205c1644' } +4ms | Registering devices(s)... @tuyapi/cloud Received response: +526ms @tuyapi/cloud {"result":[],"t":1534584776498,"success":true,"status":"ok"} @tuyapi/cloud +4ms
  • Registering devices(s)... @tuyapi/cloud Sending parameters: +203ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584775, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '2e2059d4bf06cf422beb8eaa205c1644' } +2ms
  • Registering devices(s)... @tuyapi/cloud Received response: +629ms @tuyapi/cloud {"result":[],"t":1534584777333,"success":true,"status":"ok"} @tuyapi/cloud +4ms | Registering devices(s)... @tuyapi/cloud Sending parameters: +201ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584776, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'b476c9b141cfcf5c501574df30eb87db' } +4ms | Registering devices(s)... @tuyapi/cloud Received response: +525ms @tuyapi/cloud {"result":[],"t":1534584778075,"success":true,"status":"ok"} @tuyapi/cloud +4ms / Registering devices(s)... @tuyapi/cloud Sending parameters: +202ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584777, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '8c62542333578bd8c5894327af0e380e' } +4ms / Registering devices(s)... @tuyapi/cloud Received response: +500ms @tuyapi/cloud {"result":[],"t":1534584778790,"success":true,"status":"ok"} @tuyapi/cloud +4ms \ Registering devices(s)... @tuyapi/cloud Sending parameters: +203ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584778, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'd45ac6915e5ae6529e191eb62b9b42eb' } +4ms \ Registering devices(s)... @tuyapi/cloud Received response: +541ms @tuyapi/cloud {"result":[],"t":1534584779529,"success":true,"status":"ok"} @tuyapi/cloud +4ms / Registering devices(s)... @tuyapi/cloud Sending parameters: +203ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584778, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'd45ac6915e5ae6529e191eb62b9b42eb' } +2ms
  • Registering devices(s)... @tuyapi/link:manual Sending SmartLink data packets +5s / Registering devices(s)... @tuyapi/cloud Received response: +592ms @tuyapi/cloud {"result":[],"t":1534584780333,"success":true,"status":"ok"} @tuyapi/cloud +4ms \ Registering devices(s)... @tuyapi/cloud Sending parameters: +201ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584779, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: 'd979424725ed612765e9f2f9e3f75783' } +2ms`

Then what looks to be 37 seconds later.

`| Registering devices(s)... @tuyapi/cloud Received response: +591ms @tuyapi/cloud {"result":[],"t":1534584817699,"success":true,"status":"ok"} @tuyapi/cloud +4ms / Registering devices(s)... @tuyapi/link:manual Finished sending packets. +38s

  • Registering devices(s)... @tuyapi/cloud Sending parameters: +206ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584817, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '22915bddd1057fe029e9af2eae623397' } +3ms / Registering devices(s)... @tuyapi/cloud Received response: +523ms @tuyapi/cloud {"result":[],"t":1534584818428,"success":true,"status":"ok"} @tuyapi/cloud +6ms`

Then the same lines over and over for another 107 seconds until, sorry couldnt get the next block to format.

| Registering devices(s)... @tuyapi/cloud Sending parameters: +204ms @tuyapi/cloud { a: 'tuya.m.device.list.token', @tuyapi/cloud deviceId: '5fpd9gbt61dgwr5vz2y70xcj5xuj3e0xdqt5vqtnawht', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'myID', @tuyapi/cloud time: 1534584924, @tuyapi/cloud postData: '{"token":"M4byJnXr"}', @tuyapi/cloud sid: 'az153442r2526951vxKzybb3e55dda0f3008986a3d2e77ca1881d5b5', @tuyapi/cloud sign: '2217ac6a22004d3e69a19495f69635a2' } +4ms | Registering devices(s)... @tuyapi/cloud Received response: +500ms @tuyapi/cloud {"result":[],"t":1534584925516,"success":true,"status":"ok"} @tuyapi/cloud +4ms Device(s) failed to be registered! Error: Timed out wating for device(s) to connect to cloud at Promise (C:\Users\Stephen\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\@tuyapi\cloud\index.js:275:12) at <anonymous>

stephenmhall avatar Aug 18 '18 09:08 stephenmhall

After all this it might be a faulty unit. I can't register it using the Smart Life app either. Came as a pair and the first one registered fine on the app.

stephenmhall avatar Aug 18 '18 11:08 stephenmhall

I got this after 116 seconds trying the pre registered one. It did however remove it from the app. It was re discovered by the app ok.

× Device(s) failed to be registered! { HTTPError: Response code 400 (Bad Request) at stream.catch.then.data (C:\Users\Stephen\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\got\index.js:386:13) at <anonymous> at process._tickCallback (internal/process/next_tick.js:118:7) name: 'HTTPError', host: 'a1.tuyaus.com', hostname: 'a1.tuyaus.com', method: 'GET', path: '/api.json?a=tuya.m.device.list.token&deviceId=t4kisxbdd4jxf7vyt74qgg3qa3ba56ywjho27ozwon46&os=Linux&lang=en&v=1.0&clientId=n87gvu8wapamy9jyqp3q&time=1534592956&postData=%7B%22token%22%3A%22c5eWa3yj%22%7D&sid=az153442l2526951vHKzybK31984620d3bcd8f72b8b93b3e0a771f1d&sign=f63352d342c8e96250e79c709a5f20a1', protocol: 'https:', url: 'https://a1.tuyaus.com/api.json', statusCode: 400, statusMessage: 'Bad Request', headers: { date: 'Sat, 18 Aug 2018 11:49:17 GMT', server: 'Apache-Coyote/1.1', 'content-length': '0', connection: 'Close' } }

stephenmhall avatar Aug 18 '18 11:08 stephenmhall

@stephenmhall are you in the U.S.? If not, your issue may stem from Tuya wanting you to use a different endpoint/server than the default. I just realized this in a different issue.

codetheweb avatar Aug 19 '18 02:08 codetheweb

No I'm in the UK. So I presume I need to edit some of the default details in tuya-cli? I see the endpoints are coded into the cloud/index.js file, does the link-wizard need some extra code to select endpoint when registering.

stephenmhall avatar Aug 19 '18 09:08 stephenmhall

I'm also having a similar problem and am in the UK, I am able to use the Tuya app on my phone to register it without issue but I get this when trying to do it this way:

Matts-MacBook-Pro:~ matt$ tuya-cli link-wizard ? Make the indicator light on your device flash. For most devices, this means holding down the main button. Press return when it's blinking. Yes ? What's your WiFi called? WIFI1111 ? What's the password for your WiFi? [hidden] ? How many devices do you want to link? 1 ? Do you want to save devices that are successfully linked? Yes ✖ Device(s) failed to be registered! Error: Timed out wating for device(s) to connect to cloud at Promise (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/cloud/index.js:275:12)

lanceuppercut47 avatar Aug 19 '18 10:08 lanceuppercut47

For those in the UK: try the instructions below to see if the error is related to your region.

  1. Clone @tuyapi/link by running git clone https://github.com/TuyaAPI/link.git or downloading a zipped version of the master branch from Github.
  2. Move to the new directory (cd link on *nix) and create a new file called dev.js with the contents below:
const TuyaLink = require('./index.js');

const register = new TuyaLink.wizard({apiKey: '<your-api-key>',
                                      apiSecret: '<your-api-secret>',
                                      email: '[email protected]', password: 'example-password',
                                      region: 'EU'});

register.init().then(sid => {
  register.linkDevice({ssid: '<your-ssid>', wifiPassword: '<your-wifi-password>'}).then(devices => {
  	console.log(devices)
  });

}).catch(err => {
  console.log(err)
});
  1. Replace the <*> placeholders with the appropriate values (the email and password parameters don't really matter).

  2. Run npm i to install dependencies.

  3. Run DEBUG=* node dev.js and paste the results.

codetheweb avatar Aug 20 '18 16:08 codetheweb

Hi Team,

I am also facing similar issue, while running "tuya-cli link-wizard". It is throwing error in registering the plug with timeout error message.

I

bought plugs from China and it works well with Smart Life app and I am using these plugs in Norway..later it would be used in India also :).

Error

✖ Device(s) failed to be registered! Error: Timed out wating for device(s) to connect to cloud at Promise (/usr/local/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/cloud/index.js:275:12)

amitn16 avatar Aug 23 '18 09:08 amitn16

I'm experiencing the same issue in the states, I attempt to register but it times out waiting for it to connect to the cloud. I have this Tonbux power strip but haven't tried setting it up with an app (I was hoping to avoid that)

DEBUG=* didn't seem to change anything, I get the same repeated lines detailed above.

codehearts avatar Aug 23 '18 18:08 codehearts

Has anyone in this thread:

  • Resolved their issue?
  • Tried using the EU-region code above?
  • Got it working without changing anything?

codetheweb avatar Aug 27 '18 20:08 codetheweb

I was getting the same timeout problem trying to register my bulb from a Raspberry Pi here in the UK. Many thanks for posting the code above - now says it's registered fine.

mafu-mac avatar Aug 28 '18 21:08 mafu-mac

I tried registering my device three times (the third time I unplugged and plugged the device back in while the link wizard ran), didn't work. I then tried with DEBUG=* and it worked for me 🤷‍♀️

codehearts avatar Aug 31 '18 21:08 codehearts

Hello, Sadly, I was not that successful. I too am getting the "timeout waiting for device(s)" message. I did try pasting the code into dev.js Sadly, this one almost instantly fails with an error, saying my session had expired. As I copy-pasted all the necessary items, I don't think I made a typo. These are the last lines appearing in the debug: @tuyapi/cloud { a: 'tuya.m.device.token.create', @tuyapi/cloud deviceId: 'emcg84ujrzo19pltd1x7yxwoo2fe9wnn87o0cggzrems', @tuyapi/cloud os: 'Linux', @tuyapi/cloud lang: 'en', @tuyapi/cloud v: '1.0', @tuyapi/cloud clientId: 'p8fcw87cepukt98u5rnh', @tuyapi/cloud time: 1535828794, @tuyapi/cloud postData: '{"timeZone":"-05:00"}', @tuyapi/cloud sid: 'az153582M80686451rLRjro3c47a810b55d3f0b46e342acd89f9dd1e ', @tuyapi/cloud sign: 'cff1f48e5e76b7ce51a90fa5aada5285' } +1ms @tuyapi/cloud Received response: +218ms @tuyapi/cloud {"t":1535828794017,"success":false,"errorCode":"USER_SESSION_INV ALID","status":"error","errorMsg":"Session Expired, please log in again"}

Is there anything I can try / check? I am in Switzerland, so I guess EU as a region is correct.

the-swissionary avatar Sep 01 '18 19:09 the-swissionary