thechrisreese / Homebridge-winkv2

Don’t Install This One
2 stars 1 forks source link

Plugin fails to load #2

Closed Richard0415 closed 7 years ago

Richard0415 commented 7 years ago

Homebridge won't recognize the plugin. Any help would be appreciated!

Jan 13 21:34:34 raspberrypi homebridge[4155]: [1/13/2017, 9:34:34 PM] ==================== Jan 13 21:34:34 raspberrypi homebridge[4155]: [1/13/2017, 9:34:34 PM] ERROR LOADING PLUGIN homebridge-winkv2: Jan 13 21:34:34 raspberrypi homebridge[4155]: [1/13/2017, 9:34:34 PM] TypeError: Path must be a string. Received null Jan 13 21:34:34 raspberrypi homebridge[4155]: at assertPath (path.js:7:11) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object.dirname (path.js:1324:5) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object. (/usr/lib/node_modules/homebridge-winkv2/node_modules/config-file/index.js:17:21) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module._compile (module.js:570:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object.Module._extensions..js (module.js:579:10) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module.load (module.js:487:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: at tryModuleLoad (module.js:446:12) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Function.Module._load (module.js:438:3) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module.require (module.js:497:17) Jan 13 21:34:34 raspberrypi homebridge[4155]: at require (internal/module.js:20:19) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object. (/usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:4:14) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module._compile (module.js:570:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object.Module._extensions..js (module.js:579:10) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module.load (module.js:487:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: at tryModuleLoad (module.js:446:12) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Function.Module._load (module.js:438:3) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module.require (module.js:497:17) Jan 13 21:34:34 raspberrypi homebridge[4155]: at require (internal/module.js:20:19) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object. (/usr/lib/node_modules/homebridge-winkv2/index.js:2:12) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module._compile (module.js:570:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Object.Module._extensions..js (module.js:579:10) Jan 13 21:34:34 raspberrypi homebridge[4155]: at Module.load (module.js:487:32) Jan 13 21:34:34 raspberrypi homebridge[4155]: [1/13/2017, 9:34:34 PM] ====================

thechrisreese commented 7 years ago

Try this -

update home bridge-winkv2 (added a test folder) Open the Test folder and copy index.js Go to Homevridge-winkv2 > node_modiles > wink.js and paste index.js restart homebrdige

Richard0415 commented 7 years ago

Thanks. Replaced the file and this is the output (still fails):

Jan 15 18:35:10 raspberrypi systemd[1]: Stopping Node.js HomeKit Server... Jan 15 18:35:10 raspberrypi systemd[1]: Starting Node.js HomeKit Server... Jan 15 18:35:11 raspberrypi systemd[1]: Started Node.js HomeKit Server. Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING Please fix your application to use the native API of Avahi! Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING Please fix your application to use the native API of Avahi! Jan 15 18:35:11 raspberrypi nodejs[6120]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING Please fix your application to use the native API of Avahi! Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING Please fix your application to use the native API of Avahi! Jan 15 18:35:11 raspberrypi homebridge[6120]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister Jan 15 18:35:14 raspberrypi homebridge[6120]: [1/15/2017, 6:35:14 PM] Loaded plugin: homebridge-chamberlain Jan 15 18:35:14 raspberrypi homebridge[6120]: [1/15/2017, 6:35:14 PM] Registering accessory 'homebridge-chamberlain.Chamberlain' Jan 15 18:35:14 raspberrypi homebridge[6120]: [1/15/2017, 6:35:14 PM] --- Jan 15 18:35:15 raspberrypi homebridge[6120]: [1/15/2017, 6:35:15 PM] Loaded plugin: homebridge-denon Jan 15 18:35:15 raspberrypi homebridge[6120]: [1/15/2017, 6:35:15 PM] Registering accessory 'homebridge-denon-marantz-avr.DenonMarantzAVR' Jan 15 18:35:15 raspberrypi homebridge[6120]: [1/15/2017, 6:35:15 PM] --- Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Loaded plugin: homebridge-nest Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Registering platform 'homebridge-nest.Nest' Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] --- Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Loaded plugin: homebridge-server Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Registering platform 'homebridge-server.Server' Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] --- Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] ==================== Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] ERROR LOADING PLUGIN homebridge-winkv2: Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] /usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:5 Jan 15 18:35:16 raspberrypi homebridge[6120]: <!DOCTYPE html> Jan 15 18:35:16 raspberrypi homebridge[6120]: ^ Jan 15 18:35:16 raspberrypi homebridge[6120]: SyntaxError: Unexpected token < Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object.exports.runInThisContext (vm.js:76:16) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module._compile (module.js:542:28) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object.Module._extensions..js (module.js:579:10) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.load (module.js:487:32) Jan 15 18:35:16 raspberrypi homebridge[6120]: at tryModuleLoad (module.js:446:12) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Function.Module._load (module.js:438:3) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.require (module.js:497:17) Jan 15 18:35:16 raspberrypi homebridge[6120]: at require (internal/module.js:20:19) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object. (/usr/lib/node_modules/homebridge-winkv2/index.js:2:12) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module._compile (module.js:570:32) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object.Module._extensions..js (module.js:579:10) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.load (module.js:487:32) Jan 15 18:35:16 raspberrypi homebridge[6120]: at tryModuleLoad (module.js:446:12) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Function.Module._load (module.js:438:3) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.require (module.js:497:17) Jan 15 18:35:16 raspberrypi homebridge[6120]: at require (internal/module.js:20:19) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Plugin.load (/usr/lib/node_modules/homebridge/lib/plugin.js:65:22) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Server. (/usr/lib/node_modules/homebridge/lib/server.js:132:14) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Array.forEach (native) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Server._loadPlugins (/usr/lib/node_modules/homebridge/lib/server.js:128:22) Jan 15 18:35:16 raspberrypi homebridge[6120]: at new Server (/usr/lib/node_modules/homebridge/lib/server.js:51:24) Jan 15 18:35:16 raspberrypi homebridge[6120]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:26:16) Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] ==================== Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Loaded config.json with 2 accessories and 3 platforms. Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] --- Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Loading 3 platforms... Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] [Homebridge Server] Initializing Server platform... Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Initializing Nest platform... Jan 15 18:35:16 raspberrypi homebridge[6120]: [1/15/2017, 6:35:16 PM] Fetching Nest devices. Jan 15 18:35:16 raspberrypi homebridge[6120]: /usr/lib/node_modules/homebridge/lib/api.js:118 Jan 15 18:35:16 raspberrypi homebridge[6120]: throw new Error("The requested platform '" + name + "' was not registered by any plugin."); Jan 15 18:35:16 raspberrypi homebridge[6120]: ^ Jan 15 18:35:16 raspberrypi homebridge[6120]: Error: The requested platform 'Wink' was not registered by any plugin. Jan 15 18:35:16 raspberrypi homebridge[6120]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:118:13) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:284:45) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:80:36) Jan 15 18:35:16 raspberrypi homebridge[6120]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module._compile (module.js:570:32) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Object.Module._extensions..js (module.js:579:10) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.load (module.js:487:32) Jan 15 18:35:16 raspberrypi homebridge[6120]: at tryModuleLoad (module.js:446:12) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Function.Module._load (module.js:438:3) Jan 15 18:35:16 raspberrypi homebridge[6120]: at Module.runMain (module.js:604:10) Jan 15 18:35:16 raspberrypi homebridge[6120]: at run (bootstrap_node.js:394:7) Jan 15 18:35:16 raspberrypi homebridge[6120]: at startup (bootstrap_node.js:149:9) Jan 15 18:35:16 raspberrypi homebridge[6120]: at bootstrap_node.js:509:3 Jan 15 18:35:16 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Jan 15 18:35:16 raspberrypi systemd[1]: Unit homebridge.service entered failed state.

