grover / homebridge-dacp

Remotely control Apple TV and iTunes via HomeKit.
MIT License
151 stars 14 forks source link

Accessory Name is undefined #3

Closed fblazevski closed 6 years ago

fblazevski commented 6 years ago

Hi, so I installed the plugin as per instructions and configured the config file as follows (after troubleshooting it's exactly as the readme):

{
    "platform" : "DACP",
    "devices" : [
        {
            "name" : "New Remote Control"
        }
    ]
}

I get the following error now (I tried adding a name under the "platform" as it seems plugins should have a "name" but that didn't fix it. Any ideas? The error seems to do with the variable this._accessories Maybe it's not reading the name? (Line 146:5)

plugin_error

grover commented 6 years ago

Sorry that's a bug. I'll fix that with 0.7.3 tonight.

grover commented 6 years ago

I just published 0.7.3, which should fix this issue.

fblazevski commented 6 years ago

Awesome it works now 👍

badrabbit commented 6 years ago

Tried the pairing process but homebridge always crashes:

[2017-12-17 18:43:06] Loaded plugin: homebridge-applescript-file [2017-12-17 18:43:06] Registering accessory 'homebridge-applescript-file.ApplescriptFile' [2017-12-17 18:43:06] --- [2017-12-17 18:43:06] Loaded plugin: homebridge-config-ui [2017-12-17 18:43:06] Registering platform 'homebridge-config-ui.config' [2017-12-17 18:43:06] --- [2017-12-17 18:43:06] ==================== [2017-12-17 18:43:06] ERROR LOADING PLUGIN homebridge-dacp: [2017-12-17 18:43:06] /usr/local/lib/node_modules/homebridge-dacp/src/dacp/DacpClient.js:22 async login(options) { ^^^^^

SyntaxError: Unexpected identifier at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/homebridge-dacp/src/DacpAccessory.js:6:20) [2017-12-17 18:43:06] ==================== [2017-12-17 18:43:06] Loaded plugin: homebridge-delay-switch [2017-12-17 18:43:06] Registering accessory 'homebridge-delay-switch.DelaySwitch' [2017-12-17 18:43:06] --- [2017-12-17 18:43:06] Loaded config.json with 5 accessories and 2 platforms. [2017-12-17 18:43:06] --- [2017-12-17 18:43:06] Loading 2 platforms... [2017-12-17 18:43:06] [Config] Initializing config platform... /usr/local/lib/node_modules/homebridge/lib/api.js:122 throw new Error("The requested platform '" + name + "' was not registered by any plugin."); ^

Error: The requested platform 'DACP' was not registered by any plugin. at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:122:13) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:294:45) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:85:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3)

badrabbit commented 6 years ago

Also without adding the pairing part to the config, the DACP-plugin won't load:

bildschirmfoto 2017-12-17 um 18 48 33

grover commented 6 years ago

Which node version are you on? Both issues are related and likely due to an old node version.

badrabbit commented 6 years ago

8.9.3 bildschirmfoto 2017-12-17 um 22 09 26

grover commented 6 years ago

That should be good enough. Could you post the configuration? (Strip private data out of it please.)

Which version of the plugin do you have installed?

badrabbit commented 6 years ago

homebridge-dacp 0.7.4

{ "bridge": { "name": "Homebridge", "username": "XX:XX:XX:XX:XX:XX", "port": 51826, "pin": "XXX-XX-XXX", "manufacturer": "@nfarina", "model": "Homebridge", "serialNumber": "0.4.20" }, "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": [{ "accessory": "DelaySwitch", "delay": 5000, "name": "Delay5" }, { "accessory": "DelaySwitch", "delay": 10000, "name": "Delay10" }, { "accessory": "DelaySwitch", "delay": 15000, "name": "Delay15" }, { "accessory": "DelaySwitch", "delay": 300000, "name": "Delay30" }, { "accessory": "ApplescriptFile", "on": "/Users/xxx/Documents/SCRIPTS/_Homebridge_Scripts/Projektor_ON.scpt", "off": "/Users/xxx/Documents/SCRIPTS/_Homebridge_Scripts/Projektor_OFF.scpt", "name": "Projektor" } ], "platforms": [{ "platform": "config", "port": 8088, "log": "/var/log/homebridge.stdout.log", "error_log": "/var/log/homebridge.stderr.log", "restart": "/usr/local/bin/supervisorctl restart homebridge", "name": "Config" }, { "platform": "DACP", "devices": [ { "name": "New Remote Control" } ] }

] }

grover commented 6 years ago

Hmm. This is curious - the same configuration works for me. I'm using:

Do you maybe have multiple node versions installed? A different homebridge version?

badrabbit commented 6 years ago

Yap. That's it! Deleted and uninstalled all node stuff and reinstalled node and Homebridge. No more errors and the initial pairing process is up and running. Thanks for the help! :-)