parautenbach / hass-shairport-sync

A custom media player for Home Assistant that allows you to control and get updates from a Shairport Sync installation using MQTT.
Apache License 2.0
69 stars 12 forks source link

Play/pause control doesn't work, always shows "paused" state #4

Closed rogersmj closed 3 years ago

rogersmj commented 3 years ago

This is a great component, and I was so excited when I found it because this is the last piece to complete my move from Amazon to Apple Music and retain all the Lovelace dashboard and automation functionality I previously had. Thank you.

I got it all set up and talking to my Shairport-sync installation on a RPi via MQTT, and everything works except for play/pause. The media player always shows a state of "paused" in Home Assistant, and the play/pause button on the entity card won't work. Everything else does -- next track, volume, it shows the media info, etc.

In my MQTT Explorer tool, this is what I see on the topic I've configured (at this moment, nothing has been playing for 8 hours):

image

Using Home Assistant Core 2021.6.6 with Mosquitto 6.0.1.

parautenbach commented 3 years ago

Thanks for the feedback, @rogersmj. I'm glad you're excited to use this.

When there is no stream is connected, nothing will happen. I think you just need to have your device (iPhone, Apple TV, etc.) connected to your Shairport Sync instance over Airplay. Only once there's a stream established, the buttons should work.

If that doesn't yield anything or if that is already the case, let's look at your media player config. If you could post that (in other words, the card config on your HA frontend) that would be helpful.

Lastly, you could perhaps enable debug logging on your HA instance so that we can see what happens when you hit play/pause.

logger:
  logs:
    custom_components.shairport_sync: debug

This is just a side question: Did you install via HACS? I'm just checking whether you had any problems with the repo structure when you installed as reported in #3.

rogersmj commented 3 years ago

When there is no stream is connected, nothing will happen. I think you just need to have your device (iPhone, Apple TV, etc.) connected to your Shairport Sync instance over Airplay. Only once there's a stream established, the buttons should work.

That's not what I meant to say. I was just explaining the current state at the time I took the screenshot. I can play music with my phone -- and all the song metadata comes through MQTT correctly, I can skip tracks, control the volume via the HA media player entity, all of it. The only thing that doesn't work is the "play" button. HA thinks the media player is in a "paused" state even when it's playing music.

Here's the config:

- platform: shairport_sync
   name: Shairport Sync Player
   topic: shairport

Did you install via HACS? I'm just checking whether you had any problems with the repo structure when you installed as reported in #3.

I tried to install via HACS, but it put the component in custom_components/custom_components/shairport_sync and it wouldn't work. I deleted it via HACS, and installed manually in custom_components/shairport_sync.

I will try running with debug later and report back.

parautenbach commented 3 years ago

I can skip tracks, control the volume via the HA media player entity, all of it. The only thing that doesn't work is the "play" button. HA thinks the media player is in a "paused" state even when it's playing music.

And thus is it safe to assume that when you hit play/pause on your device the button state doesn't change (between play and pause) but the stream does play/pause (i.e. toggle)?

What frontend card are you using for your player? Would you mind sharing that config too?

I tried to install via HACS, but it put the component in custom_components/custom_components/shairport_sync and it wouldn't work. I deleted it via HACS, and installed manually in custom_components/shairport_sync.

Thank you, I'll fix this.

rogersmj commented 3 years ago

And thus is it safe to assume that when you hit play/pause on your device the button state doesn't change (between play and pause) but the stream does play/pause (i.e. toggle)?

Yes, that's the behavior I was seeing.

However, I sat down this evening to capture the debug logs, and the issue has fixed itself. All controls now work and respond as expected, including play/pause. I restarted HA for a couple other reasons today so maybe one of those restarts got something unstuck.

parautenbach commented 3 years ago

That's odd but I'm glad it's working now. :-)

parautenbach commented 1 year ago

Relates to https://github.com/parautenbach/hass-shairport-sync/pull/13.