Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot read property '0' of undefined" for pre-MusicCast device, Yamaha DSP-Z7 #27

Open
radic00l opened this issue Jan 13, 2021 · 3 comments

Comments

@radic00l
Copy link

radic00l commented Jan 13, 2021

I'm getting an error that is preventing an older (pre-MusicCast) device from being added, i.e.
1/13/2021, 10:38:28 AM Unhandled rejection TypeError: Cannot read property '0' of undefined

My config is as follows

        {
            "platform": "yamaha-zone-tv",
            "discovery_timeout": 10,
            "radio_presets": true,
            "preset_num": true,
            "max_volume": 10,
            "manual_addresses": {
                "Yamaha RX-A3060": "172.16.31.31",
                "Yamaha DSP-Z7": "172.16.31.30"
            }
        }

To give you more information:

  • I'm adding 2 devices, a older generation DSP-Z7 and a MusicCast generation RX-A3060
  • If I understand correctly, MusicCast devices are identified by /YamahaExtendedControl/v1/system/getFeatures, i.e. http://172.16.31.31/YamahaExtendedControl/v1/system/getFeatures for my device
  • And older generation devices do not respond to that URL, and instead reference /YamahaRemoteControl/UnitDesc.xml, i.e. http://172.16.31.30/YamahaRemoteControl/UnitDesc.xml for my device
  • These URLs, as listed above, both work correctly - my output for UnitDesc.xml is available at https://pastebin.com/jDYSaAyZ
  • I tried another Yamaha AV receiver plugin, homebridge-yamaha-avr, and it also could not load the accessory(ies) for the DSP-Z7
  • However, when I went back to what I think is the "original" Yamaha receiver plugin from neonightmare, homebridge-yamaha, both receivers were successfully added
  • So I am confident the receiver is working correctly, but compatibility seems to have been dropped along the way
  • Of course, the original neonightmare plugin doesn't offer as much functionality, and because all these Yamaha plugins add every Yamaha device they can find, I end up with a duplicate RX-A3060 device if I use homebridge-yamaha together with your plugin
  • So I'm hoping that there is some small issue you can replicate using the copy of my output from UnitDesc.xml, that will allow your plugin to correctly add the DSP-Z7 device

For reference, here is the full extract from the logs for your plugin. You'll see the RX-A3060 being added successfully, but the error thrown for the Z7...

1/13/2021, 10:38:25 AM Loaded plugin 'homebridge-yamaha-zone-tv'
1/13/2021, 10:38:25 AM] Registering platform 'homebridge-yamaha-zone-tv.yamaha-zone-tv'
1/13/2021, 10:38:26 AM [yamaha-zone-tv] Initializing yamaha-zone-tv platform...

1/13/2021, 10:38:26 AM [yamaha-zone-tv] Getting Yamaha AVR devices.
1/13/2021, 10:38:26 AM [yamaha-zone-tv] Possible Yamaha device discovered Yamaha RX-A3060 undefined
1/13/2021, 10:38:26 AM [yamaha-zone-tv] Possible Yamaha device discovered Yamaha DSP-7Z undefined

