Mic92 / python-mpd2

Python library which provides a client interface for the Music Player Daemon.
GNU Lesser General Public License v3.0
352 stars 119 forks source link

the status () procedure does not return a value for volume #164

Closed rigelinorion closed 3 years ago

rigelinorion commented 3 years ago

Hey. I am trying to get the volume value using the status () procedure. Crashes KeyError: 'volume' Full status ... {'repeat': '0', 'random': '0', 'single': '0', 'consume': '0', 'playlist': '28', 'playlistlength': '1', ' mixrampdb ':' 0.000000 ',' state ':' play ',' song ':' 0 ',' songid ':' 5 ',' time ': '31: 0', 'elapsed': '30 .862 ',' bitrate ':' 30 ',' audio ':' 44100: 16: 2 '}

mweinelt commented 3 years ago

What mpd implementation are you using? This likely means yours does not support volume control over the mpd protocol. Hence why this is optional in home-assistant: https://github.com/home-assistant/core/blob/dev/homeassistant/components/mpd/media_player.py#L324-L325.

Mic92 commented 3 years ago

It only returns volume when you play something. you can do status().get("volume") and check the result.

rigelinorion commented 3 years ago

Hello. I solved the problem by changing the setting in mpd.conf. In the audio_outpu section for alsa, set mixer_type from hardware to software. Thank you for the response.