thechrisreese commented 7 years ago

Looks like you have the info in confit.json but don't have the Homebridge-wink2 in your npm folder so it's calling it but can't find it.

Richard0415 commented 7 years ago

Not sure why but I'm digging into it now.

thechrisreese commented 7 years ago

Do you have more than one version of npm installed?

Richard0415 commented 7 years ago

Okay... I can't chase it down. The below is the terminal commands that I tried. I had a different terminal window open monitoring the homebridge log.

pi@raspberrypi:~ $ sudo su root@raspberrypi:/home/pi# npm install -g homebridge-winkv2 npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue /usr/lib └── homebridge-winkv2@1.0.0

root@raspberrypi:/home/pi# cd /home/pi/Downloads root@raspberrypi:/home/pi/Downloads# cp index.js /usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/ root@raspberrypi:/home/pi/Downloads# systemctl restart homebridge root@raspberrypi:/home/pi/Downloads# cd root@raspberrypi:~# npm uninstall -g homebridge-winkv2

Richard0415 commented 7 years ago

doesn't look like I have more than one version:

pi@raspberrypi:~ $ which npm /usr/bin/npm pi@raspberrypi:~ $ sudo which npm /usr/bin/npm pi@raspberrypi:~ $ npm -version 3.10.10 pi@raspberrypi:~ $ sudo npm -version 3.10.10 pi@raspberrypi:~ $ sudo su root@raspberrypi:/home/pi# npm -version 3.10.10

