Fix 'Not Available' message for Onkyo integration (#38554)
parent
a6236886e4
commit
061d88f875
|
@ -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")
|
||||
# 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):
|
||||
|
|
Loading…
Reference in New Issue