Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

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

Closed
pedroxns opened this issue Nov 8, 2020 · 2 comments
Closed

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

pedroxns opened this issue Nov 8, 2020 · 2 comments

Comments

@pedroxns
Copy link

pedroxns commented Nov 8, 2020

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:

  • Apple TV 4k (192.168.0.10)
  • Raspberry pi 4 - Buster ( 192.168.0.73 )
  • 1 instance of Homebridge Runing Alexa plugin, filtering to only show devices added on Hoobs. ( 192.168.0.73:8185)
  • 1 instance of Hoobs with Zigbee2mqtt and now Apple TV remote (192.168.0.73:80)
  • Router TP-Link Deco M9 (wired mesh)

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
Copy link
Owner

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
Copy link
Author

pedroxns commented Nov 8, 2020

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

@pedroxns pedroxns closed this as completed Nov 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants