From 6a9e9e7febc57127a846182328f2fe5b5bad442e Mon Sep 17 00:00:00 2001 From: Henrik Widlund <4659350+henrikwidlund@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:56:39 +0100 Subject: [PATCH] Add support for the Status command (Denon only) --- intg-denonavr/media_player.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/intg-denonavr/media_player.py b/intg-denonavr/media_player.py index 54617a0..5958681 100644 --- a/intg-denonavr/media_player.py +++ b/intg-denonavr/media_player.py @@ -167,6 +167,12 @@ "ECO_OFF": "ECOOFF", } +SimpleCommandMappingsDenon = { + **SimpleCommandMappings, + + "STATUS": "RCSHP0230030", +} + class DenonMediaPlayer(MediaPlayer): """Representation of a Denon Media Player entity.""" @@ -213,7 +219,11 @@ def __init__(self, device: AvrDevice, receiver: avr.DenonDevice): attributes[Attributes.SOUND_MODE] = "" attributes[Attributes.SOUND_MODE_LIST] = [] - self.simple_commands = [*SimpleCommandMappings] + # Denon has additional simple commands + if "denon" in device.name.lower(): + self.simple_commands = [*SimpleCommandMappingsDenon] + else: + self.simple_commands = [*SimpleCommandMappings] options = {Options.SIMPLE_COMMANDS: self.simple_commands} @@ -285,8 +295,9 @@ async def command(self, cmd_id: str, params: dict[str, Any] | None = None) -> St res = await self._receiver.options() case Commands.INFO: res = await self._receiver.info() - case cmd if cmd in SimpleCommandMappings: - res = await self._receiver.send_command(SimpleCommandMappings[cmd]) + # Use SimpleCommandMappingsDenon as it covers both the shared and Denon specific commands + case cmd if cmd in SimpleCommandMappingsDenon: + res = await self._receiver.send_command(SimpleCommandMappingsDenon[cmd]) case _: return StatusCodes.NOT_IMPLEMENTED