thexperiments / pimatic-tplink-smartplug

This plugin adds the functionality to control TP Link Smartplug HS100 and HS110 via pimatic
GNU General Public License v2.0
7 stars 4 forks source link

Plugin load error with v0.0.9 #11

Closed treban closed 5 years ago

treban commented 5 years ago

After update i get an error:

TypeError: this is not a typed array.

generated from here: https://github.com/plasticrake/tplink-smarthome-crypto/blob/master/lib/index.js#L17

my research says maybe node version

my version is v4.2.6

@mwittig do you have a hint?

20:52:03.173 [pimatic] Loading plugin: "pimatic-tplink-smartplug" (0.0.8)
20:52:03.174 [pimatic] debug is true in plugin config, showing debug output for pimatic-tplink-smartplug.
20:52:03.445 [pimatic] this is not a typed array.
20:52:03.450 [pimatic] TypeError: this is not a typed array.
20:52:03.450 [pimatic]>    at Function.from (native)
20:52:03.450 [pimatic]>    at encrypt (/opt/pimatic-docker/node_modules/pimatic-tplink-smartplug/node_modules/tplink-smarthome-api/node_modules/tplink-smarthome-crypto/lib/index.js:17:20)
20:52:03.450 [pimatic]>    at Object.<anonymous> (/opt/pimatic-docker/node_modules/pimatic-tplink-smartplug/node_modules/tplink-smarthome-api/lib/client.js:42:23)
20:52:03.450 [pimatic]>    at Module._compile (module.js:410:26)
20:52:03.450 [pimatic]>    at Object.Module._extensions..js (module.js:417:10)
20:52:03.450 [pimatic]>    at Module.load (/opt/pimatic-docker/node_modules/pimatic-mobile-frontend/node_modules/nap/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
20:52:03.450 [pimatic]>    at Function.Module._load (module.js:301:12)
20:52:03.450 [pimatic]>    at Module.require (module.js:354:17)
20:52:03.450 [pimatic]>    at require (internal/module.js:12:17)
20:52:03.450 [pimatic]>    at Object.<anonymous> (/opt/pimatic-docker/node_modules/pimatic-tplink-smartplug/node_modules/tplink-smarthome-api/lib/index.js:8:11)
20:52:03.450 [pimatic]>    at Module._compile (module.js:410:26)
20:52:03.450 [pimatic]>    at Object.Module._extensions..js (module.js:417:10)
20:52:03.450 [pimatic]>    at Module.load (/opt/pimatic-docker/node_modules/pimatic-mobile-frontend/node_modules/nap/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
20:52:03.450 [pimatic]>    at Function.Module._load (module.js:301:12)
20:52:03.450 [pimatic]>    at Module.require (module.js:354:17)
20:52:03.450 [pimatic]>    at require (internal/module.js:12:17)
20:52:03.450 [pimatic]>    at module.exports (/opt/pimatic-docker/node_modules/pimatic-tplink-smartplug/tplink-smartplug.coffee:24:15)
20:52:03.450 [pimatic]>    at PluginManager.loadPlugin (/opt/pimatic-docker/node_modules/pimatic/lib/plugins.coffee:83:16)
20:52:03.450 [pimatic]>    at /opt/pimatic-docker/node_modules/pimatic/lib/plugins.coffee:485:25
20:52:03.450 [pimatic]>    at tryCatcher (/opt/pimatic-docker/node_modules/bluebird/js/release/util.js:16:23)
20:52:03.450 [pimatic]>    at Promise._settlePromiseFromHandler (/opt/pimatic-docker/node_modules/bluebird/js/release/promise.js:512:31)
20:52:03.450 [pimatic]>    at Promise._settlePromise (/opt/pimatic-docker/node_modules/bluebird/js/release/promise.js:569:18)
20:52:03.450 [pimatic]>    at Promise._settlePromiseCtx (/opt/pimatic-docker/node_modules/bluebird/js/release/promise.js:606:10)
20:52:03.450 [pimatic]>    at _drainQueueStep (/opt/pimatic-docker/node_modules/bluebird/js/release/async.js:142:12)
20:52:03.450 [pimatic]>    at _drainQueue (/opt/pimatic-docker/node_modules/bluebird/js/release/async.js:131:9)
20:52:03.450 [pimatic]>    at Async._drainQueues (/opt/pimatic-docker/node_modules/bluebird/js/release/async.js:147:5)
20:52:03.450 [pimatic]>    at Immediate.Async.drainQueues [as _onImmediate] (/opt/pimatic-docker/node_modules/bluebird/js/release/async.js:17:14)
20:52:03.450 [pimatic]>    at processImmediate [as _immediateCallback] (timers.js:383:17)
thexperiments commented 5 years ago

Looks like the problem is with the library used so I can't do much about it...

20:52:03.450 [pimatic]> at encrypt (/opt/pimatic-docker/node_modules/pimatic-tplink-smartplug/node_modules/tplink-smarthome-api/node_modules/**tplink-smarthome-crypto**/lib/index.js:17:20) Others are not having the problem so I would suggest to update tó the latest version of node which is supported.

treban commented 5 years ago

Thanks for the reply. which node version do you use? i'm running pimatic in a docker container. i'll see if i can install a newer 4.x version of node.

buffer.from was probably introduced with node 6.0. https://nodejs.org/docs/v6.0.0/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe

treban commented 5 years ago

with version v4.9.1 is all OK. THX