KraigM / homebridge-wink

Wink hub plugin for HomeBridge
54 stars 37 forks source link

When can we see nodejs 6.6 compatability? #59

Open KradKrad opened 7 years ago

KradKrad commented 7 years ago

Alot of other homebridge-plugins are now updating to nodejs 6.6.0. I am now having to pick and choose what I can load in homebridge due to this plugin only working with v4.2.6. Any chance we can have an update? Or can someone outline the steps to upgrade to v.6.6.0 with a working homebridge-wink plugin?

thanks

bassrock commented 7 years ago

I am having the same issue. @KraigM is there planned node 6 compatibility.

I am using it in a freenas jail and its a bit complicated to downgrade node.

thechrisreese commented 7 years ago

I am pretty certain this plugin is abandoned. I have a fork I started playing with but I don't know how to make it node 6.6 compatible.

KraigM commented 7 years ago

I will gladly except any pull requests. Other then @pdlove I have only seen one other pull request. My stuff is working with the setup I have but I really only use it for my lock atm.

KradKrad commented 7 years ago

@KraigM I appreciate you releasing this homebridge plugin. It had made my wink setup usable. Is it difficult to update compatibility to node6? Does it take a full re-write?

mriksman commented 7 years ago

Is everyone talking about this issue; Error: The requested accessory 'Wink' was not registered by any plugin.

[7/8/2016, 8:40:56 PM] ERROR LOADING PLUGIN homebridge-wink:
[7/8/2016, 8:40:56 PM] TypeError: Path must be a string. Received null
at assertPath (path.js:7:11) 

Once you install homebridge-wink, open up homebridge-wink/node_modules/wink-js/index.js and find this line and comment out these lines;

    init: function(auth_data, callback) {
//      if ( auth_data.conf !== undefined ) {
//          // get data from config
//          auth_data = config.load(auth_data.conf);
        }

I have it working on Node 6.6 now.

KradKrad commented 7 years ago

mriksman - How do i update now to node 6.6? I went to go run the latest command it is bumped now to 7.0.0. I am running into some other issues with 7.0.0

corymccarty commented 7 years ago

@mriksman I just tried commenting out those lines (I assume you meant to include the close curly brace as well), and I still get exactly the same error.

This is particularly problematic since the homebridge installation instructions (at least for Raspberry Pi) now target the latest version of node.js. So it seems like the homebridge-wink plugin simply doesn't work at all if you've followed the latest homebridge installation instructions.

mriksman commented 7 years ago

Yup; edited comment above.

I also have this line commented at the top, but I wouldn't have thought it would have impacted the result... //var config = require('config-file');

I am currently running 6.6 (needed for the homebridge-foscamcamera) and homebridge-wink starts up fine and starts as a service no problems.

Is it definitely the same problem; does it mention TypeError: Path must be a string. Received null at assertPath (path.js:7:11)

KradKrad commented 7 years ago

I have commented out what you suggested above in both posts and this is what i get

ERROR LOADING PLUGIN homebridge-wink: [11/5/2016, 11:29:11 AM] /usr/local/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:126 }); ^ SyntaxError: Unexpected token ) at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:528:28) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/homebridge-wink/index.js:2:12) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:65:22) at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:129:14) at Array.forEach (native) at Server._loadPlugins (/usr/local/lib/node_modules/homebridge/lib/server.js:125:22) at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:48:24) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:26:16) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3)

mriksman commented 7 years ago

You've screwed something up... line 132, 133, 134 and 135 should be commented. You have a syntax error on line 126. Check what you've commented out, or attach your index.js file here. Here is mine; index.js.txt

KradKrad commented 7 years ago

just imported your index.js and this is the error i get now...

[11/5/2016, 6:29:30 PM] ERROR LOADING PLUGIN homebridge-wink: [11/5/2016, 6:29:30 PM] Error: Cannot find module './lib/model/robot' at Function.Module._resolveFilename (module.js:455:15) at Function.Module._load (module.js:403:25) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:14:10) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/homebridge-wink/index.js:2:12) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:65:22) at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:129:14) at Array.forEach (native) at Server._loadPlugins (/usr/local/lib/node_modules/homebridge/lib/server.js:125:22) at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:48:24) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:26:16) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:556:32) [11/5/2016, 6:29:30 PM] ====================

KradKrad commented 7 years ago

SUCCESS!!!!!! My issues revolved around security rights when loading node 6.6. Once i did that and reloaded all of the homebridge-modules.. and then commented out what you said exactly... it now works!

mriksman commented 7 years ago

