mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Remove some media player intent checks for when paused (#144351)
This commit is contained in:
parent
76df7de0cf
commit
320df710a4
@ -93,7 +93,6 @@ async def async_setup_intents(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_VOLUME_SET,
|
SERVICE_VOLUME_SET,
|
||||||
required_domains={DOMAIN},
|
required_domains={DOMAIN},
|
||||||
required_states={MediaPlayerState.PLAYING},
|
|
||||||
required_features=MediaPlayerEntityFeature.VOLUME_SET,
|
required_features=MediaPlayerEntityFeature.VOLUME_SET,
|
||||||
required_slots={
|
required_slots={
|
||||||
ATTR_MEDIA_VOLUME_LEVEL: intent.IntentSlotInfo(
|
ATTR_MEDIA_VOLUME_LEVEL: intent.IntentSlotInfo(
|
||||||
@ -159,7 +158,6 @@ class MediaUnpauseHandler(intent.ServiceIntentHandler):
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_MEDIA_PLAY,
|
SERVICE_MEDIA_PLAY,
|
||||||
required_domains={DOMAIN},
|
required_domains={DOMAIN},
|
||||||
required_states={MediaPlayerState.PAUSED},
|
|
||||||
description="Resumes a media player",
|
description="Resumes a media player",
|
||||||
platforms={DOMAIN},
|
platforms={DOMAIN},
|
||||||
device_classes={MediaPlayerDeviceClass},
|
device_classes={MediaPlayerDeviceClass},
|
||||||
|
@ -104,19 +104,6 @@ async def test_unpause_media_player_intent(hass: HomeAssistant) -> None:
|
|||||||
assert call.service == SERVICE_MEDIA_PLAY
|
assert call.service == SERVICE_MEDIA_PLAY
|
||||||
assert call.data == {"entity_id": entity_id}
|
assert call.data == {"entity_id": entity_id}
|
||||||
|
|
||||||
# Test if not paused
|
|
||||||
hass.states.async_set(
|
|
||||||
entity_id,
|
|
||||||
STATE_PLAYING,
|
|
||||||
)
|
|
||||||
|
|
||||||
with pytest.raises(intent.MatchFailedError):
|
|
||||||
response = await intent.async_handle(
|
|
||||||
hass,
|
|
||||||
"test",
|
|
||||||
media_player_intent.INTENT_MEDIA_UNPAUSE,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def test_next_media_player_intent(hass: HomeAssistant) -> None:
|
async def test_next_media_player_intent(hass: HomeAssistant) -> None:
|
||||||
"""Test HassMediaNext intent for media players."""
|
"""Test HassMediaNext intent for media players."""
|
||||||
@ -245,17 +232,6 @@ async def test_volume_media_player_intent(hass: HomeAssistant) -> None:
|
|||||||
assert call.service == SERVICE_VOLUME_SET
|
assert call.service == SERVICE_VOLUME_SET
|
||||||
assert call.data == {"entity_id": entity_id, "volume_level": 0.5}
|
assert call.data == {"entity_id": entity_id, "volume_level": 0.5}
|
||||||
|
|
||||||
# Test if not playing
|
|
||||||
hass.states.async_set(entity_id, STATE_IDLE, attributes=attributes)
|
|
||||||
|
|
||||||
with pytest.raises(intent.MatchFailedError):
|
|
||||||
response = await intent.async_handle(
|
|
||||||
hass,
|
|
||||||
"test",
|
|
||||||
media_player_intent.INTENT_SET_VOLUME,
|
|
||||||
{"volume_level": {"value": 50}},
|
|
||||||
)
|
|
||||||
|
|
||||||
# Test feature not supported
|
# Test feature not supported
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id,
|
entity_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user