From f14a4935dfc7723e701e22ace772ae7b3b53bd98 Mon Sep 17 00:00:00 2001 From: k2v1n58 <38071268+k2v1n58@users.noreply.github.com> Date: Thu, 28 May 2020 00:09:15 +0200 Subject: [PATCH] Widen songpal volume step change compatibility (#36152) * Update songpal / media_player.py Based on issue https://github.com/home-assistant/core/issues/36135 * Update test_media_player.py --- homeassistant/components/songpal/media_player.py | 4 ++-- tests/components/songpal/test_media_player.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/songpal/media_player.py b/homeassistant/components/songpal/media_player.py index 3777ecd8325..578cdaed367 100644 --- a/homeassistant/components/songpal/media_player.py +++ b/homeassistant/components/songpal/media_player.py @@ -316,11 +316,11 @@ class SongpalEntity(MediaPlayerEntity): async def async_volume_up(self): """Set volume up.""" - return await self._volume_control.set_volume("+1") + return await self._volume_control.set_volume(self._volume + 1) async def async_volume_down(self): """Set volume down.""" - return await self._volume_control.set_volume("-1") + return await self._volume_control.set_volume(self._volume - 1) async def async_turn_on(self): """Turn the device on.""" diff --git a/tests/components/songpal/test_media_player.py b/tests/components/songpal/test_media_player.py index 5a7ccfd846d..e4d03d03b0a 100644 --- a/tests/components/songpal/test_media_player.py +++ b/tests/components/songpal/test_media_player.py @@ -156,9 +156,7 @@ async def test_services(hass): await _call(media_player.SERVICE_VOLUME_UP) await _call(media_player.SERVICE_VOLUME_DOWN) assert mocked_device.volume1.set_volume.call_count == 3 - mocked_device.volume1.set_volume.assert_has_calls( - [call(60), call("+1"), call("-1")] - ) + mocked_device.volume1.set_volume.assert_has_calls([call(60), call(51), call(49)]) await _call(media_player.SERVICE_VOLUME_MUTE, is_volume_muted=True) mocked_device.volume1.set_mute.assert_called_once_with(True)