Revert "Make idle chromecasts appear as idle instead of off" (#66005)
parent
4732e37005
commit
7cc6770f83
|
@ -50,6 +50,7 @@ from homeassistant.const import (
|
|||
CAST_APP_ID_HOMEASSISTANT_LOVELACE,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
STATE_IDLE,
|
||||
STATE_OFF,
|
||||
STATE_PAUSED,
|
||||
STATE_PLAYING,
|
||||
)
|
||||
|
@ -636,7 +637,7 @@ class CastDevice(MediaPlayerEntity):
|
|||
return STATE_PLAYING
|
||||
return STATE_IDLE
|
||||
if self._chromecast is not None and self._chromecast.is_idle:
|
||||
return STATE_IDLE
|
||||
return STATE_OFF
|
||||
return None
|
||||
|
||||
@property
|
||||
|
|
|
@ -595,7 +595,7 @@ async def test_entity_availability(hass: HomeAssistant):
|
|||
conn_status_cb(connection_status)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(entity_id)
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
|
||||
connection_status = MagicMock()
|
||||
connection_status.status = "DISCONNECTED"
|
||||
|
@ -624,7 +624,7 @@ async def test_entity_cast_status(hass: HomeAssistant):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
# No media status, pause, play, stop not supported
|
||||
|
@ -642,8 +642,8 @@ async def test_entity_cast_status(hass: HomeAssistant):
|
|||
cast_status_cb(cast_status)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(entity_id)
|
||||
# Volume not hidden even if no app is active
|
||||
assert state.attributes.get("volume_level") == 0.5
|
||||
# Volume hidden if no app is active
|
||||
assert state.attributes.get("volume_level") is None
|
||||
assert not state.attributes.get("is_volume_muted")
|
||||
|
||||
chromecast.app_id = "1234"
|
||||
|
@ -747,7 +747,7 @@ async def test_supported_features(
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert state.attributes.get("supported_features") == supported_features_no_media
|
||||
|
||||
media_status = MagicMock(images=None)
|
||||
|
@ -882,7 +882,7 @@ async def test_entity_play_media(hass: HomeAssistant, quick_play_mock):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
# Play_media
|
||||
|
@ -928,7 +928,7 @@ async def test_entity_play_media_cast(hass: HomeAssistant, quick_play_mock):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
# Play_media - cast with app ID
|
||||
|
@ -970,7 +970,7 @@ async def test_entity_play_media_cast_invalid(hass, caplog, quick_play_mock):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
# play_media - media_type cast with invalid JSON
|
||||
|
@ -1042,7 +1042,7 @@ async def test_entity_media_content_type(hass: HomeAssistant):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
media_status = MagicMock(images=None)
|
||||
|
@ -1213,7 +1213,7 @@ async def test_entity_media_states(hass: HomeAssistant, app_id, state_no_media):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
# App id updated, but no media status
|
||||
|
@ -1258,7 +1258,7 @@ async def test_entity_media_states(hass: HomeAssistant, app_id, state_no_media):
|
|||
cast_status_cb(cast_status)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(entity_id)
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
|
||||
# No cast status
|
||||
chromecast.is_idle = False
|
||||
|
@ -1286,7 +1286,7 @@ async def test_entity_media_states_lovelace_app(hass: HomeAssistant):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
chromecast.app_id = CAST_APP_ID_HOMEASSISTANT_LOVELACE
|
||||
|
@ -1326,7 +1326,7 @@ async def test_entity_media_states_lovelace_app(hass: HomeAssistant):
|
|||
media_status_cb(media_status)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(entity_id)
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
|
||||
chromecast.is_idle = False
|
||||
media_status_cb(media_status)
|
||||
|
@ -1355,7 +1355,7 @@ async def test_group_media_states(hass, mz_mock):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
group_media_status = MagicMock(images=None)
|
||||
|
@ -1406,7 +1406,7 @@ async def test_group_media_control(hass, mz_mock, quick_play_mock):
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.name == "Speaker"
|
||||
assert state.state == "idle"
|
||||
assert state.state == "off"
|
||||
assert entity_id == reg.async_get_entity_id("media_player", "cast", str(info.uuid))
|
||||
|
||||
group_media_status = MagicMock(images=None)
|
||||
|
|
Loading…
Reference in New Issue