mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix Sonos sub & surround switch state reporting (#61531)
* Fix sub/surround states, refactor volume param handling * Lint
This commit is contained in:
parent
3198211a7f
commit
9a1109949f
@ -193,7 +193,7 @@ class SonosSpeaker:
|
|||||||
self.volume: int | None = None
|
self.volume: int | None = None
|
||||||
self.muted: bool | None = None
|
self.muted: bool | None = None
|
||||||
self.night_mode: bool | None = None
|
self.night_mode: bool | None = None
|
||||||
self.dialog_mode: bool | None = None
|
self.dialog_level: bool | None = None
|
||||||
self.cross_fade: bool | None = None
|
self.cross_fade: bool | None = None
|
||||||
self.bass: int | None = None
|
self.bass: int | None = None
|
||||||
self.treble: int | None = None
|
self.treble: int | None = None
|
||||||
@ -498,17 +498,18 @@ class SonosSpeaker:
|
|||||||
if "mute" in variables:
|
if "mute" in variables:
|
||||||
self.muted = variables["mute"]["Master"] == "1"
|
self.muted = variables["mute"]["Master"] == "1"
|
||||||
|
|
||||||
if "night_mode" in variables:
|
for bool_var in (
|
||||||
self.night_mode = variables["night_mode"] == "1"
|
"dialog_level",
|
||||||
|
"night_mode",
|
||||||
|
"sub_enabled",
|
||||||
|
"surround_enabled",
|
||||||
|
):
|
||||||
|
if bool_var in variables:
|
||||||
|
setattr(self, bool_var, variables[bool_var] == "1")
|
||||||
|
|
||||||
if "dialog_level" in variables:
|
for int_var in ("bass", "treble"):
|
||||||
self.dialog_mode = variables["dialog_level"] == "1"
|
if int_var in variables:
|
||||||
|
setattr(self, int_var, variables[int_var])
|
||||||
if "bass" in variables:
|
|
||||||
self.bass = variables["bass"]
|
|
||||||
|
|
||||||
if "treble" in variables:
|
|
||||||
self.treble = variables["treble"]
|
|
||||||
|
|
||||||
self.async_write_entity_states()
|
self.async_write_entity_states()
|
||||||
|
|
||||||
@ -982,7 +983,7 @@ class SonosSpeaker:
|
|||||||
self.volume = self.soco.volume
|
self.volume = self.soco.volume
|
||||||
self.muted = self.soco.mute
|
self.muted = self.soco.mute
|
||||||
self.night_mode = self.soco.night_mode
|
self.night_mode = self.soco.night_mode
|
||||||
self.dialog_mode = self.soco.dialog_mode
|
self.dialog_level = self.soco.dialog_mode
|
||||||
self.bass = self.soco.bass
|
self.bass = self.soco.bass
|
||||||
self.treble = self.soco.treble
|
self.treble = self.soco.treble
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user