Pyatv: Adds devices fine but no control or media displayed

Created on 18 Jan 2020  路  12Comments  路  Source: postlund/pyatv

Describe the bug

I can add my AppleTV鈥檚 fine but I鈥檓 unable to control them in anyway. No power on/off, no media artwork displays, does not show any communication when I manually use the AppleTV.

To Reproduce

Used the media controls within HA to power on or control the device.

Expected behavior

To be able to control and see activity of the specific AppleTV.

System Setup (please complete the following information):

  • OS: HA 0.104.2 in docker.
  • Python: whatever ships with the above.
  • pyatv: latest AppleTV beta component from HACS.

Additional context

bug

All 12 comments

Very strange, do you see anything in the logs? You can enable these to get some additional logs:


logger:
  logs:
    pyatv: debug
    custom_components.apple_tv: debug

Ok I added the above And my home-assistant.log went crazy and filled up. Am I looking for something particular? It鈥檚 far too large to post here.

I just removed one of my AppleTV鈥檚 from integrations and attempted re-add thinking that would work but I received the following error after entering the pin:

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/apple_tv/config_flow.py", line 163, in async_begin_pairing
    await self._pairing.begin()
  File "/usr/local/lib/python3.7/site-packages/pyatv/airplay/pairing.py", line 57, in begin
    return await self.auther.start_authentication()
  File "/usr/local/lib/python3.7/site-packages/pyatv/airplay/auth.py", line 32, in start_authentication
    'pair-pin-start', headers=_AIRPLAY_HEADERS)
  File "/usr/local/lib/python3.7/site-packages/pyatv/net.py", line 76, in post_data
    raise ex
  File "/usr/local/lib/python3.7/site-packages/pyatv/net.py", line 66, in post_data
    timeout=DEFAULT_TIMEOUT if timeout is None else timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 357, in _request
    raise RuntimeError('Session is closed')
RuntimeError: Session is closed

A reboot of HA allowed me to re-add the AppleTV but I have the same issue where it鈥檚 not controllable or displays any activity.

When added the device is it normal for the flow to ask me for the PIN twice?

Right, thanks! I believe I now what the problem is. There was a bug where pyatv would close the aiohttp session when it was not supposed to. Since the session is shared between all components in Home Assistant, closing it is not a splendid idea... It is fixed, I just need to release an update. I will do that later today/tonight. I'll let you know so you can try with that version.

Thats great, if you need my full home-assistant.log let me know and I can send it. Like I said its rather large.

I don't think it's necessary, I'm pretty sure this is the problem
馃槉

New version of component is out, please try it out and let me know if problem is solved.

Thanks will do, just waiting for it to propagate to HACS.

Ok that's updated and now working as expected , I can control media, see artwork BUT the power buttons don't seem to work as expected, maybe I think they should turn on/off the AppleTV? but they seem to turn on/off the ability to show/control the media.

Yes, turning on/off only turns the media player in Home Assistant on or off. I have not cracked the nut of turning of the device, keeping track of the state of the device and turning it in again in all given situations. One day maybe.

Thanks for the clarification and the fix. I鈥檒l look forward to more features in the future. Happy to close this now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

postlund picture postlund  路  7Comments

rephlex00 picture rephlex00  路  8Comments

cpohli picture cpohli  路  4Comments

jjlawren picture jjlawren  路  11Comments

micke picture micke  路  9Comments