Polly not working with AppleTV

Trying to get Polly to play with AppleTV, results in an error:

018-03-03 12:22:33 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.play_media: media_content_type=music, media_content_id=>
Traceback (most recent call last):
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/homeassistant/components/media_player/__init__.py", line 402, in async_service_handler
    yield from getattr(player, method['method'])(**params)
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/homeassistant/components/media_player/apple_tv.py", line 167, in async_play_media
    yield from self.atv.airplay.play_url(media_id)
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/pyatv/internal/apple_tv.py", line 467, in play_url
    return (yield from self.player.play_url(url, position))
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/pyatv/airplay/player.py", line 46, in play_url
    yield from self._wait_for_media_to_end()
  File "/srv/homeassistant/ha_env/lib/python3.5/site-packages/pyatv/airplay/player.py", line 68, in _wait_for_media_to_end
    parsed = plistlib.loads(data)
  File "/usr/lib/python3.5/plistlib.py", line 1006, in loads
    fp, fmt=fmt, use_builtin_types=use_builtin_types, dict_type=dict_type)
  File "/usr/lib/python3.5/plistlib.py", line 991, in load
    raise InvalidFileException()
plistlib.InvalidFileException: Invalid file

Tried all possible output formats (ogg/mp3/pcm). The generated audio file works fine when opened via the browser, so Polly itself is working correctly.

Which version of HA are you running?

Latest one: 0.64.3

Hmm, should be fixed. Can you verify that you have pyatv 0.3.9 (latest version) installed? Also, Apple TV 3 or 4(K)?


It’s an appleTV4.

(ha_env) root@raspberrypi:/srv/homeassistant# pip freeze | grep pyatv
(ha_env) root@raspberrypi:/srv/homeassistant#

Interesting. Has it worked before or have you had it working with some other airplay stream? Did you authenticate and fill in credentials properly? Not sure which error you get otherwise.


I re-authenticated HA against the AppleTV, and now it seems to be working again.

Great! Strange behavior but nice that it worked at least :+1: