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

Fix incorrectly reported volume when using .5 as volume step #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions intg-denonavr/avr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import asyncio
import logging
import math
import time
from asyncio import AbstractEventLoop, Lock
from enum import IntEnum
Expand Down Expand Up @@ -591,6 +592,12 @@ async def _telnet_callback(self, zone: str, event: str, parameter: str) -> None:
level = self.volume_level
if level is None:
level = int(parameter)

# remote only displays integers, round down to the nearest integer
# so that the remote doesn't round up to a higher integer
if self._volume_step == 0.5:
level = math.floor(level)

self.events.emit(Events.UPDATE, self.id, {MediaAttr.VOLUME: level})
elif event == "MU": # Muted
self._set_expected_state(States.ON)
Expand Down