revert change in vizio logic to fix bug (#66424)
parent
ad0cb4831e
commit
051bf173dc
|
@ -145,7 +145,7 @@ class VizioDevice(MediaPlayerEntity):
|
||||||
self._volume_step = config_entry.options[CONF_VOLUME_STEP]
|
self._volume_step = config_entry.options[CONF_VOLUME_STEP]
|
||||||
self._current_input = None
|
self._current_input = None
|
||||||
self._current_app_config = None
|
self._current_app_config = None
|
||||||
self._app_name = None
|
self._attr_app_name = None
|
||||||
self._available_inputs = []
|
self._available_inputs = []
|
||||||
self._available_apps = []
|
self._available_apps = []
|
||||||
self._all_apps = apps_coordinator.data if apps_coordinator else None
|
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_volume_level = None
|
||||||
self._attr_is_volume_muted = None
|
self._attr_is_volume_muted = None
|
||||||
self._current_input = None
|
self._current_input = None
|
||||||
self._app_name = None
|
self._attr_app_name = None
|
||||||
self._current_app_config = None
|
self._current_app_config = None
|
||||||
self._attr_sound_mode = None
|
self._attr_sound_mode = None
|
||||||
return
|
return
|
||||||
|
@ -265,13 +265,13 @@ class VizioDevice(MediaPlayerEntity):
|
||||||
log_api_exception=False
|
log_api_exception=False
|
||||||
)
|
)
|
||||||
|
|
||||||
self._app_name = find_app_name(
|
self._attr_app_name = find_app_name(
|
||||||
self._current_app_config,
|
self._current_app_config,
|
||||||
[APP_HOME, *self._all_apps, *self._additional_app_configs],
|
[APP_HOME, *self._all_apps, *self._additional_app_configs],
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._app_name == NO_APP_RUNNING:
|
if self._attr_app_name == NO_APP_RUNNING:
|
||||||
self._app_name = None
|
self._attr_app_name = None
|
||||||
|
|
||||||
def _get_additional_app_names(self) -> list[dict[str, Any]]:
|
def _get_additional_app_names(self) -> list[dict[str, Any]]:
|
||||||
"""Return list of additional apps that were included in configuration.yaml."""
|
"""Return list of additional apps that were included in configuration.yaml."""
|
||||||
|
@ -337,8 +337,8 @@ class VizioDevice(MediaPlayerEntity):
|
||||||
@property
|
@property
|
||||||
def source(self) -> str | None:
|
def source(self) -> str | None:
|
||||||
"""Return current input of the device."""
|
"""Return current input of the device."""
|
||||||
if self._app_name is not None and self._current_input in INPUT_APPS:
|
if self._attr_app_name is not None and self._current_input in INPUT_APPS:
|
||||||
return self._app_name
|
return self._attr_app_name
|
||||||
|
|
||||||
return self._current_input
|
return self._current_input
|
||||||
|
|
||||||
|
@ -364,14 +364,6 @@ class VizioDevice(MediaPlayerEntity):
|
||||||
|
|
||||||
return self._available_inputs
|
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
|
@property
|
||||||
def app_id(self) -> str | None:
|
def app_id(self) -> str | None:
|
||||||
"""Return the ID of the current app if it is unknown by pyvizio."""
|
"""Return the ID of the current app if it is unknown by pyvizio."""
|
||||||
|
|
|
@ -764,6 +764,5 @@ async def test_vizio_update_with_apps_on_input(
|
||||||
)
|
)
|
||||||
await _add_config_entry_to_hass(hass, config_entry)
|
await _add_config_entry_to_hass(hass, config_entry)
|
||||||
attr = _get_attr_and_assert_base_attr(hass, DEVICE_CLASS_TV, STATE_ON)
|
attr = _get_attr_and_assert_base_attr(hass, DEVICE_CLASS_TV, STATE_ON)
|
||||||
# App name and app ID should not be in the attributes
|
# app ID should not be in the attributes
|
||||||
assert "app_name" not in attr
|
|
||||||
assert "app_id" not in attr
|
assert "app_id" not in attr
|
||||||
|
|
Loading…
Reference in New Issue