nfarina / homebridge-sonos

Sonos plugin for homebridge: https://github.com/nfarina/homebridge
155 stars 52 forks source link

TypeError: Cannot read property 'zoneType' of undefined #17

Closed leoneleone closed 8 years ago

leoneleone commented 8 years ago

Keep getting an error when running homebridge. Any ideas?

/usr/local/lib/node_modules/homebridge-sonos/index.js:145 var zoneType = description["zoneType"]; ^

TypeError: Cannot read property 'zoneType' of undefined at SonosAccessory. (/usr/local/lib/node_modules/homebridge-sonos/index.js:145:35) at Request._callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/lib/sonos.js:608:21) at self.callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/request/request.js:129:22) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at ClientRequest.self.clientErrorHandler (/usr/local/lib/node_modules/homebridge-sonos/node_modules/request/request.js:239:10) at emitOne (events.js:77:13) at ClientRequest.emit (events.js:169:7) at Socket.socketOnEnd (_http_client.js:298:9) at emitNone (events.js:72:20)

thezepter commented 8 years ago

Hello loenelone, how do you solved this Problem ? homebridge run the last week withaout Problems. And now i have the same issue. I tried to delete my persist directory, but it does not work.

Any idea ?!


/usr/local/lib/node_modules/homebridge-sonos/index.js:145 var zoneType = description["zoneType"];

TypeError: Cannot read property 'zoneType' of undefined at SonosAccessory. (/usr/local/lib/node_modules/homebridge-sonos/index.js:145:35) at Request._callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/lib/sonos.js:608:21) at self.callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/node_modules/request/request.js:129:22) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at ClientRequest.self.clientErrorHandler (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/node_modules/request/request.js:239:10) at emitOne (events.js:77:13) at ClientRequest.emit (events.js:169:7) at Socket.socketOnEnd (_http_client.js:288:9) at emitNone (events.js:72:20)

leoneleone commented 8 years ago

You need to change your edit/change the index.js files inside the plugin folder on the platform you/re using.

replace your current index.js file from this git repo with the one with this one: https://github.com/fwboettger/homebridge-sonos/blob/enhancements-0.0.4/index.js

thezepter commented 8 years ago

thanks ! why I had to replace the file ? Can you explain that? It went so far always . i tried it. but now.... more errors ^^ And now ?

sonos_error

leoneleone commented 8 years ago

Do you have a Sonos-Connect as part of your setup? The plugin can only handle the Sonos PLAYs and the SoundBar currently. I have to remove my Sonos-Connect from my Homebridge config.json file

leoneleone commented 8 years ago

The error you mention is a syntax error. I'm not at my computer so can't look at it right now.

I believe it's a very simple syntax error which can be uncovered by copying the the code itself and checking it on jshint.com or a similar site

thezepter commented 8 years ago

Sorry i can´t get it to work. No, i have only 2x Play1 & 1x Play5.

i checked the code from the index.js file (jshint.com) and reduced the "semicolon" errors. But it doesn´t help.

before: test_2

after: test_1

Iám not a programmer... sorry.. Pretty frustrating . But thanks for your advice !

leoneleone commented 8 years ago

what version of homebridge are you using? maybe try uninstalling the homebridge-sonos and then re-installing again.

i'll do whatever i can to get this up and running for you 😊

leoneleone commented 8 years ago

also, do you have any other homebridge plugins, and do they ruin and initialise correctly?

thezepter commented 8 years ago

EDIT: Go to the bottom... now it works.

yes, if i run only my "harmony" Plugin, homebridge start withput errors.

i have uninstalled & reinstalled homebridge & my plugins complete. I use "sonos" Plugin & the "harmony" Plugin.

anyway...the same error.

` pi@raspberryips:~/.homebridge $ 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 [2016-03-24 11:44:07] Loaded plugin: homebridge-harmonyhub [2016-03-24 11:44:08] Registering platform 'homebridge-harmonyhub.HarmonyHub' [2016-03-24 11:44:08] --- [2016-03-24 11:44:16] Loaded plugin: homebridge-sonos [2016-03-24 11:44:16] Registering accessory 'homebridge-sonos.Sonos' [2016-03-24 11:44:16] --- [2016-03-24 11:44:16] Loaded config.json with 3 accessories and 1 platforms. [2016-03-24 11:44:16] --- [2016-03-24 11:44:16] Loading 1 platforms... [2016-03-24 11:44:16] [HarmonyHub] Initializing HarmonyHub platform... [2016-03-24 11:44:16] [HarmonyHub] Searching for Logitech Harmony remote hubs... [2016-03-24 11:44:17] Loading 3 accessories... [2016-03-24 11:44:17] [Lautsprecher Büro] Initializing Sonos accessory... [2016-03-24 11:44:17] [Lautsprecher Kinderzimmer] Initializing Sonos accessory... [2016-03-24 11:44:17] [Lautsprecher Küche] Initializing Sonos accessory... [2016-03-24 11:44:24] [HarmonyHub] Found Logitech Harmony remote hub: 192.168.2.94 [2016-03-24 11:44:24] [HarmonyHub] Connecting to Logitech Harmony remote hub... /usr/local/lib/node_modules/homebridge-sonos/index.js:145 var zoneType = description["zoneType"]; ^

TypeError: Cannot read property 'zoneType' of undefined at SonosAccessory. (/usr/local/lib/node_modules/homebridge-sonos/index.js:145:35) at Request._callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/lib/sonos.js:608:21) at self.callback (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/node_modules/request/request.js:129:22) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at ClientRequest.self.clientErrorHandler (/usr/local/lib/node_modules/homebridge-sonos/node_modules/sonos/node_modules/request/request.js:239:10) at emitOne (events.js:77:13) at ClientRequest.emit (events.js:169:7) at Socket.socketOnEnd (_http_client.js:288:9) at emitNone (events.js:72:20) `


Ok, now after ireinstalled all stuff and follow your instruction.

replace your current index.js file from this git repo with the one with this one: https://github.com/fwboettger/homebridge-sonos/blob/enhancements-0.0.4/index.js

## And now it works. Fine ! Thanks. Pls. tell me what is the different between the original index.js and the other one. ?!