From aa6520cac11a39c011cad371ec4792ab4021d891 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Fri, 3 Apr 2020 16:10:14 +0200 Subject: [PATCH] Fix source name (#33565) --- homeassistant/components/braviatv/media_player.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/braviatv/media_player.py b/homeassistant/components/braviatv/media_player.py index 6dd431aac69..f9362799224 100644 --- a/homeassistant/components/braviatv/media_player.py +++ b/homeassistant/components/braviatv/media_player.py @@ -218,8 +218,8 @@ class BraviaTVDevice(MediaPlayerDevice): self._channel_name = playing_info.get("title") self._program_media_type = playing_info.get("programMediaType") self._channel_number = playing_info.get("dispNum") - self._source = playing_info.get("source") self._content_uri = playing_info.get("uri") + self._source = self._get_source() self._duration = playing_info.get("durationSec") self._start_date_time = playing_info.get("startDateTime") else: @@ -229,6 +229,12 @@ class BraviaTVDevice(MediaPlayerDevice): _LOGGER.error(exception_instance) self._state = STATE_OFF + def _get_source(self): + """Return the name of the source.""" + for key, value in self._content_mapping.items(): + if value == self._content_uri: + return key + def _reset_playing_info(self): self._program_name = None self._channel_name = None