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

Failing to start - Undefined rest/var/definitions #26

Closed RaginBajin closed 8 years ago

RaginBajin commented 8 years ago

I seem to be having a problem running this against my ISY. I am running 5.0.2 and I'm seeing the following error when running homebridge.

[root@automation isy-js]# homebridge * 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 [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] Loaded plugin: homebridge-isy-js [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] Registering platform 'homebridge-isy-js.isy-js' [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] --- [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] Loaded config.json with 0 accessories and 1 platforms. [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] --- [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] Loading 1 platforms... [Wed Mar 16 2016 16:30:29 GMT-0400 (EDT)] [isy-js] Initializing isy-js platform... 2016-2-3#16:30:29- Device: ZW 002 Binary Sensor type: 4.32.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 002 Multilevel Sensor type: 4.32.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 002 Energy Meter type: 4.32.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 003 Repeater type: 4.15.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 004 Repeater type: 4.15.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 005 Binary Sensor type: 4.32.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: ZW 005 Multilevel Sensor type: 4.32.1.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: Main Floor Thermostat type: 1.1.0.0 is not specifically supported, returning generic device object. 2016-2-3#16:30:29- Device: Upstairs Thermostat type: 1.1.0.0 is not specifically supported, returning generic device object. /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 Request.emit (events.js:98:17) at Request.mixin._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 ClientRequest.emit (events.js:95:17) at Socket.socketOnData (http.js:1644:9)`

My config.json file looks like this.

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" }, "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.", "platforms": [ { "platform": "isy-js", "name": "isy-js", "host": "192.168.XX.XX", "port": "80", "username": "admin", "password": "passwordofawesomeness", "elkEnabled": false, "useHttps": false, "debugLoggingEnabled": true, "includeAllScenes": true } ] }`

When I run the query by hand it seems that it is querying for type "1" which comes back and undefined.

rodtoll commented 8 years ago

@RaginBajin - This error suggests that for some reason the call to the variables endpoint on the ISY is failing. This suggests you have an older version of the ISY firmware that doesn't support variables or a recent update which breaks the contract.

What version of ISY are you running. (You can find it in the ISY admin interface).

Does hitting http://192.168.XX.XX/rest/vars/definitions/1 (where XX is obviously replaced with actual values) not resolve?

(Sorry for the delay in responding to your bug, life got in the way).

RaginBajin commented 8 years ago

No biggie.. Totally understand

So, when I hit the rest URL I get a 404 message - 2016-03-23 18:50:11 ERROR 404: OK. If I go to /rest/vars/definitions/2 I get the following

<CList type="VAR_INT"><e id="1" name="RaginIpad_XXXX" /><e id="42" name="RaginIPhone_New Geofence" /><e id="2" name="RaginIPhone_New Geofence" /></CList>

So, I know that there is data being stored, there is just nothing in var 1 and it completely falls apart.

My version is 5.0.2, so it definitely supports variables.

rodtoll commented 8 years ago

Do you have at least one of each type of variable?

I wonder if the ISY returns 404 on the call you mention if you have no state variables. Could you go and define a state variable and see if that fixes the problem? The variable should be harmless and doesn't take up much resources.

On Wed, Mar 23, 2016 at 3:53 PM Joseph Bajin notifications@github.com wrote:

No biggie.. Totally understand

So, when I hit the rest URL I get a 404 message - 2016-03-23 18:50:11 ERROR 404: OK. If I go to /rest/vars/definitions/2 I get the following

My version is 5.0.2, so it definitely supports variables.

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/rodtoll/homebridge-isy-js/issues/26#issuecomment-200574162

RaginBajin commented 8 years ago

Ok. So I went ahead and set a state variable and that didn't work. I then went ahead and set an "Integer" Variable with each having 1 as the ID number and that now returned data back.

It looks like everything now works, but I wonder what others may run into if those variables are not set. Will they experience the same thing?

rodtoll commented 8 years ago

Good news you are unblocked.

And you are absolutely correct, I need to fix it so that if this call returns a 404 that the code doesn't crash it just assumes no variables of that type.

Good bug, I'll leave this open until I address. On Thu, Mar 24, 2016 at 3:30 PM Joseph Bajin notifications@github.com wrote:

Ok. So I went ahead and set a state variable and that didn't work. I then went ahead and set an "Integer" Variable with each having 1 as the ID number and that now returned data back.

It looks like everything now works, but I wonder what others may run into if those variables are not set. Will they experience the same thing?

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/rodtoll/homebridge-isy-js/issues/26#issuecomment-201057135

rodtoll commented 8 years ago

Just published 0.4.3 which makes it so that the the plugin no longer crashes when working against ISYs with no variables defined. Thanks for reporting.

johnstonjs commented 7 years ago

rodtoll, thank you for making this plugin! Using it with homebridge is vastly superior to the Insteon HomeKit compatible product.

I just want to report that even with 0.1.7 the ISY lacking any integer or state values will still cause this issue. Creating any integer or state values on the ISY, no matter the values, makes it work. My ISY was brand new (currently with only two devices) and running v4.5.4