From 5b2bf8fd177813f2b4fc9f45a6ed3ea7e84920f9 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 8 Jun 2020 22:41:12 +0100 Subject: [PATCH] Add status_light to Sonos set_option service (#35515) --- homeassistant/components/sonos/media_player.py | 7 ++++++- homeassistant/components/sonos/services.yaml | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index 72069a026c7..4e4f7338a10 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -99,6 +99,7 @@ ATTR_WITH_GROUP = "with_group" ATTR_NIGHT_SOUND = "night_sound" ATTR_SPEECH_ENHANCE = "speech_enhance" ATTR_QUEUE_POSITION = "queue_position" +ATTR_STATUS_LIGHT = "status_light" UNAVAILABLE_VALUES = {"", "NOT_IMPLEMENTED", None} @@ -281,6 +282,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): { vol.Optional(ATTR_NIGHT_SOUND): cv.boolean, vol.Optional(ATTR_SPEECH_ENHANCE): cv.boolean, + vol.Optional(ATTR_STATUS_LIGHT): cv.boolean, }, "set_option", ) @@ -1242,7 +1244,7 @@ class SonosEntity(MediaPlayerEntity): alarm.save() @soco_error() - def set_option(self, night_sound=None, speech_enhance=None): + def set_option(self, night_sound=None, speech_enhance=None, status_light=None): """Modify playback options.""" if night_sound is not None and self._night_sound is not None: self.soco.night_mode = night_sound @@ -1250,6 +1252,9 @@ class SonosEntity(MediaPlayerEntity): if speech_enhance is not None and self._speech_enhance is not None: self.soco.dialog_mode = speech_enhance + if status_light is not None: + self.soco.status_light = status_light + @soco_error() def play_queue(self, queue_position=0): """Start playing the queue.""" diff --git a/homeassistant/components/sonos/services.yaml b/homeassistant/components/sonos/services.yaml index 53a3b308c17..7a8e2195bf4 100644 --- a/homeassistant/components/sonos/services.yaml +++ b/homeassistant/components/sonos/services.yaml @@ -64,6 +64,9 @@ set_option: speech_enhance: description: Enable Speech Enhancement mode example: "true" + status_light: + description: Enable Status (LED) Light + example: "true" play_queue: description: Starts playing the queue from the first item.