Update Vizio source
property to only return current app if i… (#32713)
* only return current app for source if current app is set * check for None specifically * make sure current app isn't called for speaker
This commit is contained in:
parent
c46d0e4a49
commit
fe6ca522e8
2 changed files with 6 additions and 2 deletions
|
@ -304,7 +304,7 @@ class VizioDevice(MediaPlayerDevice):
|
||||||
@property
|
@property
|
||||||
def source(self) -> str:
|
def source(self) -> str:
|
||||||
"""Return current input of the device."""
|
"""Return current input of the device."""
|
||||||
if self._current_input in INPUT_APPS:
|
if self._current_app is not None and self._current_input in INPUT_APPS:
|
||||||
return self._current_app
|
return self._current_app
|
||||||
|
|
||||||
return self._current_input
|
return self._current_input
|
||||||
|
|
|
@ -112,7 +112,9 @@ async def _test_setup(
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.vizio.media_player.VizioAsync.get_power_state",
|
"homeassistant.components.vizio.media_player.VizioAsync.get_power_state",
|
||||||
return_value=vizio_power_state,
|
return_value=vizio_power_state,
|
||||||
):
|
), patch(
|
||||||
|
"homeassistant.components.vizio.media_player.VizioAsync.get_current_app",
|
||||||
|
) as service_call:
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -125,6 +127,8 @@ async def _test_setup(
|
||||||
if ha_power_state == STATE_ON:
|
if ha_power_state == STATE_ON:
|
||||||
assert attr["source_list"] == INPUT_LIST
|
assert attr["source_list"] == INPUT_LIST
|
||||||
assert attr["source"] == CURRENT_INPUT
|
assert attr["source"] == CURRENT_INPUT
|
||||||
|
if ha_device_class == DEVICE_CLASS_SPEAKER:
|
||||||
|
assert not service_call.called
|
||||||
assert (
|
assert (
|
||||||
attr["volume_level"]
|
attr["volume_level"]
|
||||||
== float(int(MAX_VOLUME[vizio_device_class] / 2))
|
== float(int(MAX_VOLUME[vizio_device_class] / 2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue