Pyatv: Pausing apple tv outputs error in home assistant log

Created on 6 Feb 2020  路  9Comments  路  Source: postlund/pyatv

Describe the bug
Pausing the player outputs the following error in the log:

Service async_media_play_pause for media_player.living_room_atv incorrectly returns a coroutine object. Await result instead in service handler. Report bug to integration author.
3:11 PM helpers/service.py (ERROR) - message first occurred at 3:11 PM and shows up 2 times

To Reproduce
Pause the apple tv through home assistant.

Expected behavior
No error in the log :)

System Setup (please complete the following information):

  • OS: hassos
  • Python: no clue?
  • pyatv: latest bundled in the latest version of hass-atv-beta

Additional context

I've also noticed that sometimes the media_player in home assistant gets out of sync or something. To play or pause i need to issue media_player.turn_off and then media_player.turn_on again which seem to update the state and make it possible to pause/play again. turn_off/on does not acutally turn the atv on or off, it just updates the state it seems like.

I have not been able to reliably recreate the error described above, it happens randomly, that's why i have not created a issue for it. But you guys might have an idea why this happens or how it can be be worked around?

3rd party bug

All 9 comments

Yes, I can confirm this (coroutine-thing) 馃槃 I have fixed it locally but not pushed it yet, but will hopefully do that soon. So should go away.

The out-of-sync part is more interesting. What exactly are the symptoms here? Do you see anything in the log? Turning on/off just connects/disconnects the device as you point out. So it basically "resets" the connection.

@postlund Great!

The symptoms are that i cannot play or pause when it happens.
The problem is that like i said, i can't reliably reproduce it.

I have enabled logging but i have yet not experienced the issue since i enabled logging.
I'm pretty new to HA so just double checking here, i enabled it by adding:

logger:
  logs:
    pyatv: debug

to my configuration.yaml and then they should show up in Developer Tools -> Logs?
I will open a new issue once i got some logs or if i can reliably recreate it.


I was thinking i could create a script that ran turn_off and turn_on and then media_play/pause to work around the issue but that didn't work because the coroutine thingy which made me open this issue :)

Ok, is the issue persistent so it doesn't recover at all by itself (i.e. you must toggle the power button)?

Logging looks ok, but I would suggest adding this below the pyatv-line as well:

custom_components.apple_tv: debug

If it happens again and you get some logs, I would happily look at them 馃槉Either attach them here or send them to me by email.

Ok, is the issue persistent so it doesn't recover at all by itself (i.e. you must toggle the power button)?

Correct

Logging looks ok, but I would suggest adding this below the pyatv-line as well:

I've added this and will update once i find something out

Ok, is the issue persistent so it doesn't recover at all by itself (i.e. you must toggle the power button)?

Correct


Scratch that. It's enough to issue turn_off and then turn_on from HA for it to work again. I don't actually have to cycle the physical atv.

I'm gonna try to make a new release today with various fixes and also some additional log points. It might help if the issues happens again.

@postlund Awesome! Thanks!

@micke New version available, please give it a spin and report back if it works!

@postlund Cheers! It seems to have fixed the coroutines issue! 馃帀
I'll let you know if i experience the out of sync issue :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjlawren picture jjlawren  路  4Comments

Gio76 picture Gio76  路  3Comments

postlund picture postlund  路  7Comments

nriley picture nriley  路  18Comments

postlund picture postlund  路  10Comments