Improve google cast state reporting (#62587)

This commit is contained in:
Erik Montnemery
2021-12-22 14:54:36 +01:00
committed by GitHub
parent c2b44c5fdc
commit eda9291ca1
2 changed files with 34 additions and 7 deletions

View File

@@ -76,6 +76,8 @@ from .helpers import CastStatusListener, ChromecastInfo, ChromeCastZeroconf
_LOGGER = logging.getLogger(__name__)
APP_IDS_UNRELIABLE_MEDIA_INFO = ("Netflix",)
CAST_SPLASH = "https://www.home-assistant.io/images/cast/splash.png"
SUPPORT_CAST = SUPPORT_PLAY_MEDIA | SUPPORT_TURN_OFF
@@ -564,7 +566,10 @@ class CastDevice(MediaPlayerEntity):
if media_status.player_is_idle:
return STATE_IDLE
if self.app_id is not None and self.app_id != pychromecast.IDLE_APP_ID:
return STATE_PLAYING
if self.app_id in APP_IDS_UNRELIABLE_MEDIA_INFO:
# Some apps don't report media status, show the player as playing
return STATE_PLAYING
return STATE_IDLE
if self._chromecast is not None and self._chromecast.is_idle:
return STATE_OFF
return None