Richard0415 commented 7 years ago

So yes... I had something going on and just started from scratch. Following the only noticeable change in the test/index.js file (commenting out line 4 - require config-file), everything appears to be good on the install.

[1/25/2017, 3:10:54 PM] Loaded plugin: homebridge-winkv2 [1/25/2017, 3:10:54 PM] Registering platform 'homebridge-winkv2.Wink'

Also... I'm using node 6.9.4 - in case you wanted to know.

Thanks man.

Richard0415 commented 7 years ago

Didn't think I should open another issue for this - but will if you'd like.

Plugin loads just fine. However, it fails once I add the info into the config file. Here's the output:

Jan 25 15:27:59 raspberrypi homebridge[2432]: SyntaxError: Unexpected end of JSON input Jan 25 15:27:59 raspberrypi homebridge[2432]: at Object.parse (native) Jan 25 15:27:59 raspberrypi homebridge[2432]: at IncomingMessage. (/usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:68:19) Jan 25 15:27:59 raspberrypi homebridge[2432]: at emitNone (events.js:91:20) Jan 25 15:27:59 raspberrypi homebridge[2432]: at IncomingMessage.emit (events.js:185:7) Jan 25 15:27:59 raspberrypi homebridge[2432]: at endReadableNT (_stream_readable.js:974:12) Jan 25 15:27:59 raspberrypi homebridge[2432]: at _combinedTickCallback (internal/process/next_tick.js:74:11) Jan 25 15:27:59 raspberrypi homebridge[2432]: at process._tickCallback (internal/process/next_tick.js:98:9) Jan 25 15:27:59 raspberrypi homebridge[2432]: raw message Jan 25 15:27:59 raspberrypi homebridge[2432]: /usr/lib/node_modules/homebridge-winkv2/index.js:143 Jan 25 15:27:59 raspberrypi homebridge[2432]: for (var i = 0; i < devices.data.length; i++) { Jan 25 15:27:59 raspberrypi homebridge[2432]: ^ Jan 25 15:27:59 raspberrypi homebridge[2432]: TypeError: Cannot read property 'data' of undefined Jan 25 15:27:59 raspberrypi homebridge[2432]: at /usr/lib/node_modules/homebridge-winkv2/index.js:143:33 Jan 25 15:27:59 raspberrypi homebridge[2432]: at /usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:241:9 Jan 25 15:27:59 raspberrypi homebridge[2432]: at IncomingMessage. (/usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:75:7) Jan 25 15:27:59 raspberrypi homebridge[2432]: at emitNone (events.js:91:20) Jan 25 15:27:59 raspberrypi homebridge[2432]: at IncomingMessage.emit (events.js:185:7) Jan 25 15:27:59 raspberrypi homebridge[2432]: at endReadableNT (_stream_readable.js:974:12) Jan 25 15:27:59 raspberrypi homebridge[2432]: at _combinedTickCallback (internal/process/next_tick.js:74:11) Jan 25 15:27:59 raspberrypi homebridge[2432]: at process._tickCallback (internal/process/next_tick.js:98:9)

Richard0415 commented 7 years ago

I finally got it working... Perhaps I incorrectly assumed the id and key provided by Wink would be valid. When I replaced my id and secret with the ones referenced here: https://github.com/nfarina/homebridge/issues/625#issuecomment-217748447 everything started working as it should.

Just in case the link doesn't work: "client_id": "quirky_wink_android_app",

"client_secret": "e749124ad386a5a35c0ab554a4f2c045",