rodtoll / homebridge-isy-js

Homebridge platform plugin for the ISY series of home controllers from Universal Devices.
MIT License
22 stars 27 forks source link

Cannot get isy-js to initialize #36

Closed ishtob closed 8 years ago

ishtob commented 8 years ago

I keep getting this message:

`[10/1/2016, 11:43:34 PM] [isteon] Initializing isy-js platform... /usr/lib/node_modules/homebridge-isy-js/node_modules/isy-js/isy.js:404 if (response instanceof Error || response.statusCode != 200) { ^

TypeError: Cannot read property 'statusCode' of null at Request. (/usr/lib/node_modules/homebridge-isy-js/node_modules/isy-js/isy.js:404:50) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request._fireError (/usr/lib/node_modules/homebridge-isy-js/node_modules/restler/lib/restler.js:207:10) at ClientRequest. (/usr/lib/node_modules/homebridge-isy-js/node_modules/restler/lib/restler.js:246:14) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:188:7) at Socket.socketOnData (_http_client.js:366:9) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) at TCP.onread (net.js:543:20) `

rodtoll commented 8 years ago

The library requires you to have at least one variable defined on the ISY. Create a single variable of any kind and you should be able to connect.

On Sat, Oct 1, 2016 at 4:44 PM ishtob notifications@github.com wrote:

I keep getting this message:

`[10/1/2016, 11:43:34 PM] [isteon] Initializing isy-js platform... /usr/lib/node_modules/homebridge-isy-js/node_modules/isy-js/isy.js:404 if (response instanceof Error || response.statusCode != 200) { ^

TypeError: Cannot read property 'statusCode' of null at Request. (/usr/lib/node_modules/homebridge-isy-js/node_modules/isy-js/isy.js:404:50) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request._fireError (/usr/lib/node_modules/homebridge-isy-js/node_modules/restler/lib/restler.js:207:10) at ClientRequest. (/usr/lib/node_modules/homebridge-isy-js/node_modules/restler/lib/restler.js:246:14) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:188:7) at Socket.socketOnData (_http_client.js:366:9) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) at TCP.onread (net.js:543:20) `

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rodtoll/homebridge-isy-js/issues/36, or mute the thread https://github.com/notifications/unsubscribe-auth/ADyYQzIAPhXriBt2HoGVCy4voEqFgw-Cks5qvvB1gaJpZM4KL5K- .

ishtob commented 8 years ago

That did it! Thanks!

turned out I need to add a variable and a state, everything is running perfect now.

elimuir commented 8 years ago

This work around did not work for me. I have variables setup. I did some troubleshooting to find that /rest/vars/definitions/ API call doesn't seem to be working. I am running ISY994iz with firmware v4.4.6.

I was able to work around this by commenting out /node_modules/isy-js/isy.js line #512-541 and replacing with that.finishInitialize(true, initializeCompleted); Thats not ideal by any means, but hope to track down the solution to a real fix.

Is the .loadVariables call absolutely required? it looks like most of that is related to elkEnabled from config. What about putting .loadVariables inside if (that.elkEnabled) {}?