Nice one! I wish I knew how to 'pull request' and all that jazz, but it's out of my league. I just got lucky with this one. Hope other people get help out of this.

keithajmani commented 7 years ago

Update: this really looks like the wrong way to solve things, since I changed the very old version of config-file that is used by homebridge-wink, but it works for me ..

Ok, took an hour or so, but this works for me. (node v6.91, npm 4.0.1, macOS)

Seems like the config loading cant properly find a package.json. You can just "touch package.json" in the directory where you are launching homebridge manually (or actually make a proper package.json). Since I am loading using launchctl on macOS, I needed to do the following:

Edit line 16 in /usr/local/lib/node_modules/homebridge-wink/node_modules/config-file/index.js:

Change: const pkg = findup('package.json', {cwd: process.cwd()});

To: const pkg = findup('package.json', {cwd: __dirname});

corymccarty commented 7 years ago

Commenting out 'var config = require('config-file');' got the job done. Odd that it doesn't seem to even need that module.

rjmcfadd commented 7 years ago

When I comment out var config = require('config-file'); the Wink plugin loads but I get the following error:

SyntaxError: Unexpected end of JSON input at Object.parse (native) at IncomingMessage. (/usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:68:19) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) raw message /usr/lib/node_modules/homebridge-winkv2/index.js:143 for (var i = 0; i < devices.data.length; i++) { ^

TypeError: Cannot read property 'data' of undefined at /usr/lib/node_modules/homebridge-winkv2/index.js:143:33 at /usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:241:9 at IncomingMessage. (/usr/lib/node_modules/homebridge-winkv2/node_modules/wink-js/index.js:75:7) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

n8man commented 7 years ago

@scoobyshi has a pull request for @winfinit that fixes the nodejs > 5 compatibility issue (which is really related to the way that wink-js is using the config-file package). See https://github.com/winfinit/wink-js/pull/11/files

Instead of trying to hand-apply the changes you can install them directly with npm.

To do this navigate into node_modules/homebridge-wink/. If you're now in a directory named homebridge-wink and it contains a file called package.json, you're in the right place.

From there most people would need to use sudo to install... sudo npm install scoobyshi/wink-js Notice that we're not installing this globally (no -g option) This will override homebridge-wink's copy of wink-js and also update wink-js's copy of config-file to a modern version (0.3.2 as of this writing).

You should see output that looks like this:

homebridge-wink@1.2.0 /usr/lib/node_modules/homebridge-wink
└─┬ wink-js@0.1.2  (git://github.com/scoobyshi/wink-js.git#5355dc7eb09ed602488d3ea7446f0ae7fb45795b)
  └── config-file@0.3.2 

And you're done.

Homebrige should now be able start without the 'TypeError: Path must be a string. Received null' error. Right now I'm running nodejs v6.9.5.

ghost commented 7 years ago

Hi there, I did as you suggested and i get the following error. I'm also on node 6.9.5 and used the node_modules/homebridge-wink/ directory. I get the following error. Thoughts?

Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [2/17/2017, 4:49:14 AM] Loaded plugin: homebridge-harmonyhub [2/17/2017, 4:49:17 AM] Registering platform 'homebridge-harmonyhub.HarmonyHub' [2/17/2017, 4:49:17 AM] --- [2/17/2017, 4:49:18 AM] Loaded plugin: homebridge-wink [2/17/2017, 4:49:18 AM] Registering platform 'homebridge-wink.Wink' [2/17/2017, 4:49:18 AM] --- [2/17/2017, 4:49:18 AM] Loaded config.json with 1 accessories and 2 platforms. [2/17/2017, 4:49:18 AM] --- [2/17/2017, 4:49:18 AM] Loading 2 platforms... [2/17/2017, 4:49:18 AM] [Wink] Initializing Wink platform... [2/17/2017, 4:49:18 AM] [Wink] Fetching Wink devices. [2/17/2017, 4:49:18 AM] [Harmony Hub] Initializing HarmonyHub platform... [2/17/2017, 4:49:18 AM] Loading 1 accessories... /usr/local/lib/node_modules/homebridge/lib/api.js:46 if (name.indexOf('.') == -1) { ^

TypeError: Cannot read property 'indexOf' of undefined at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:46:11) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:254:42) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:81:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

tomboates commented 7 years ago

I also get the same error @sats4eva... if anyone knows a fix LMK. Running node 6.6 on a Raspberry Pi.

WARNING The program 'node' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [2/20/2017, 5:28:59 PM] Loaded plugin: homebridge-chamberlain [2/20/2017, 5:28:59 PM] Registering accessory 'homebridge-chamberlain.Chamberlain' [2/20/2017, 5:28:59 PM] --- [2/20/2017, 5:29:00 PM] Loaded plugin: homebridge-ifttt [2/20/2017, 5:29:00 PM] Registering platform 'homebridge-ifttt.IFTTT' [2/20/2017, 5:29:00 PM] --- [2/20/2017, 5:29:01 PM] Loaded plugin: homebridge-nest [2/20/2017, 5:29:01 PM] Registering platform 'homebridge-nest.Nest' [2/20/2017, 5:29:01 PM] --- [2/20/2017, 5:29:02 PM] Loaded plugin: homebridge-wemo [2/20/2017, 5:29:02 PM] Registering accessory 'homebridge-wemo.WeMo' [2/20/2017, 5:29:02 PM] --- [2/20/2017, 5:29:02 PM] Loaded plugin: homebridge-wink [2/20/2017, 5:29:02 PM] Registering platform 'homebridge-wink.Wink' [2/20/2017, 5:29:02 PM] --- [2/20/2017, 5:29:02 PM] Loaded config.json with 3 accessories and 2 platforms. [2/20/2017, 5:29:02 PM] --- [2/20/2017, 5:29:02 PM] Loading 2 platforms... /usr/local/lib/node_modules/homebridge/lib/api.js:104 if (name.indexOf('.') == -1) { ^

TypeError: Cannot read property 'indexOf' of undefined at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:104:11) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:284:45) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:80:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:573:32) at Object.Module._extensions..js (module.js:582:10) at Module.load (module.js:490:32) at tryModuleLoad (module.js:449:12) at Function.Module._load (module.js:441:3) at Module.runMain (module.js:607:10) at run (bootstrap_node.js:382:7) at startup (bootstrap_node.js:137:9) at bootstrap_node.js:497:3

scoobyshi commented 7 years ago

@tomboates @sats4eva , if you look at https://github.com/nfarina/homebridge/blob/master/lib/api.js#L106 (for example), it mentions what the check is trying to do:

// if you passed the "short form" name like "Lockitron" instead of "homebridge-lockitron.Lockitron", // see if it matches exactly one platform.

What do you have configured in the "platforms" section of your config.json (don't include snippets with secrets obviously)? I don't think there were any recent changes to homebridge that would cause an issue, did this work previously?

tomboates commented 7 years ago

Sorry @scoobyshi, I didn't get notified you responded.

To be upfront, I'm no developer... more of a hobbyist. I had my whole home set up fine for a while, but over time I'd hit bugs that would stop homebridge and I'd have to start it again in order for anything to work which sucked. When I finally sat down to fix things, the most glaring issue was that I had the homebridge-liftmaster integration and many were reporting it wasn't working and to use the homebridge-chamberlain one instead. Aftewr correcting that I kept pulling the threads of all the errors I was experiencing and found myself here. Would love to get Wink integration up and running as I have 2 Aros window A/Cs and would love to turn them on/off via phone. Also, August now works with wink so I'm hoping to find ways to get that in there as well.

Below is what is in my "platforms" JSON (minus secrets and keys)... the wink part has worked before updating my version of node to 6.6:


        {
        "platform": "Nest",

        "token": "BLAH",

        "clientId": "BLAH",
        "clientSecret": "BLAH",
        "code": "BLAH",

        "username": "myEmail",
        "password": "myPassword"
    },
    {
        "accessory": "Chamberlain",
            "name": "Garage Door",
            "username": "myEmail",
            "password": "myPassword"
        },
        {
        "platform": "IFTTT",
            "name": "IFTTT",
            "makerkey": "myMakerKey",
        "accessories": [{
        "name": "Scout Alarm",
        "buttons": [{
            "caption": "Armed",
            "triggerOn": "arm",
            "triggerOff": "disarm"
        }]
        },{
        "name": "Aros 1",
        "buttons": [{
            "caption": "Aros",
            "triggerOn": "tv_air_on",
            "triggerOff": "tv_air_off"
        }]
        },{
        "name": "Aros 2",
        "buttons": [{
            "caption": "Aros",
            "triggerOn": "bedroom_air_on",
            "triggerOff": "bedroom_air_off"
        }]
        }]
    }
    ]```
tomboates commented 7 years ago

hmmm having trouble getting that right and editing it... assume that the above has a "platforms": [ in front of it...

tomboates commented 7 years ago

and I also may have just answered my own question... I see the Chamberlain is an accessory not a platform... facepalm