mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Make sure volume level is valid when incrementing/decrementing (#25061)
* Make sure volume level is not None before incrementing/decrementing * Pass linting checks
This commit is contained in:
parent
ca8118138c
commit
4844477d3a
@ -223,13 +223,19 @@ class VizioDevice(MediaPlayerDevice):
|
||||
|
||||
def volume_up(self):
|
||||
"""Increasing volume of the device."""
|
||||
self._volume_level += self._volume_step / self._max_volume
|
||||
self._device.vol_up(num=self._volume_step)
|
||||
if self._volume_level is not None:
|
||||
self._volume_level = min(1.,
|
||||
self._volume_level +
|
||||
self._volume_step / self._max_volume)
|
||||
|
||||
def volume_down(self):
|
||||
"""Decreasing volume of the device."""
|
||||
self._volume_level -= self._volume_step / self._max_volume
|
||||
self._device.vol_down(num=self._volume_step)
|
||||
if self._volume_level is not None:
|
||||
self._volume_level = max(0.,
|
||||
self._volume_level -
|
||||
self._volume_step / self._max_volume)
|
||||
|
||||
def validate_setup(self):
|
||||
"""Validate if host is available and auth token is correct."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user