From cf39a61aa125c77a5a05ac48292467fcdccb2f12 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 30 Mar 2022 10:40:38 +0200 Subject: [PATCH] Get cast type and manufacturer via http protocol (#68863) --- homeassistant/components/cast/helpers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/cast/helpers.py b/homeassistant/components/cast/helpers.py index ad36fb4e339..3c6ba2af43f 100644 --- a/homeassistant/components/cast/helpers.py +++ b/homeassistant/components/cast/helpers.py @@ -39,9 +39,17 @@ class ChromecastInfo: Uses blocking HTTP / HTTPS. """ + cast_info = self.cast_info + if self.cast_info.cast_type is None or self.cast_info.manufacturer is None: + # Manufacturer and cast type is not available in mDNS data, get it over http + cast_info = dial.get_cast_type( + cast_info, + zconf=ChromeCastZeroconf.get_zeroconf(), + ) + if not self.is_audio_group or self.is_dynamic_group is not None: # We have all information, no need to check HTTP API. - return self + return ChromecastInfo(cast_info=cast_info) # Fill out missing group information via HTTP API. is_dynamic_group = False @@ -57,7 +65,7 @@ class ChromecastInfo: ) return ChromecastInfo( - cast_info=self.cast_info, + cast_info=cast_info, is_dynamic_group=is_dynamic_group, )