From 055382c84cc7409e5135ca0291400d43c33790d9 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 1 Feb 2022 10:47:12 +0100 Subject: [PATCH] Improve CastProtocol (#65357) * Improve CastProtocol * Tweak --- homeassistant/components/cast/__init__.py | 2 +- homeassistant/components/cast/media_player.py | 2 +- homeassistant/components/plex/cast.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/cast/__init__.py b/homeassistant/components/cast/__init__.py index cb631e17ccd..86e5557160c 100644 --- a/homeassistant/components/cast/__init__.py +++ b/homeassistant/components/cast/__init__.py @@ -67,7 +67,7 @@ class CastProtocol(Protocol): """Define the format of cast platforms.""" async def async_get_media_browser_root_object( - self, cast_type: str + self, hass: HomeAssistant, cast_type: str ) -> list[BrowseMedia]: """Create a list of root objects for media browsing.""" diff --git a/homeassistant/components/cast/media_player.py b/homeassistant/components/cast/media_player.py index 5f3381896da..975fa3f5836 100644 --- a/homeassistant/components/cast/media_player.py +++ b/homeassistant/components/cast/media_player.py @@ -463,7 +463,7 @@ class CastDevice(MediaPlayerEntity): for platform in self.hass.data[CAST_DOMAIN].values(): children.extend( await platform.async_get_media_browser_root_object( - self._chromecast.cast_type + self.hass, self._chromecast.cast_type ) ) diff --git a/homeassistant/components/plex/cast.py b/homeassistant/components/plex/cast.py index c2a09ff8810..59f23a681f8 100644 --- a/homeassistant/components/plex/cast.py +++ b/homeassistant/components/plex/cast.py @@ -14,7 +14,9 @@ from .const import PLEX_URI_SCHEME from .services import lookup_plex_media -async def async_get_media_browser_root_object(cast_type: str) -> list[BrowseMedia]: +async def async_get_media_browser_root_object( + hass: HomeAssistant, cast_type: str +) -> list[BrowseMedia]: """Create a root object for media browsing.""" return [ BrowseMedia(