-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Disable volume control for Onkyo when unavailable #14863
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
Conversation
@@ -32,6 +32,9 @@ | |||
SUPPORT_VOLUME_STEP | SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \ | |||
SUPPORT_SELECT_SOURCE | SUPPORT_PLAY | |||
|
|||
SUPPORT_ONKYO_WO_SOUND = SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOUND or VOLUME?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, fixed.
Ok to merge when tests pass. |
Can somebody please force a rebuild. Looks like travis had a network connectivity issue. |
@snikch Closing/Re-opening triggers a rebuild without the need of additional commits. |
@@ -270,7 +273,8 @@ class OnkyoDeviceZone(OnkyoDevice): | |||
def __init__(self, zone, receiver, sources, name=None): | |||
"""Initialize the Zone with the zone identifier.""" | |||
self._zone = zone | |||
super().__init__(receiver, sources, name) | |||
self._supports_volume = True | |||
super(OnkyoDeviceZone, self).__init__(receiver, sources, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super().__init__(receiver, sources, name)
if not (volume_raw and mute_raw and current_source_raw): | ||
return | ||
|
||
# It's possible for some players to have zones set to HDMI with | ||
# no sound control. In this case, the string `N/A` is returned. | ||
self._supports_volume = isinstance(volume_raw[1], (float, int)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this go along with outcome of home-assistant/architecture#1, which said that supported features shouldn't change during entity lifetime? This PR might be valid, but I'm curious as to where the lines are drawn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, hadn't seen that discussed. The features here are less driven by state (idle, on etc.) and more by configuration (set zone 2 to HDMI out instead of speaker out), so they can change during the lifetime of the entity, but aren't expected to do so regularly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that for example, a device is synced to Google Assistant or Amazon Echo exactly once. If it changes, things might sync over incorrectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can move the code determining this into the constructor (not my initial code) and that would avoid the problem? It would add a delay in initialising the entity since it needs to make network requests, I assume that's acceptable and handled correctly.
Description:
Disables volume control support for zones which don't support it. This includes Zones set to HDMI out or pre-out.
There are two possibilities here, a) A zone that can never support volume and b) a zone that currently doesn't support volume. In the first case, we'd get a timeout error attempting to retrieve the volume, resulting in the
volume_raw
value beingFalse
. In the second case we'd receive a response to the volume command, but thevolume_raw[1]
value is the stringN/A
, so we do a type check to check for that. Both cases are handled.fixes #14774
Checklist:
tox
.w/ volume

wo/volume
