diff --git a/denonavr/denonavr.py b/denonavr/denonavr.py index ec71aa4..76a037f 100644 --- a/denonavr/denonavr.py +++ b/denonavr/denonavr.py @@ -922,6 +922,10 @@ async def async_mute(self, mute: bool) -> None: """Mute receiver.""" await self.vol.async_mute(mute) + async def async_mute_toggle(self) -> None: + """Mute toggle receiver via HTTP get command.""" + await self.vol.async_mute_toggle() + async def async_enable_tone_control(self) -> None: """Enable tone control to change settings like bass or treble.""" await self.tonecontrol.async_enable_tone_control() diff --git a/denonavr/volume.py b/denonavr/volume.py index ca8861f..33de312 100644 --- a/denonavr/volume.py +++ b/denonavr/volume.py @@ -350,6 +350,9 @@ async def async_set_volume(self, volume: float) -> None: async def async_mute(self, mute: bool) -> None: """Mute receiver.""" if mute: + if self._muted: + return + if self._device.telnet_available: await self._device.telnet_api.async_send_commands( self._device.telnet_commands.command_mute_on @@ -359,6 +362,21 @@ async def async_mute(self, mute: bool) -> None: self._device.urls.command_mute_on ) else: + if self._muted is False: + return + + if self._device.telnet_available: + await self._device.telnet_api.async_send_commands( + self._device.telnet_commands.command_mute_off + ) + else: + await self._device.api.async_get_command( + self._device.urls.command_mute_off + ) + + async def async_mute_toggle(self) -> None: + """Mute toggle receiver via HTTP get command.""" + if self._muted: if self._device.telnet_available: await self._device.telnet_api.async_send_commands( self._device.telnet_commands.command_mute_off @@ -367,6 +385,15 @@ async def async_mute(self, mute: bool) -> None: await self._device.api.async_get_command( self._device.urls.command_mute_off ) + else: + if self._device.telnet_available: + await self._device.telnet_api.async_send_commands( + self._device.telnet_commands.command_mute_on + ) + else: + await self._device.api.async_get_command( + self._device.urls.command_mute_on + ) async def async_channel_volume_up(self, channel: Channels) -> None: """Increase Channel volume on receiver."""