nfarina / homebridge-sonos

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

Problem starting Homebridge on Raspberry Pi2 when Sonos Accessory included in config.son #16

Open ScottGA opened 8 years ago

ScottGA commented 8 years ago

I apologize for the neophyte question but I can't get home bridge to start if I have a Sonos accessory loaded gun my config.json file. It seems like the Sonos plugin loads correctly but I still get the following error message:

/usr/local/lib/node_modules/homebridge/lib/api.js:33 if (name.indexOf('.') == -1) { ^

TypeError: Cannot read property 'indexOf' of undefined at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:33:11) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:164:42) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:36:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:23:16) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Function.Module.runMain (module.js:467:10)

I have just a very simple config.json file created for now so I can test everything. The file is as follows:

{ "bridge": { "name": "Your Homebridge", "username": "CC:22:3D:E3:CE:31", "port": 51826, "pin": "031-45-154" }, "description": "This is an example configuration file", "platforms": [], "accessories": [{ "accessory": "Http", "name": "Bedroom Lights", "on_url": "http://10.0.1.50:8080/MASTER-LIGHTS-BRIGHT", "off_url": "http://10.0.1.50:8080/MASTER-LIGHTS-OFF", "http_method": "GET", "username": "username", "password": "password" }, { "accessories": [{ "accessory": "Main System", "name": "Main System", "room": "Bedroom" }] }] }

Any help or guidance would be very much appreciated!

fwboettger commented 8 years ago

@ScottGA - your config.json is wrong i believe, should rather be like below if i'm not mistaken?

{ "bridge": { "name": "Your Homebridge", "username": "CC:22:3D:E3:CE:31", "port": 51826, "pin": "031-45-154" },

"description": "This is an example configuration file",

"accessories": [
    {
        "accessory": "Http",
        "name": "Bedroom Lights",
        "on_url": "http://10.0.1.50:8080/MASTER-LIGHTS-BRIGHT",
        "off_url": "http://10.0.1.50:8080/MASTER-LIGHTS-OFF",
        "http_method": "GET",
        "username": "username",
        "password": "password"
    },
    {
        "accessory": "Sonos",
        "name": "Main System",
        "room": "Bedroom"
    }
]

}