Skip to content

Commit

Permalink
Address breaking changes and deprecations in 2022.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlawren committed May 2, 2022
1 parent 9d50dba commit fe6db04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion custom_components/sonos_cloud/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"zeroconf": [],
"homekit": {},
"dependencies": [
"http"
"auth"
],
"after_dependencies": [
"media_source",
Expand Down
15 changes: 7 additions & 8 deletions custom_components/sonos_cloud/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
from homeassistant.components.media_player import (
BrowseMedia,
MediaPlayerEntity,
MediaPlayerEntityFeature,
async_process_play_media_url,
)
from homeassistant.components.media_player.const import (
ATTR_MEDIA_EXTRA,
MEDIA_CLASS_DIRECTORY,
SUPPORT_BROWSE_MEDIA,
SUPPORT_PLAY_MEDIA,
SUPPORT_VOLUME_SET,
)
from homeassistant.components.media_player.errors import BrowseError
from homeassistant.components.sonos.const import DOMAIN as SONOS_DOMAIN
Expand Down Expand Up @@ -51,6 +49,12 @@ async def async_setup_entry(
class SonosCloudMediaPlayerEntity(MediaPlayerEntity, RestoreEntity):
"""Representation of a Sonos Cloud entity."""

_attr_supported_features = (
MediaPlayerEntityFeature.BROWSE_MEDIA
| MediaPlayerEntityFeature.PLAY_MEDIA
| MediaPlayerEntityFeature.VOLUME_SET
)

def __init__(self, player: dict[str, Any]):
"""Initializle the entity."""
self._attr_name = player["name"]
Expand All @@ -76,11 +80,6 @@ def state(self) -> str:
"""Return the state of the entity."""
return STATE_IDLE

@property
def supported_features(self) -> int:
"""Flag media player features that are supported."""
return SUPPORT_BROWSE_MEDIA | SUPPORT_PLAY_MEDIA | SUPPORT_VOLUME_SET

@property
def device_info(self) -> DeviceInfo:
"""Return information about the device."""
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Sonos Cloud",
"country": "US",
"domains": ["media_player"],
"homeassistant": "2022.3.0",
"homeassistant": "2022.5.0",
"render_readme": true,
"iot_class": "Cloud Polling"
}

0 comments on commit fe6db04

Please sign in to comment.