GithubHelp home page GithubHelp logo

Comments (8)

engelant avatar engelant commented on May 23, 2024

As a quick fix, add "broadcasthost" with your local broadcast IP to your hosts file. Dirty, i know.

from tuyapi.

 avatar commented on May 23, 2024

Hey, that seems to work.
Now I get the following error:
I am fairly new to this whole topic, I just want my python scripts to control my smart plugs. :)
Thanks so much for your help!

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)
at

I am not sure, if I configured the tuya api correctly. I got both keys but I have not configured anything else in the portal.
@engelant: I am sorry, but what do you exactly mean by broadcast IP? I pointed it to 192.168.0.255 from my ifconfig.

from tuyapi.

engelant avatar engelant commented on May 23, 2024

The broadcast IP you gave is right, assuming you have the network IP 192.168.0.xxx.
Are you connected via wifi? Which OS do you run? Can you provide the complete output, while using "DEBUG=* ./cli.js link-wizard"

from tuyapi.

codetheweb avatar codetheweb commented on May 23, 2024

Hey @moritzK (and anyone else who's getting this), sorry about the broadcast error. I'm pretty busy the next few days, but I'll try to look at it soon. I've only tried running @tuyapi/cli on a macOS device so far, so I'm guessing other OSes handle broadcasthost differently.

from tuyapi.

 avatar commented on May 23, 2024

Yesterday I bought an identical device and it worked seemlessly with the broadcasthost addition to /etc/hosts
But the old device, that was registered to the app before still does not work. Do I have to debind the plug from an app? I just pressed the button until it blinked.

@engelant : Yes, I am connected to the same access point that the devices should connect to; I am running kubuntu live;
@codetheweb : No worries. Thank you very much for providing your work and help. :) As stated above, the broadcasthost addition to /etc/hosts worked for the new device.

Here is the log:

