TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
266 stars 43 forks source link

SSL error #8

Closed msturtz1 closed 5 years ago

msturtz1 commented 5 years ago

Hi, I'm doing tuya-cli list-app and getting what looks like an SSL error, full output below. Never used node.js (or github issues, for that matter) before so forgive me if I'm doing something dumb here. Env is Windows-7 with Cygwin and windows Node.JS, floowed by "npm i @tuyapi/cli -g" which did work, and "tuya-cli help" does work. This env is because what I want to end up with is a "DOS" command to turn a couple things on and off -- which will be run by some christmas light show software every 10-15 minutes in the evenings.

It's also possible I just don't know how to use the software.

msturtz@griffin ~ $ DEBUG=* tuya-cli list-app [AnyProxy Log][2018-11-25 15:36:34]: You can run anyproxy-ca to generate one root CA and then re-run this command (node:4292) UnhandledPromiseRejectionWarning: Error: root CA not found. Please run anyproxy-ca to generate one first. at new ProxyCore (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\anyproxy\proxy.js:82:13) at new ProxyServer (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\anyproxy\proxy.js:321:5) at listApp (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\lib\list-app.js:27:22) at Command.program.command.description.option.option.action.options (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\cli.js:78:3) at Command.listener (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\commander\index.js:315:8) at Command.emit (events.js:182:13) at Command.parseArgs (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\commander\index.js:654:12) at Command.parse (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\node_modules\commander\index.js:474:21) at Object. (C:\Users\msturtz\AppData\Roaming\npm\node_modules\@tuyapi\cli\cli.js:90:9) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Function.Module.runMain (internal/modules/cjs/loader.js:741:12) at startup (internal/bootstrap/node.js:285:19) (node:4292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4292) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

****At this point it doesn't return to the prompt until I hit ^C

codetheweb commented 5 years ago

Looks like you skipped step 3:

  1. Install AnyProxy by running npm i anyproxy -g. Then run anyproxy-ca.
msturtz1 commented 5 years ago

Thanks for your reply, and for supporting a noob. I only saw the installation instruction for the CLI. I have now followed the guide for the API itself, https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md. Everything is working I think... It doesn't like talking to the device when the app is open, but there's a note about that -- is this because it goes directly to the device, instead of through the cloud service? Generally shouldn't be a problem for my purposes though. However, is there a way to make it handle scenes or groups of devices? I'm not seeing one just now, but thought I'd ask.

codetheweb commented 5 years ago

Glad you got it working.

All communication is done locally, and devices can only handle one TCP connection at a time, which is why you can't use the app and TuyAPI at the same time.

Scenes and groups are not supported, and probably never will be as that's a cloud feature. Sorry.

If you want to control more than one device at a time and don't mind writing some code, take a look at TuyAPI.