8000 0.32 broke media_player.yamaha · Issue #4226 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

0.32 broke media_player.yamaha #4226

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

Closed
Kernald opened this issue Nov 5, 2016 · 28 comments · Fixed by #4279
Closed

0.32 broke media_player.yamaha #4226

Kernald opened this issue Nov 5, 2016 · 28 comments · Fixed by #4279

Comments

@Kernald
Copy link
Contributor
Kernald commented Nov 5, 2016

Home Assistant release (hass --version):
0.32

Python release (python3 --version):
Don't know exactly, I'm using the docker images

Component/platform:
media_player.yamaha

Description of problem:
Upgrading to 0.32 from 0.31.1, the yamaha component fails to initialize

Problem-relevant configuration.yaml entries and steps to reproduce:

- platform: yamaha
  host: rx-v579
  name: AVR
  source_ignore:
    - "JUKE"
    - "AUX"
    - "AV1"
    - "AV2"
    - "AirPlay"
    - "Bluetooth"
    - "HDMI3"
    - "HDMI4"
    - "HDMI5"
    - "HDMI6"
    - "MusicCast Link"
    - "NET RADIO"
    - "SERVER"
    - "Spotify"
    - "TUNER"
    - "USB"
    - "iPod (USB)"
  source_names:
    AV3: "CD"
    AV4: "TV"
    AV5: "Vinyl"
    AV6: "SNES"
    HDMI1: "Shield"
    HDMI2: "PC"

Traceback (if applicable):

16-11-05 20:34:18 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform yamaha
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_component.py", line 148, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "uvloop/future.pyx", line 230, in __iter__ (uvloop/loop.c:94692)
  File "uvloop/task.pyx", line 186, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:100074)
  File "uvloop/future.pyx", line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:93110)
  File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 82, in setup_platform
    YamahaDevice(name, receiver, source_ignore, source_names)])
  File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 101, in __init__
    self.update()
  File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 107, in update
    self._play_status = self._receiver.play_status()
  File "/usr/local/lib/python3.5/site-packages/rxv/rxv.py", line 238, in play_status
    res = self._request('GET', request_text, zone_cmd=False)
  File "/usr/local/lib/python3.5/site-packages/rxv/rxv.py", line 97, in _request
    response = ET.XML(res.content)
  File "/usr/local/lib/python3.5/xml/etree/ElementTree.py", line 1334, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Additional info:
The exact same configuration works perfectly fine on 0.31.1.

@sdague
Copy link
Contributor
sdague commented Nov 5, 2016

cc: @postlund

@postlund
Copy link
Contributor
postlund commented Nov 5, 2016

I will look into this as soon as I can, thanks you for reporting 👍

@jwl17330536
Copy link

It works for me, but I do get an error. I can't see that it is actually stopping any functionality that I use though.

Nov 05 19:01:36 automation hass[17899]: INFO:homeassistant.loader:Loaded media_player.plex from homeassistant.components.media_player.plex
Nov 05 19:01:38 automation hass[17899]: ERROR:homeassistant.components.media_player:Error while setting up platform yamaha
Nov 05 19:01:38 automation hass[17899]: Traceback (most recent call last):
Nov 05 19:01:38 automation hass[17899]: File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 148, in _async_setup_platform
Nov 05 19:01:38 automation hass[17899]: entity_platform.add_entities, discovery_info
Nov 05 19:01:38 automation hass[17899]: File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
Nov 05 19:01:38 automation hass[17899]: yield self  # This tells Task to wait for completion.
Nov 05 19:01:38 automation hass[17899]: File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
Nov 05 19:01:38 automation hass[17899]: value = future.result()
Nov 05 19:01:38 automation hass[17899]: File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
Nov 05 19:01:38 automation hass[17899]: raise self._exception
Nov 05 19:01:38 automation hass[17899]: File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
Nov 05 19:01:38 automation hass[17899]: result = self.fn(*self.args, **self.kwargs)
Nov 05 19:01:38 automation hass[17899]: File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/yamaha.py", line 80, in setup_platform
Nov 05 19:01:38 automation hass[17899]: if receiver.zone not in zone_ignore:
Nov 05 19:01:38 automation hass[17899]: TypeError: argument of type 'NoneType' is not iterable

Here is my configuration if at all helpful:

