home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.73k forks source link

Yamaha MusicCast does not work with multiple components. #31400

Closed PurelyNicole closed 4 years ago

PurelyNicole commented 4 years ago

The problem

When I add multiple Yamaha MusicCast players, the one device gets the designation "main." That is the only device that functions properly in Home Assistant. The other devices will all be listed as "off" (even if they are not) and will not be able to be controlled.

Environment

Problem-relevant configuration.yaml

media_player:
  - platform: yamaha_musiccast
    host: !secret loft_yamaha
  - platform: yamaha_musiccast
    host: !secret living_room_yamaha

Traceback/Error logs

There are few errors showing in my logs:

2020-02-01 23:57:05 WARNING (SyncWorker_7) [homeassistant.components.yamaha_musiccast.media_player] Port loft_yamaha:5005 already registered
2020-02-01 23:57:44 ERROR (SyncWorker_19) [rxv] Unsupported Yamaha device? Failed to fetch http://loft_yamaha:80/YamahaRemoteControl/desc.xml
2020-02-01 23:57:44 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform yamaha
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 158, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yamaha/media_player.py", line 105, in setup_platform
    ctrl_url, model_name=model, friendly_name=name, unit_desc_url=desc_url
  File "/usr/local/lib/python3.7/site-packages/rxv/rxv.py", line 392, in zone_controllers
    for zone in self.zones():
  File "/usr/local/lib/python3.7/site-packages/rxv/rxv.py", line 383, in zones
    xml = self._desc_xml
AttributeError: 'RXV' object has no attribute '_desc_xml'
2020-02-01 23:57:55 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.living_room_music fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yamaha/media_player.py", line 211, in update
    self._sound_mode = self.receiver.surround_program
  File "/usr/local/lib/python3.7/site-packages/rxv/rxv.py", line 313, in surround_program
    "%s/Surround/Program_Sel/Current/Sound_Program" % self.zone
AttributeError: 'NoneType' object has no attribute 'text'

Additional information

Each device works as expected if it is the only device in the config. It is when the second device is added that issues occur. I am using R-N303 and WXC-50.

probot-home-assistant[bot] commented 4 years ago

Hey there @jalmeroth, mind taking a look at this issue as its been labeled with a integration (yamaha_musiccast) you are listed as a codeowner for? Thanks!

springstan commented 4 years ago

@PurelyNicole could you please turn on debugging for this component? This will log more messages about this component, which can help to troubleshoot your current issue. See logger for more details.

PurelyNicole commented 4 years ago

@springstan The only additional logging I got from debug was:

2020-02-04 14:28:09 DEBUG (SyncWorker_13) [homeassistant.components.yamaha_musiccast.media_player] update: media_player.loft_main

PurelyNicole commented 4 years ago

Found issue #27987 that seems to be related. The WXC-50 is one of the devices I have as well.

TheZoker commented 4 years ago

I can confirm this issue

PurelyNicole commented 4 years ago

I have found part of the problem is that I didn't have different ports for each of the Yamaha devices. Setting the configuration like makes both devices work in HA:

media_player:
  - platform: yamaha_musiccast
    host: !secret loft_yamaha
    port: 5004
  - platform: yamaha_musiccast
    host: !secret living_room_yamaha
    port: 5005

I am however still getting the same errors in my log.

jackkitley commented 4 years ago

@PurelyNicole Add to your discovery:

discovery:
  ignore:
    - yamaha
PurelyNicole commented 4 years ago

@jackkitley That got rid of my errors, thanks!

cdk222 commented 4 years ago

@PurelyNicole - Did this issue go away for you completely?

I added separate ports and the ignore as above; the error messages did disappear from my log however I still have both the Receiver (HTR-6068) and my wireless speaker (WX-030) show up as 'main' and I am still only able to control one of the players. The other will send an 'On' command but that is it

PurelyNicole commented 4 years ago

@cdk222 The issue did go away for me completely, and I am able to control both devices. One thing I have found is that turning a device off completely can make it uncontrolable until I first control it from the MusicCast app. So I just leave the device on.

jackkitley commented 4 years ago

@PurelyNicole Funnily enough, this also happens to me. My service that i have in home assistant cant turn the device on if it is off. I need to first trigger it on the integration and then it works after that.

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.