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

Feature request: volume state/level #10

Closed rogersmj closed 1 year ago

rogersmj commented 1 year ago

Do you think there's a way to get the volume level (and possibly set a volume level)?

Most of my other media players in Home Assistant have a volume_level attribute. I don't see that for a Shairport Sync media player:

image

However, when I change the volume of the Shairport Sync instance (via my iPhone, for instance), I see this on the MQTT topic:

image

Pressing volume up and it looks like this: image

I don't know what these numbers mean, but do you think they could be used to drive a volume_level attribute in HA?

mill1000 commented 1 year ago

Shairport Sync does report a volume level via MQTT, but doesn't support setting an explicit volume.

From the experimentation I did, HA will only display a volume slider if the media player can set an arbitrary volume.

mill1000 commented 1 year ago

Appears there might be some technical limitations: https://github.com/mikebrady/shairport-sync/issues/773

parautenbach commented 1 year ago

Yeah, when I built this I looked into this, but it didn't seem feasible. There are various volume controls involved. I couldn't think of a decent workaround, so stuck with relative volume setting. If someone has a solid implementation and wants to provide it as a PR, I'm obviously open to that. For now, I'll close it.