mapero / node-red-contrib-smartplug

MIT License
3 stars 4 forks source link

TypeError: Object #<Object> has no method 'on' #15

Open wabiloo opened 7 years ago

wabiloo commented 7 years ago

Hi,

I'm using node-red on the emonPi made by OpenEnergyMonitor. Today I purchased an EdiMax SP-2101W and tried to connect it to node-red. I installed node-red-contrib-smartplug using npm, but on restarting node-red, the following error got raised: [smartplug] TypeError: Object #<Object> has no method 'on'

This seems to prevent the relevant types from being registered.

Full log:

5 Jul 17:19:28 - [info] Node-RED version: v0.15.2 5 Jul 17:19:28 - [info] Node.js version: v0.10.29 5 Jul 17:19:28 - [info] Linux 4.4.26-v7+ arm LE 5 Jul 17:19:30 - [info] Loading palette nodes pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/python -u /usr/lib/node_modules/node-red/nodes/core/hardware/nrgpio.py info pam_unix(sudo:session): session opened for user root by (uid=0) pam_unix(sudo:session): session closed for user root 5 Jul 17:19:43 - [warn] ------------------------------------------------------ 5 Jul 17:19:43 - [warn] [sensehat] Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat 5 Jul 17:19:43 - [warn] [smartplug] TypeError: Object # has no method 'on' 5 Jul 17:19:43 - [warn] ------------------------------------------------------ 5 Jul 17:19:43 - [info] Settings file : /home/pi/.node-red/settings.js 5 Jul 17:19:43 - [info] User directory : /home/pi/.node-red 5 Jul 17:19:43 - [info] Flows file : /home/pi/.node-red/flows_emonpi.json 5 Jul 17:19:43 - [info] Server now running at http://127.0.0.1:1880/ 5 Jul 17:19:43 - [info] Waiting for missing types to be registered: 5 Jul 17:19:43 - [info] - smartplug-device 5 Jul 17:19:43 - [info] - smartplug-in 5 Jul 17:19:43 - [info] - smartplug-out

wabiloo commented 7 years ago

For what it's worth, my EdiMax plug runs with firmware 2.08

wabiloo commented 7 years ago

@mapero - Any feedback on this? Could this be caused by the version of node-red or node.js versions?

mapero commented 7 years ago

I can not reproduce it, but your node version is really old:

Node.js v0.10.29 - 2014-06-09

Can you update and test again?

mapero commented 7 years ago

@wabiloo Did you test it with an up to date version of node?