root@xubuntu:/usr/local/lib/node_modules/@tuyapi/cli# DEBUG=* ./cli.js 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? LIMO
? 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
⠋ Registering devices(s)... @tuyapi/cloud Sending parameters: +0ms
@tuyapi/cloud { a: 'tuya.m.user.email.register',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979441,
@tuyapi/cloud postData: '{"countryCode":"AZ","email":"[email protected]","passwd":"8ac4253450b2e0eccdfe0fa24036b6d5"}',
@tuyapi/cloud sign: '2829c89fef14d51284813d44e7757ae0' } +0ms
⠹ Registering devices(s)... @tuyapi/cloud Received response: +1s
@tuyapi/cloud {"t":1533979441965,"success":false,"errorCode":"USER_NAME_IS_EXIST","status":"error","errorMsg":"Username exists."}
@tuyapi/cloud +0ms
@tuyapi/cloud Sending parameters: +0ms
@tuyapi/cloud { a: 'tuya.m.user.email.password.login',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979442,
@tuyapi/cloud postData: '{"countryCode":"AZ","email":"[email protected]","passwd":"8ac4253450b2e0eccdfe0fa24036b6d5"}',
@tuyapi/cloud sign: '98eeb0fdf56feba834bb941c82c23fff' } +0ms
⠴ Registering devices(s)... @tuyapi/cloud Received response: +1s
@tuyapi/cloud {"result":{"timezone":"","tempUnit":1,"sid":"az153390k6585168g9yL7j53ac6f6ac7869dfd04751b649b067486de","uid":"az1533906585168gyL7j","nickname":"","phoneCode":"AZ","email":"[email protected]","snsNickname":"","improveCompanyInfo":false,"dataVersion":0,"sex":0,"accountType":1,"mobile":"","headPic":"","ecode":"z5z3556a893k3z9k","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":"p1093906","username":"[email protected]"},"t":1533979442805,"success":true,"status":"ok"}
@tuyapi/cloud +0ms
@tuyapi/cloud Sending parameters: +1ms
@tuyapi/cloud { a: 'tuya.m.device.token.create',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979443,
@tuyapi/cloud postData: '{"timeZone":"-05:00"}',
@tuyapi/cloud sid: 'az153390k6585168g9yL7j53ac6f6ac7869dfd04751b649b067486de',
@tuyapi/cloud sign: 'b75e4b1e2b554dd7425bedc60e5fa6df' } +0ms
⠹ Registering devices(s)... @tuyapi/cloud Received response: +612ms
@tuyapi/cloud {"result":{"secret":"BQ1V","token":"iVcoYvuP"},"t":1533979443605,"success":true,"status":"ok"}
@tuyapi/cloud +1ms
@tuyapi/link:wizard Token: { secret: 'BQ1V', token: 'iVcoYvuP' } +0ms
@tuyapi/link:manual Sending SmartLink initialization packets +0ms
⠋ Registering devices(s)... @tuyapi/link:manual Sending SmartLink data packets +5s
⠹ Registering devices(s)... @tuyapi/link:manual Finished sending packets. +34s
@tuyapi/link:wizard Polling cloud for details on token... +39s
@tuyapi/cloud Sending parameters: +39s
@tuyapi/cloud { a: 'tuya.m.device.list.token',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979483,
@tuyapi/cloud postData: '{"token":"iVcoYvuP"}',
@tuyapi/cloud sid: 'az153390k6585168g9yL7j53ac6f6ac7869dfd04751b649b067486de',
@tuyapi/cloud sign: '60803281cca610f8ccf03d8f0b5e50e7' } +0ms
⠹ Registering devices(s)... @tuyapi/cloud Received response: +773ms
@tuyapi/cloud {"result":[],"t":1533979483749,"success":true,"status":"ok"}
@tuyapi/cloud +0ms
⠼ Registering devices(s)... @tuyapi/cloud Sending parameters: +201ms
@tuyapi/cloud { a: 'tuya.m.device.list.token',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979484,
@tuyapi/cloud postData: '{"token":"iVcoYvuP"}',
@tuyapi/cloud sid: 'az153390k6585168g9yL7j53ac6f6ac7869dfd04751b649b067486de',
@tuyapi/cloud sign: '10b8b3f76b551c52e5b365ba6e3db2db' } +0ms
⠴ Registering devices(s)... @tuyapi/cloud Received response: +825ms
@tuyapi/cloud {"result":[],"t":1533979484769,"success":true,"status":"ok"}
@tuyapi/cloud +0ms
⠧ Registering devices(s)... @tuyapi/cloud Sending parameters: +201ms
@tuyapi/cloud { a: 'tuya.m.device.list.token',
@tuyapi/cloud deviceId: 'u5fmfmc79maambtrxem8u97i3w5ognf7n3m6nf8gwxjn',
@tuyapi/cloud os: 'Linux',
@tuyapi/cloud lang: 'en',
@tuyapi/cloud v: '1.0',
@tuyapi/cloud clientId: 'j3s8ckcghyv7uvrhpfdt',
@tuyapi/cloud time: 1533979485,
@tuyapi/cloud postData: '{"token":"iVcoYvuP"}',
@tuyapi/cloud sid: 'az153390k6585168g9yL7j53ac6f6ac7869dfd04751b649b067486de',
@tuyapi/cloud sign: 'fa5955870931e3ae719859e4c9bcc319' } +1ms
⠋ Registering devices(s)...^C

from tuyapi.

 avatar commented on May 23, 2024

Okay, it worked also with the old one. I pressed the button for a longer time, until the led blinked faster...

from tuyapi.

 avatar commented on May 23, 2024

Thanks so for guys. Do you want me to close this now? This is my first encounter with github! :)

from tuyapi.

codetheweb avatar codetheweb commented on May 23, 2024

Broadcast address issue is now fixed. Please update the CLI tool with npm i @tuyapi/[email protected] -g.

@moritzK glad you got it working. I'll close the issue; but yes, in the future please close issues when your problem is solved.

from tuyapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.