media_player:
  - platform: yamaha
    name: 'Family Room Receiver'
    source_ignore:
      - "AUDIO1"
      - "AUDIO2"
      - "AV1"
      - "AV2"
      - "AV3"
      - "AV5"
      - "AV6"
      - "HDMI1"
      - "HDMI2"
      - "HDMI3"
      - "HDMI4"
      - "HDMI5"
      - "Pandora"
      - "Rhapsody"
      - "SERVER"
      - "SiriusXM"
      - "Spotify"
      - "TUNER"
      - "USB"
      - "V-AUX"
      - "iPod (USB)"
      - "NET RADIO"
    source_names:
      AV4: "TV"

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

With nearly the same configuration (the main difference I can see is I specified an host, I'm not relying on discovery), I don't have the same stacktrace, and the entity isn't instantiated at all on my end. I'll try later today without the hard-coded host.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

Update: I have the same error as above without specifying the host attribute. Same goes for 0.32.2 (seems pretty logical looking at the changes).

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

Ok, there are 2 issues here. The play_info one is it's own thing, the zone_ignore is because optional voluptuous attributes don't actually set a default. The zone_ignore is easy to fix. I don't know about the other.

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

Out of curiosity, for folks where zone_ignore fails, do you have > 1 media_player component?

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

The above fixed the zone_ignore issue, for the original issue, I'm not really sure what the issue is. We'd probably need a dump of the XML that is failing to parse to see what's up with it.

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

Good, I see there's some progress. The initial problem is because the receiver does not support the command so we should not use play_status. Not sure how to make a clean implementation, but I will think about it.

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

@postlund we can discover that from the desc.xml I think. It also probably makes sense to make rxv be extremely robust on all it's method calls, even in the face of bad xml.

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

Maybe we can, not sure. Should be easy enough to check though. Would be good to have a proper strategy in rxv for presenting/verifying support for different things. Since functionality is quite limited in rxv, adding is_x_supported-methods for things that are not supported by all receivers might be the easiest and cleanest solution. But it will explode if we add more functionality down the road. Another way is to just throw NotImplementedError and let the user take action (this is what we can do with the current version and I will provide a fix so dev works as expected).

I would not say that it's bad xml in this case, more lack of it. But yeah, better handling of received data would be nice.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

Is there any way I can fetch the desc.xml from my receiver?

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

Sure, just visit/download http:///YamahaRemoteControl/desc.xml

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

Argh, github... insert IP-address of receiver at the right place.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

Wow, I didn't except such a big file. Would any specific part (or the whole file) help for this issue?

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

No, we need the whole thing. Yamaha basically has a full API discovery system in there, so every function and parameter supported in the receiver is there. I would suggest pasting into a gist somewhere. I started building some testing in the rxv project that can use some of these to figure out platform differences.

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

@sdague: Which approach for "exposing" available support are you aiming for in rxv?

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

@postlund
Copy link
Contributor
postlund commented Nov 7, 2016

I've made some sort of fix for the current problem, feel free to try it out.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

I'm using docker so I won't be able to test easily, I'll set up a test instance on your branch and keep you posted. I'll probably won't be able to do this today, though.

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

@Kernald before we merge the work around, it would be good to know that it fixed things for you. It could just get us to another issue with the rxv support of that receiver, and if the issue is deeper than this work around I'd rather figure out how to fix it in the library for real.

@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

@Kernald any idea which input your stereo was on when this happened?

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

Sure, it was HDMI 1.

sdague added a commit to sdague/rxv that referenced this issue Nov 7, 2016
In response to Home Assistant bug -
home-assistant/core#4226

When things go wrong with a request in unexpected ways, we really
don't have enough information to figure out what just happened. This
is especially true with hardware generations that none of the upstream
developers have.

This adds logging support to the library, and introduces a couple of
error cases where we will log low level details of a failure to help
debug these kinds of issues in the future.
sdague added a commit to sdague/rxv that referenced this issue Nov 7, 2016
In response to Home Assistant bug -
home-assistant/core#4226

When things go wrong with a request in unexpected ways, we really
don't have enough information to figure out what just happened. This
is especially true with hardware generations that none of the upstream
developers have.

This adds logging support to the library, and introduces a couple of
error cases where we will log low level details of a failure to help
debug these kinds of issues in the future.
@sdague
Copy link
Contributor
sdague commented Nov 7, 2016

HDMI1 makes total sense. The update call is doing the play_status on update regardless of input. Which is definitely not going to work on HDMI inputs.

So, I actually think - wuub/rxv@82b3806 (upstream fix in rxv) is probably a better fix than #4281 for this, because that makes the library behave more consistently here, and keeps the logic out of HA when possible.

@Kernald any chance you can pull that branch and try that upgraded library? If it works I'll see if we can get rxv released and bump the dependencies in HA for the next release.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

Sure, I should be home in a couple hours :-)

