Skip to content
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

MPD does not update its status and attributes after playback of audio has started. #386

Open
SkyLined opened this issue Mar 6, 2023 · 5 comments
Labels
bug Something isn't working mpd mpd Addon

Comments

@SkyLined
Copy link

SkyLined commented Mar 6, 2023

Which addon?
MPD version: 1.7.2

Describe the bug
I expect MPD to have status "playing" when it is playing an audio file and switch to "off" once it is done. However, the status remains "playing" after the file is done playing.

To Reproduce

  1. Use an automation to play a file in MPD, wait for MPD to complete playback of the audio file.
  2. Go to "Developer Tools" in Home Automation
  3. Select "States" tab
  4. Look up and select your MPD media_player
  5. See the state is "playing" even though the audio has completed playback.

Expected behavior
Once playback of an audio file is complete, the status of MPD should be set to off

Screenshots
N/A

System
Home Assistant 2023.3.1
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230302.0 - latest
MPD addon 1.7.2

@SkyLined SkyLined added the bug Something isn't working label Mar 6, 2023
@Poeschl Poeschl added the mpd mpd Addon label Mar 6, 2023
@sebaguacamole
Copy link

I'm experiencing the same issue as reported by SkyLined.

Which addon?
MPD version: 1.7.2

Describe the bug
I expect MPD to have status "playing" when it is playing an audio file and switch to "off" once it is done. However, the status remains "playing" after the file is done playing.

To Reproduce

  1. Use an automation to play a file in MPD, wait for MPD to complete playback of the audio file.
  2. Go to "Developer Tools" in Home Automation
  3. Select "States" tab
  4. Look up and select your MPD media_player
  5. See the state is "playing" even though the audio has completed playback.

Expected behavior
Once playback of an audio file is complete, the status of MPD should be set to off

System
Home Assistant 2023.3.3
Supervisor 2023.03.1
Frontend 20230309.0 - latest
MPD addon 1.7.2

@SkyLined
Copy link
Author

The problem appears to be wider than this: MPD only updates its value and attributes once: the moment it starts playing. It does not update afterwards. e.g. media_duration is never set to the actual duration and will always be 0 and media_position is not updated as the file is being played. If you enqueue multiple files, it will not update media_content_id when it starts playing the next file. I've update the title of the issue to reflect this.

@SkyLined SkyLined changed the title MPD status remains "playing" after playback of audio has ended. May 22, 2023
@SkyLined
Copy link
Author

Note that MPD initially behaves as expected and updates its value and attributes. It only gets into this bad state after a while. I have not figured out what triggers this.

Once this issue surfaces, restarting Home Assistant resolves the issue.

Note that playback is not affected; audio plays as usual.

@SkyLined
Copy link
Author

SkyLined commented May 22, 2023

I am testing if I can automatically work around this with an automation that triggers when the media_duration stays at 0 for 5 seconds, which then restarts the add-on.

I tried restarting the add-on once manually. Afterwards, I got a "Can not send command to disconnected client" error whenever I attempted to do anything with the relevant media_player entity, such as attempt to play files or read it's value/attributes. I had to restart HA to resolve this. If this happens again, it may be another clue as to what is causing this.

@Poeschl
Copy link
Owner

Poeschl commented May 23, 2023

It seems to me, that it might be not an issue with the addon, but with the integration of Home Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mpd mpd Addon
3 participants