lukasroegner / homebridge-apple-tv-remote

Plugin for controlling Apple TVs in homebridge.
MIT License
132 stars 13 forks source link

TypeError: Cannot read property 'name' of undefined #79

Closed pedroxns closed 4 years ago

pedroxns commented 4 years ago

Hey, noob here trying to make my Alexa devices control (On/Off only) my Apple TV. I already have a running home bridge with Alexa plugin and a Hoobs running Zigbee plugins for my sensors. Now I want to ask Alexa to turn On/Off my apple tv, nothing more. My setup is:

All devices on the same network with DHCP reservation on router, no firewalls or odd rules.

My json for the plug in is: { "platform": "AppleTvPlatform", "devices": [ { "name": "TVSala", "credentials": "My Credentials", "isOnOffSwitchEnabled": true, "onOffSwitchName": "On/Off", "isOnOffTvEnabled": false, "isPlayPauseSwitchEnabled": true, "playPauseSwitchName": "Tocar", "commandSwitches": [ null ] } ], "isApiEnabled": false, "apiPort": 40304 }

As long as my poor knowledge goes it tells me that this json is ok, but Hoobs services keeps going off with the log:

08/11/2020 12:51:29 TypeError: Cannot read property 'name' of undefined 08/11/2020 12:51:29 at _loop_2 (/home/hoobs/.hoobs/node_modules/homebridge-apple-tv-remote/dist/lib/controllers/apple-tv-controller.js:163:48) 08/11/2020 12:51:29 at new AppleTvController (/home/hoobs/.hoobs/node_modules/homebridge-apple-tv-remote/dist/lib/controllers/apple-tv-controller.js:234:17) 08/11/2020 12:51:29 at Platform.initialize (/home/hoobs/.hoobs/node_modules/homebridge-apple-tv-remote/dist/lib/platform.js:99:53) 08/11/2020 12:51:29 at Platform. (/home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:91:39) 08/11/2020 12:51:29 at step (/home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:33:23) 08/11/2020 12:51:29 at Object.next (/home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:14:53) 08/11/2020 12:51:29 at /home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:8:71 08/11/2020 12:51:29 at new Promise () 08/11/2020 12:51:29 at __awaiter (/home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:4:12) 08/11/2020 12:51:29 at HomebridgeAPI. (/home/hoobs/.hoobs/node_modules/homebridge-framework/dist/lib/homebridge-platform.js:86:64) 08/11/2020 12:51:29 at HomebridgeAPI.emit (events.js:327:22) 08/11/2020 12:51:29 at HomebridgeAPI.signalFinished (/usr/lib/node_modules/@hoobs/hoobs/node_modules/homebridge/lib/api.js:81:14) 08/11/2020 12:51:29 at Server.start (/usr/lib/node_modules/@hoobs/hoobs/bridge/server.js:160:18) 08/11/2020 12:51:29 at /usr/lib/node_modules/@hoobs/hoobs/bridge/cli.js:94:16 08/11/2020 12:51:29 at processTicksAndRejections (internal/process/task_queues.js:93:5)

Soooo, can someone give me a hand (and brains) ?

lukasroegner commented 4 years ago

Hi @pedroxns, When posting code or log snippets, please use the formatting tools so that they are more readable.

I think your issue is this line:

"commandSwitches": [
null
]

It should simply be:

"commandSwitches": []
pedroxns commented 4 years ago

PERFECT !! Thanks and sorry for the formatting issue, will make right next time !