Le lun. 7 nov. 2016 21:01, Sean Dague notifications@github.com a écrit :

HDMI1 makes total sense. The update call is doing the play_status on
update regardless of input. Which is definitely not going to work on HDMI
inputs.

So, I actually think - wuub/rxv@82b3806
wuub/rxv@82b3806
(upstream fix in rxv) is probably a better fix than #4281
#4281 for this,
because that makes the library behave more consistently here, and keeps the
logic out of HA when possible.

@Kernald https://github.com/Kernald any chance you can pull that branch
and try that upgraded library? If it works I'll see if we can get rxv
released and bump the dependencies in HA for the next release.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4226 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AASHiLRWlyQQeUwkI7pJhoQEdDz0DvAfks5q74OGgaJpZM4KqXRx
.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 7, 2016

@sdague I can confirm your fix in rxv works fine. Thanks 👍

By the way, a work-around for anyone encountering this issue: restarting hass on another input (it works for me on AV5 for example) allows the entity to be instantiated, then it's totally usable (with the same stacktrace being logged anytime I'm using HDMI1).

sdague added a commit to sdague/rxv that referenced this issue Nov 8, 2016
In response to Home Assistant bug -
home-assistant/core#4226

When things go wrong with a request in unexpected ways, we really
don't have enough information to figure out what just happened. This
is especially true with hardware generations that none of the upstream
developers have.

This adds logging support to the library, and introduces a couple of
error cases where we will log low level details of a failure to help
debug these kinds of issues in the future.
@sdague sdague self-assigned this Nov 8, 2016
@sdague
Copy link
Contributor
sdague commented Nov 8, 2016

@Kernald ok, rxv fix is merged upstream. Once we get a release I'll propose an HA req bump.

@Kernald
Copy link
Contributor Author
Kernald commented Nov 8, 2016

Great, thanks!

sdague added a commit to sdague/home-assistant that referenced this issue Nov 8, 2016
rxv version 0.3 will issue the play_status command even for sources
that don't support it, causing stack traces during updates when
receivers are on HDMI inputs.

This was fixed in rxv 0.3.1. Bump to fix bug home-assistant#4226.
balloob pushed a commit that referenced this issue Nov 11, 2016
…4279)

* Fix "argument of type 'NoneType' is not iterable" during discovery

When yamaha receivers are dynamically discovered, there config is
empty, which means that we need to set zone_ignore to [] otherwise the
iteration over receivers fails.

* Bump rxv library version to fix play_status bug

rxv version 0.3 will issue the play_status command even for sources
that don't support it, causing stack traces during updates when
receivers are on HDMI inputs.

This was fixed in rxv 0.3.1. Bump to fix bug #4226.

* Don't discovery receivers that we've already configured

The discovery component doesn't know anything about already configured
receivers. This means that specifying a receiver manually will make it
show up twice if you have the discovery component enabled.

This puts a platform specific work around here that ensures that if
the media_player is found, we ignore the discovery system.
balloob pushed a commit that referenced this issue Nov 11, 2016
…4279)

* Fix "argument of type 'NoneType' is not iterable" during discovery

When yamaha receivers are dynamically discovered, there config is
empty, which means that we need to set zone_ignore to [] otherwise the
iteration over receivers fails.

* Bump rxv library version to fix play_status bug

rxv version 0.3 will issue the play_status command even for sources
that don't support it, causing stack traces during updates when
receivers are on HDMI inputs.

This was fixed in rxv 0.3.1. Bump to fix bug #4226.

* Don't discovery receivers that we've already configured

The discovery component doesn't know anything about already configured
receivers. This means that specifying a receiver manually will make it
show up twice if you have the discovery component enabled.

This puts a platform specific work around here that ensures that if
the media_player is found, we ignore the discovery system.
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
0