diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index 3da46b07e9e..47610f242eb 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -1479,14 +1479,14 @@ def item_payload(item): Used by async_browse_media. """ - return { - "title": item.title, - "thumbnail": getattr(item, "album_art_uri", None), - "media_content_id": get_content_id(item), - "media_content_type": SONOS_TO_MEDIA_TYPES[get_media_type(item)], - "can_play": can_play(item.item_class), - "can_expand": can_expand(item), - } + return BrowseMedia( + title=item.title, + thumbnail=getattr(item, "album_art_uri", None), + media_content_id=get_content_id(item), + media_content_type=SONOS_TO_MEDIA_TYPES[get_media_type(item)], + can_play=can_play(item.item_class), + can_expand=can_expand(item), + ) def library_payload(media_library): @@ -1495,14 +1495,14 @@ def library_payload(media_library): Used by async_browse_media. """ - return { - "title": "Music Library", - "media_content_id": "library", - "media_content_type": "library", - "can_play": False, - "can_expand": True, - "children": [item_payload(item) for item in media_library.browse()], - } + return BrowseMedia( + title="Music Library", + media_content_id="library", + media_content_type="library", + can_play=False, + can_expand=True, + children=[item_payload(item) for item in media_library.browse()], + ) def get_media_type(item):