Fix peripheral volume_muted state (#403)
Enable updating the `volume_muted` status when muting/unmuting the media player volume, and improve its tracking.
This commit is contained in:
1 parent
e334aa3fb1
commit
8303a96279
12 files changed
+177
-18
No files matched your search
@@ -217,6 +217,7 @@ class ServerState:
|
||||
_LOGGER.debug("Skipping save - volume unchanged")
|
||||
return
|
||||
|
||||
previous_muted = self.volume == 0.0
|
||||
self.volume = clamped_volume
|
||||
self.preferences.volume = clamped_volume
|
||||
_LOGGER.info("Saving volume %s to %s", clamped_volume, self.preferences_path)
|
||||
@@ -230,6 +231,10 @@ class ServerState:
|
||||
|
||||
api.emit_event_sync(LVAEvent.VOLUME_CHANGED, {"volume": round(clamped_volume, 3)})
|
||||
|
||||
new_muted = clamped_volume == 0.0
|
||||
if previous_muted != new_muted:
|
||||
api.emit_event_sync(LVAEvent.VOLUME_MUTED, {"muted": new_muted})
|
||||
|
||||
def persist_mic_gain(self, gain: float) -> None:
|
||||
"""Persist the microphone auto gain value."""
|
||||
gain_int = int(gain)
|
||||
|
||||
Reference in new issue
Block a user