Poeschl / Hassio-Addons

The repository for my Home Assistant Supervisor Add-ons.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

SkyLined opened this issue · comments

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

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

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.

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.

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.

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