Add support for max_volume#13822
Conversation
|
Hi @relvacode, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
pvizeli
left a comment
There was a problem hiding this comment.
Logic are not allow on this layer.
|
@pvizeli In |
|
Component/Platform they have a device are only interfaces and can only do things they handle by device/library. |
|
Ah that's a shame, on my device volume level 80 will shake the entire house (as the girlfriend found out when she accidentally pressed the volume slider all the way up in the app!), 40 is about as high as we would ever go. Is there another layer by which this can be achieved? The nad media player appears to implement this at the component level https://www.home-assistant.io/components/media_player.nad/ If not feel free to close, I'll continue using this as a custom component |
|
This change is important for more than just customizability. This Onkyo component supports (as per documentation) also Pioneer receivers. And, for example, the volume on my Pioneer SX-S30DAB only goes to 50. @pvizeli I'm not sure I understand your review – this PR is not introducing any logic (apart from value clamping), it's only enabling user-configurability of one value. |
| PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ | ||
| vol.Optional(CONF_HOST): cv.string, | ||
| vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
| vol.Optional(CONF_MAX_VOLUME, default=SUPPORTED_MAX_VOLUME): int, |
There was a problem hiding this comment.
Instead of validating this as int, validate it with a range:
vol.All(vol.Coerce(int), vol.Range(min=0, max=SUPPORTED_MAX_VOLUME))
| hosts = [] | ||
|
|
||
| max_volume = config.get(CONF_MAX_VOLUME) | ||
| if max_volume > SUPPORTED_MAX_VOLUME: |
There was a problem hiding this comment.
This can be removed as it will be handled by the config.
| hosts.append(OnkyoDevice( | ||
| eiscp.eISCP(host), config.get(CONF_SOURCES), | ||
| name=config.get(CONF_NAME))) | ||
| name=config.get(CONF_NAME), max_volume=config.get(CONF_MAX_VOLUME))) |
|
@balloob Requested changes made |
Description:
Adds a new
max_volumeoption to Onkyo media players to limit the maximum volume set by the volume slider.Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5153
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passI get
ERROR: typing: commands failedbut no errors relate toonkyo.pyIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: