mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Add control of hardware buttons to Sonos (#49977)
This commit is contained in:
parent
4357d2dc84
commit
2d29959a52
@ -119,6 +119,7 @@ ATTR_ENABLED = "enabled"
|
|||||||
ATTR_INCLUDE_LINKED_ZONES = "include_linked_zones"
|
ATTR_INCLUDE_LINKED_ZONES = "include_linked_zones"
|
||||||
ATTR_MASTER = "master"
|
ATTR_MASTER = "master"
|
||||||
ATTR_WITH_GROUP = "with_group"
|
ATTR_WITH_GROUP = "with_group"
|
||||||
|
ATTR_BUTTONS_ENABLED = "buttons_enabled"
|
||||||
ATTR_NIGHT_SOUND = "night_sound"
|
ATTR_NIGHT_SOUND = "night_sound"
|
||||||
ATTR_SPEECH_ENHANCE = "speech_enhance"
|
ATTR_SPEECH_ENHANCE = "speech_enhance"
|
||||||
ATTR_QUEUE_POSITION = "queue_position"
|
ATTR_QUEUE_POSITION = "queue_position"
|
||||||
@ -229,6 +230,7 @@ async def async_setup_entry(
|
|||||||
platform.async_register_entity_service( # type: ignore
|
platform.async_register_entity_service( # type: ignore
|
||||||
SERVICE_SET_OPTION,
|
SERVICE_SET_OPTION,
|
||||||
{
|
{
|
||||||
|
vol.Optional(ATTR_BUTTONS_ENABLED): cv.boolean,
|
||||||
vol.Optional(ATTR_NIGHT_SOUND): cv.boolean,
|
vol.Optional(ATTR_NIGHT_SOUND): cv.boolean,
|
||||||
vol.Optional(ATTR_SPEECH_ENHANCE): cv.boolean,
|
vol.Optional(ATTR_SPEECH_ENHANCE): cv.boolean,
|
||||||
vol.Optional(ATTR_STATUS_LIGHT): cv.boolean,
|
vol.Optional(ATTR_STATUS_LIGHT): cv.boolean,
|
||||||
@ -605,11 +607,15 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
@soco_error()
|
@soco_error()
|
||||||
def set_option(
|
def set_option(
|
||||||
self,
|
self,
|
||||||
|
buttons_enabled: bool | None = None,
|
||||||
night_sound: bool | None = None,
|
night_sound: bool | None = None,
|
||||||
speech_enhance: bool | None = None,
|
speech_enhance: bool | None = None,
|
||||||
status_light: bool | None = None,
|
status_light: bool | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Modify playback options."""
|
"""Modify playback options."""
|
||||||
|
if buttons_enabled is not None:
|
||||||
|
self.soco.buttons_enabled = buttons_enabled
|
||||||
|
|
||||||
if night_sound is not None and self.speaker.night_mode is not None:
|
if night_sound is not None and self.speaker.night_mode is not None:
|
||||||
self.soco.night_mode = night_sound
|
self.soco.night_mode = night_sound
|
||||||
|
|
||||||
|
@ -103,6 +103,12 @@ set_option:
|
|||||||
device:
|
device:
|
||||||
integration: sonos
|
integration: sonos
|
||||||
fields:
|
fields:
|
||||||
|
buttons_enabled:
|
||||||
|
name: Buttons enabled
|
||||||
|
description: Enable control buttons on the device
|
||||||
|
example: "true"
|
||||||
|
selector:
|
||||||
|
boolean:
|
||||||
night_sound:
|
night_sound:
|
||||||
name: Night sound
|
name: Night sound
|
||||||
description: Enable Night Sound mode
|
description: Enable Night Sound mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user