Skip to content

Commit

Permalink
Associate media_player entities with existing Sonos devices
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlawren committed Jan 7, 2022
1 parent 512519b commit 34999e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions custom_components/sonos_cloud/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
ATTR_MEDIA_EXTRA,
SUPPORT_PLAY_MEDIA,
)
from homeassistant.components.sonos.const import DOMAIN as SONOS_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_IDLE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN, PLAYERS, SESSION
Expand Down Expand Up @@ -50,6 +52,15 @@ def supported_features(self) -> int:
"""Flag media player features that are supported."""
return SUPPORT_PLAY_MEDIA

@property
def device_info(self) -> DeviceInfo:
"""Return information about the device."""
return DeviceInfo(
identifiers={(SONOS_DOMAIN, self.unique_id)},
manufacturer="Sonos",
name=self.name,
)

async def async_play_media(
self, media_type: str, media_id: str, **kwargs: Any
) -> None:
Expand Down

0 comments on commit 34999e6

Please sign in to comment.