From 061d88f875bc8ebdbd82c8dd4bad072f3a299837 Mon Sep 17 00:00:00 2001 From: tizzen33 <53906250+tizzen33@users.noreply.github.com> Date: Mon, 17 Aug 2020 00:06:22 +0200 Subject: [PATCH] Fix 'Not Available' message for Onkyo integration (#38554) --- homeassistant/components/onkyo/media_player.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/onkyo/media_player.py b/homeassistant/components/onkyo/media_player.py index 2b67f06ac3c..283c1468385 100644 --- a/homeassistant/components/onkyo/media_player.py +++ b/homeassistant/components/onkyo/media_player.py @@ -239,6 +239,7 @@ class OnkyoDevice(MediaPlayerEntity): self._source_mapping = sources self._reverse_mapping = {value: key for key, value in sources.items()} self._attributes = {} + self._hdmi_out_supported = True def command(self, command): """Run an eiscp command and catch connection errors.""" @@ -251,6 +252,7 @@ class OnkyoDevice(MediaPlayerEntity): else: _LOGGER.info("%s is disconnected. Attempting to reconnect", self._name) return False + _LOGGER.debug("Result for %s: %s", command, result) return result def update(self): @@ -268,7 +270,13 @@ class OnkyoDevice(MediaPlayerEntity): volume_raw = self.command("volume query") mute_raw = self.command("audio-muting query") current_source_raw = self.command("input-selector query") - hdmi_out_raw = self.command("hdmi-output-selector query") + # If the following command is sent to a device with only one HDMI out, + # the display shows 'Not Available'. + # We avoid this by checking if HDMI out is supported + if self._hdmi_out_supported: + hdmi_out_raw = self.command("hdmi-output-selector query") + else: + hdmi_out_raw = [] preset_raw = self.command("preset query") if not (volume_raw and mute_raw and current_source_raw): return @@ -298,6 +306,8 @@ class OnkyoDevice(MediaPlayerEntity): if not hdmi_out_raw: return self._attributes["video_out"] = ",".join(hdmi_out_raw[1]) + if hdmi_out_raw[1] == "N/A": + self._hdmi_out_supported = False @property def name(self):