1/13/2021, 10:38:28 AM [yamaha-zone-tv] Found Yamaha DSP-Z7 - 0CE5E8C3, "Yamaha DSP-7Z"
1/13/2021, 10:38:28 AM Unhandled rejection TypeError: Cannot read property '0' of undefined
1/13/2021, 10:38:28 AM at YamahaAVRPlatform.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-yamaha-zone-tv/index.js:188:69)
1/13/2021, 10:38:28 AM at tryCatcher (/home/hoobs/.hoobs/node_modules/bluebird/js/release/util.js:16:23)
1/13/2021, 10:38:28 AM at Promise._settlePromiseFromHandler (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:547:31)
1/13/2021, 10:38:28 AM at Promise._settlePromise (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:604:18)
1/13/2021, 10:38:28 AM at Promise._settlePromise0 (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:649:10)
1/13/2021, 10:38:28 AM at Promise._settlePromises (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:729:18)
1/13/2021, 10:38:28 AM at Promise._fulfill (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:673:18)
1/13/2021, 10:38:28 AM at Promise._resolveCallback (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:489:14)
1/13/2021, 10:38:28 AM at Promise._settlePromiseFromHandler (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:559:17)
1/13/2021, 10:38:28 AM at Promise._settlePromise (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:604:18)
1/13/2021, 10:38:28 AM at Promise._fulfillPromises (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:704:14)
1/13/2021, 10:38:28 AM at Promise._settlePromises (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:730:18)
1/13/2021, 10:38:28 AM at Promise._fulfill (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:673:18)
1/13/2021, 10:38:28 AM at Promise._resolveCallback (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:466:57)
1/13/2021, 10:38:28 AM at Promise._settlePromiseFromHandler (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:559:17)
1/13/2021, 10:38:28 AM at Promise._settlePromise (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:604:18)
1/13/2021, 10:38:28 AM at Promise._settlePromise0 (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:649:10)
1/13/2021, 10:38:28 AM at Promise._settlePromises (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:729:18)
1/13/2021, 10:38:28 AM at Promise._fulfill (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:673:18)
1/13/2021, 10:38:28 AM at Promise._resolveCallback (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:466:57)
1/13/2021, 10:38:28 AM at Promise._settlePromiseFromHandler (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:559:17)
1/13/2021, 10:38:28 AM at Promise._settlePromise (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:604:18)
1/13/2021, 10:38:28 AM at Promise._settlePromise0 (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:649:10)
1/13/2021, 10:38:28 AM at Promise._settlePromises (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:729:18)
1/13/2021, 10:38:28 AM at Promise._fulfill (/home/hoobs/.hoobs/node_modules/bluebird/js/release/promise.js:673:18)
1/13/2021, 10:38:28 AM at Timeout._onTimeout (/home/hoobs/.hoobs/node_modules/bluebird/js/release/timers.js:26:46)
1/13/2021, 10:38:28 AM at listOnTimeout (internal/timers.js:554:17)
1/13/2021, 10:38:28 AM at processTimers (internal/timers.js:497:7)

1/13/2021, 10:38:28 AM [yamaha-zone-tv] Found Yamaha RX-A3060 - 089176F3, "Yamaha RX-A3060"
1/13/2021, 10:38:28 AM [yamaha-zone-tv] WARN: Got multiple systems with ID 089176F3! Omitting duplicate!

1/13/2021, 10:38:28 AM [yamaha-zone-tv] Adding TV Control for Main_Zone
1/13/2021, 10:38:29 AM [yamaha-zone-tv] Adding TV Control for Zone_2
1/13/2021, 10:38:29 AM [yamaha-zone-tv] Adding TV Control for Zone_3

1/13/2021, 10:38:48 AM [yamaha-zone-tv] Waited 10 seconds, stopping discovery.
1/13/2021, 10:38:48 AM [yamaha-zone-tv] Discovery finished, found 3 Yamaha AVR devices.

1/13/2021, 10:38:48 AM Yamaha RX-A3060 Main Zone is running on port 43307.
1/13/2021, 10:38:48 AM Please add [Yamaha RX-A3060 Main Zone] manually in Home app. Setup Code: 031-45-154
1/13/2021, 10:38:48 AM Yamaha RX-A3060 Zone 2 is running on port 42097.
1/13/2021, 10:38:48 AM Please add [Yamaha RX-A3060 Zone 2] manually in Home app. Setup Code: 031-45-154
1/13/2021, 10:38:48 AM Yamaha RX-A3060 Zone 3 is running on port 34011.
1/13/2021, 10:38:48 AM Please add [Yamaha RX-A3060 Zone 3] manually in Home app. Setup Code: 031-45-154

Separately (apologies for combining items, but while I have your attention)... Would it not make sense that if a person specifies manual_addresses, the plugin doesn't attempt to scan the network to index devices itself. This would allow a person to control which Yamaha devices are added, by specifying IP for devices to include and leaving out IP for devices they don't want added. Of course, by default, a person could leave blank and search for all devices.

@NorthernMan54
Copy link
Owner

Thanks for a very detailed issue

A couple of comments

1 - Without have access to the physical device, adding and troubleshooting support issues is close to impossible. If you want to submit a pull request resolving the issue, I can merge it.

2 - Device Discovery - Yeah that is a bit of a wacky experience, and your correct the plugin does not handle the exclusion use case. In this scenario you could just not add/pair the duplicates, or put them is a 'closet'. And after looking at the code, am wondering if you could disable the discovery by setting the discovery timeout to a really low value, ie 1 or .1

@dot-notation
Copy link

Hey...

  1. I'm not sure I'd know how to debug correctly... Is there any chance you'd be interested in trying to debug if I NAT the device to an open public port?
  2. I was wondering what value of 0 would do? Does that effectively disable it, or does it make the timeout infinite?

@NorthernMan54
Copy link
Owner

1 - Not sure this would actually work out

2 - Give it a try and see what happens. I'm thinking a really small value like 1 or .1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants