Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions homeassistant/components/universal/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
MediaPlayerState,
)
from homeassistant.const import (
ATTR_ASSUMED_STATE,
ATTR_ENTITY_ID,
ATTR_ENTITY_PICTURE,
ATTR_SUPPORTED_FEATURES,
Expand Down Expand Up @@ -302,6 +303,11 @@ def name(self):
"""Return the name of universal player."""
return self._name

@property
def assumed_state(self) -> bool:
"""Return True if unable to access real state of the entity."""
return self._child_attr(ATTR_ASSUMED_STATE)

@property
def state(self):
"""Return the current state of media player.
Expand Down
7 changes: 7 additions & 0 deletions tests/components/universal/test_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,13 @@ async def test_state_children_only(hass, mock_states):
await ump.async_update()
assert ump.state == STATE_PLAYING

mock_states.mock_mp_1._state = STATE_ON
mock_states.mock_mp_1._attr_assumed_state = True
mock_states.mock_mp_1.async_schedule_update_ha_state()
await hass.async_block_till_done()
await ump.async_update()
assert ump.assumed_state is True


async def test_state_with_children_and_attrs(
hass, config_children_and_attr, mock_states
Expand Down