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 speakerpull/32810/head
parent
c46d0e4a49
commit
fe6ca522e8
|
@ -304,7 +304,7 @@ class VizioDevice(MediaPlayerDevice):
|
|||
@property
|
||||
def source(self) -> str:
|
||||
"""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_input
|
||||
|
|
|
@ -112,7 +112,9 @@ async def _test_setup(
|
|||
), patch(
|
||||
"homeassistant.components.vizio.media_player.VizioAsync.get_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)
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -125,6 +127,8 @@ async def _test_setup(
|
|||
if ha_power_state == STATE_ON:
|
||||
assert attr["source_list"] == INPUT_LIST
|
||||
assert attr["source"] == CURRENT_INPUT
|
||||
if ha_device_class == DEVICE_CLASS_SPEAKER:
|
||||
assert not service_call.called
|
||||
assert (
|
||||
attr["volume_level"]
|
||||
== float(int(MAX_VOLUME[vizio_device_class] / 2))
|
||||
|
|
Loading…
Reference in New Issue