Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Status command (Denon only) #48

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions intg-denonavr/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@
"ECO_OFF": "ECOOFF",
}

SimpleCommandMappingsDenon = {
**SimpleCommandMappings,

"STATUS": "RCSHP0230030",
}


class DenonMediaPlayer(MediaPlayer):
"""Representation of a Denon Media Player entity."""
Expand Down Expand Up @@ -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}

Expand Down Expand Up @@ -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

Expand Down
Loading