1
mirror of https://github.com/home-assistant/core synced 2024-09-18 19:55:20 +02:00

revert change in vizio logic to fix bug (#66424)

This commit is contained in:
Raman Gupta 2022-02-14 02:49:19 -05:00 committed by GitHub
parent ad0cb4831e
commit 051bf173dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 17 deletions

View File

@ -145,7 +145,7 @@ class VizioDevice(MediaPlayerEntity):
self._volume_step = config_entry.options[CONF_VOLUME_STEP]
self._current_input = None
self._current_app_config = None
self._app_name = None
self._attr_app_name = None
self._available_inputs = []
self._available_apps = []
self._all_apps = apps_coordinator.data if apps_coordinator else None
@ -209,7 +209,7 @@ class VizioDevice(MediaPlayerEntity):
self._attr_volume_level = None
self._attr_is_volume_muted = None
self._current_input = None
self._app_name = None
self._attr_app_name = None
self._current_app_config = None
self._attr_sound_mode = None
return
@ -265,13 +265,13 @@ class VizioDevice(MediaPlayerEntity):
log_api_exception=False
)
self._app_name = find_app_name(
self._attr_app_name = find_app_name(
self._current_app_config,
[APP_HOME, *self._all_apps, *self._additional_app_configs],
)
if self._app_name == NO_APP_RUNNING:
self._app_name = None
if self._attr_app_name == NO_APP_RUNNING:
self._attr_app_name = None
def _get_additional_app_names(self) -> list[dict[str, Any]]:
"""Return list of additional apps that were included in configuration.yaml."""
@ -337,8 +337,8 @@ class VizioDevice(MediaPlayerEntity):
@property
def source(self) -> str | None:
"""Return current input of the device."""
if self._app_name is not None and self._current_input in INPUT_APPS:
return self._app_name
if self._attr_app_name is not None and self._current_input in INPUT_APPS:
return self._attr_app_name
return self._current_input
@ -364,14 +364,6 @@ class VizioDevice(MediaPlayerEntity):
return self._available_inputs
@property
def app_name(self) -> str | None:
"""Return the name of the current app."""
if self.source == self._app_name:
return self._app_name
return None
@property
def app_id(self) -> str | None:
"""Return the ID of the current app if it is unknown by pyvizio."""

View File

@ -764,6 +764,5 @@ async def test_vizio_update_with_apps_on_input(
)
await _add_config_entry_to_hass(hass, config_entry)
attr = _get_attr_and_assert_base_attr(hass, DEVICE_CLASS_TV, STATE_ON)
# App name and app ID should not be in the attributes
assert "app_name" not in attr
# app ID should not be in the attributes
assert "app_id" not in attr