codetheweb / tuyapi

🌧 An easy-to-use API for devices that use Tuya's cloud services. Documentation: https://codetheweb.github.io/tuyapi.
MIT License
2.06k stars 339 forks source link

Getting an AES error #50

Closed S-K-Lieren closed 6 years ago

S-K-Lieren commented 6 years ago

Hey guys,

I'm not able to get it running. It throws the following error:

/node_modules/node-forge/lib/aes.js:203
    var len = tmp.length();
                  ^

TypeError: tmp.length is not a function
    at forge.aes.Algorithm.initialize (/node_modules/node-forge/lib/aes.js:203:19)
    at new forge.cipher.BlockCipher (/node_modules/node-forge/lib/cipher.js:118:18)
    at Object.forge.cipher.createCipher (/node_modules/node-forge/lib/cipher.js:42:10)
    at new TuyaCipher (/node_modules/tuyapi/lib/cipher.js:13:30)
    at new TuyaDevice (/node_modules/tuyapi/index.js:42:24)
    at /app.js:28:13
    at Array.forEach (native)
    at initDevices (/app.js:26:18)
    at Object.<anonymous> (/app.js:36:1)
    at Module._compile (module.js:577:32)

Any ideas?

codetheweb commented 6 years ago

Please re-run your app, prefixing it with DEBUG=* and post the output.

I.e. DEBUG=* node app.js

On Aug 10, 2018, at 03:31, Benjamin Kauer notifications@github.com wrote:

/node_modules/node-forge/lib/aes.js:203 var len = tmp.length(); ^

TypeError: tmp.length is not a function at forge.aes.Algorithm.initialize (/node_modules/node-forge/lib/aes.js:203:19) at new forge.cipher.BlockCipher (/node_modules/node-forge/lib/cipher.js:118:18) at Object.forge.cipher.createCipher (/node_modules/node-forge/lib/cipher.js:42:10) at new TuyaCipher (/node_modules/tuyapi/lib/cipher.js:13:30) at new TuyaDevice (/node_modules/tuyapi/index.js:42:24) at /app.js:28:13 at Array.forEach (native) at initDevices (/app.js:26:18) at Object. (/app.js:36:1) at Module._compile (module.js:577:32)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

S-K-Lieren commented 6 years ago

Actually, I started from scratch. Now I can't even run tuya-cli link-wizard anymore, it throws the following error:

:~$ tuya-cli link-wizard
/usr/lib/node_modules/@tuyapi/cli/node_modules/@tuyapi/link/index.js:79
TuyaLinkWizard.prototype.linkDevice = async function (options) {
                                            ^^^^^^^^

SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/lib/link.js:3:41)
codetheweb commented 6 years ago

What's the output of node -v?

S-K-Lieren commented 6 years ago

6.14.3

codetheweb commented 6 years ago

Looks like you need to update your Node version. Please update to ≥8.x.x and try again.

I would recommend using NVM if you're not already.

S-K-Lieren commented 6 years ago

Thanks for your help.

I tried setting everything up on another machine. The wizard is running now, but it's not able to find my device(s), even though they are connected and the LED is flashing. I'm able to use my devices via Smart Life App. Btw: What exactly does the Link Wizard do? You're asking for a SSID and even my WiFi key, for what? As I mentioned, the devices are already working in my network.

Any ideas?

Edit: Closing this, see #65