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
This commit is contained in:
k2v1n58 2020-05-28 00:09:15 +02:00 committed by GitHub
parent a7842b6301
commit f14a4935df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -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."""

View File

@ -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)