homebridge-dacp
homebridge-dacp copied to clipboard
Cannot read property 'indexOf' of undefined after pairing (tvOS11.3)
I am trying to get homebridge-dacp to work with my AppleTV runnign tvOS11.3.
I have added
{
"platform": "DACP",
"devices": [
{
"name": "AppleTV",
"features": {
"alternate-playpause-switch": true
}
}
]
}
and used the passcode to successfully pair it with AppleTV.
I was asked to insert
{
"name": "AppleTV",
"pairing": "6B413D0D21623AEC",
"serviceName": "ACB0F206EF58248D18A4FC4362CFEEB3050D312E"
}
into the accessories array.
On restart, homebridge crash with the following TypeError:
TypeError: Cannot read property 'indexOf' of undefined
at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:50:12)
at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42)
at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Me too. What is the fix?
I figured it out, Someone else posted their config example. You don't put it in the accessories Array, that is a lie. Paste this: "pairing": "6B413D0D21623AEC", "serviceName": "ACB0F206EF58248D18A4FC4362CFEEB3050D312E" into
{ "platform": "DACP", "devices": [ { "name": "AppleTV", "pairing": "6B413D0D21623AEC", "serviceName": "ACB0F206EF58248D18A4FC4362CFEEB3050D312E", "features": { "alternate-playpause-switch": true } } ] }
let me give it a try.
I meant the device entry with the text. Sorry about the confusion. Will rework this in 1.0.
I am running into this issue as well, I get the same error in the terminal whether I put the pairing & service in accessories or in the devices.
` { "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.",
"accessories": [
],
"platforms": [{
"platform": "Nest",
"token": "token",
"clientId": "id",
"clientSecret": "secret",
"code": "code",
"username": "Username",
"password": "Password"
},
{
"platform": "cmdSwitch2"
},
{
"bridge": {
"name": "Bedroom TV",
"username": "AC:BB:CC:DD:EE:FF",
"port": 54718,
"pin": "135-79-864"
},
"platforms": [
{
"platform": "DACP",
"devices": [
{
"name": "Bedroom TV",
"pairing": "8428412ED4133D5A",
"serviceName": "0BA70389F0174F0CA76067647F322E9FAD33B234",
"features": {
"alternate-playpause-switch": true
}
}
]
}
]
}
]
} `
This is the error i get in terminal.
[1/4/2019,10:27:52 AM] Loaded config.json with 0 accessories and 3 platforms. [1/4/2019, 10:27:52 AM] --- [1/4/2019, 10:27:52 AM] Loaded plugin: homebridge-cmdswitch2 [1/4/2019, 10:27:52 AM] Registering platform 'homebridge-cmdswitch2.cmdSwitch2' [1/4/2019, 10:27:52 AM] --- [1/4/2019, 10:27:53 AM] Loaded plugin: homebridge-dacp [1/4/2019, 10:27:53 AM] Registering platform 'homebridge-dacp.DACP' [1/4/2019, 10:27:53 AM] --- [1/4/2019, 10:27:53 AM] Loaded plugin: homebridge-harmonyhub [1/4/2019, 10:27:53 AM] Registering platform 'homebridge-harmonyhub.HarmonyHub' [1/4/2019, 10:27:53 AM] --- [1/4/2019, 10:27:53 AM] Loaded plugin: homebridge-nest [1/4/2019, 10:27:53 AM] Registering platform 'homebridge-nest.Nest' [1/4/2019, 10:27:53 AM] --- [1/4/2019, 10:27:53 AM] Loading 3 platforms... [1/4/2019, 10:27:53 AM] [Nest] Initializing Nest platform... [1/4/2019, 10:27:53 AM] [Nest] Fetching Nest devices. [1/4/2019, 10:27:53 AM] [cmdSwitch2] Initializing cmdSwitch2 platform... /usr/local/lib/node_modules/homebridge/lib/api.js:108 if (name.indexOf('.') == -1) { ^
TypeError: Cannot read property 'indexOf' of undefined
at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:108:12)
at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:316:45)
at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:36)
at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10)
at Object.
I found my error. I had "platforms": [
twice in the document.