From b7a5f5c75cccc0f5113f44d3c07ce9c0f6c7fd45 Mon Sep 17 00:00:00 2001 From: Albert Portnoy Date: Thu, 15 Aug 2024 16:41:40 -0500 Subject: [PATCH] Fix power and source change issues --- homeassistant/components/vizio/media_player.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/vizio/media_player.py b/homeassistant/components/vizio/media_player.py index ba9c92f94f1bbf..eadc126bac372a 100644 --- a/homeassistant/components/vizio/media_player.py +++ b/homeassistant/components/vizio/media_player.py @@ -413,11 +413,13 @@ async def async_select_sound_mode(self, sound_mode: str) -> None: async def async_turn_on(self) -> None: """Turn the device on.""" - await self._device.pow_on(log_api_exception=False) + if not await self._device.get_power_state(log_api_exception=False): + await self._device.pow_on(log_api_exception=False) async def async_turn_off(self) -> None: """Turn the device off.""" - await self._device.pow_off(log_api_exception=False) + if await self._device.get_power_state(log_api_exception=False): + await self._device.pow_off(log_api_exception=False) async def async_mute_volume(self, mute: bool) -> None: """Mute the volume.""" @@ -439,7 +441,7 @@ async def async_media_next_track(self) -> None: async def async_select_source(self, source: str) -> None: """Select input source.""" if source in self._available_inputs: - await self._device.set_input(source, log_api_exception=False) + await self._device.set_input(source.replace("-", "").lower(), log_api_exception=False) elif source in self._get_additional_app_names(): await self._device.launch_app_config( **next(