From fd05a7232ae574809acbb112811d77807219a4b6 Mon Sep 17 00:00:00 2001 From: Ari Simonen Date: Fri, 25 Sep 2020 08:46:57 +0300 Subject: [PATCH] Improve handling of sources without a name in Denon (#40514) --- homeassistant/components/denon/media_player.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/denon/media_player.py b/homeassistant/components/denon/media_player.py index 9f451ab3025..ed90c2ddcb0 100644 --- a/homeassistant/components/denon/media_player.py +++ b/homeassistant/components/denon/media_player.py @@ -111,10 +111,18 @@ class DenonDevice(MediaPlayerEntity): if nsfrn: self._name = nsfrn - # SSFUN - Configured sources with names + # SSFUN - Configured sources with (optional) names self._source_list = {} for line in self.telnet_request(telnet, "SSFUN ?", all_lines=True): - source, configured_name = line[len("SSFUN") :].split(" ", 1) + ssfun = line[len("SSFUN") :].split(" ", 1) + + source = ssfun[0] + if len(ssfun) == 2 and ssfun[1]: + configured_name = ssfun[1] + else: + # No name configured, reusing the source name + configured_name = source + self._source_list[configured_name] = source # SSSOD - Deleted sources