From c085782a16b9741c58c12de8cbb8ff94f2948546 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 18 Dec 2023 10:53:29 +0100 Subject: [PATCH 1/2] Set volume_step in braviatv media_player --- homeassistant/components/braviatv/coordinator.py | 10 ---------- homeassistant/components/braviatv/media_player.py | 9 +-------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/homeassistant/components/braviatv/coordinator.py b/homeassistant/components/braviatv/coordinator.py index 43f911cd3a2..0ee56b672c1 100644 --- a/homeassistant/components/braviatv/coordinator.py +++ b/homeassistant/components/braviatv/coordinator.py @@ -260,16 +260,6 @@ class BraviaTVCoordinator(DataUpdateCoordinator[None]): """Set volume level, range 0..1.""" await self.client.volume_level(round(volume * 100)) - @catch_braviatv_errors - async def async_volume_up(self) -> None: - """Send volume up command to device.""" - await self.client.volume_up() - - @catch_braviatv_errors - async def async_volume_down(self) -> None: - """Send volume down command to device.""" - await self.client.volume_down() - @catch_braviatv_errors async def async_volume_mute(self, mute: bool) -> None: """Send mute command to device.""" diff --git a/homeassistant/components/braviatv/media_player.py b/homeassistant/components/braviatv/media_player.py index cfa388fcce7..484a131379a 100644 --- a/homeassistant/components/braviatv/media_player.py +++ b/homeassistant/components/braviatv/media_player.py @@ -58,6 +58,7 @@ class BraviaTVMediaPlayer(BraviaTVEntity, MediaPlayerEntity): | MediaPlayerEntityFeature.PLAY_MEDIA | MediaPlayerEntityFeature.BROWSE_MEDIA ) + _attr_volume_step = 1 / 100 @property def state(self) -> MediaPlayerState: @@ -123,14 +124,6 @@ class BraviaTVMediaPlayer(BraviaTVEntity, MediaPlayerEntity): """Set volume level, range 0..1.""" await self.coordinator.async_set_volume_level(volume) - async def async_volume_up(self) -> None: - """Send volume up command.""" - await self.coordinator.async_volume_up() - - async def async_volume_down(self) -> None: - """Send volume down command.""" - await self.coordinator.async_volume_down() - async def async_mute_volume(self, mute: bool) -> None: """Send mute command.""" await self.coordinator.async_volume_mute(mute) From 587292ada2311cdabc8ccdbc6b1dad6804eddbb9 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 19 Dec 2023 13:46:54 +0100 Subject: [PATCH 2/2] Refresh after setting volume --- homeassistant/components/braviatv/media_player.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/braviatv/media_player.py b/homeassistant/components/braviatv/media_player.py index 484a131379a..77d51a462fb 100644 --- a/homeassistant/components/braviatv/media_player.py +++ b/homeassistant/components/braviatv/media_player.py @@ -123,6 +123,7 @@ class BraviaTVMediaPlayer(BraviaTVEntity, MediaPlayerEntity): async def async_set_volume_level(self, volume: float) -> None: """Set volume level, range 0..1.""" await self.coordinator.async_set_volume_level(volume) + await self.coordinator.async_refresh() async def async_mute_volume(self, mute: bool) -> None: """Send mute command."""