Skip to content

Commit

Permalink
Add media player stop support to Cambridge Audio (home-assistant#126066)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahhusby authored Sep 16, 2024
1 parent 529e120 commit 738818a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions homeassistant/components/cambridge_audio/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
TransportControl.TOGGLE_REPEAT: MediaPlayerEntityFeature.REPEAT_SET,
TransportControl.TOGGLE_SHUFFLE: MediaPlayerEntityFeature.SHUFFLE_SET,
TransportControl.SEEK: MediaPlayerEntityFeature.SEEK,
TransportControl.STOP: MediaPlayerEntityFeature.STOP,
}


Expand Down
5 changes: 5 additions & 0 deletions tests/components/cambridge_audio/test_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
SERVICE_MEDIA_PLAY,
SERVICE_MEDIA_PREVIOUS_TRACK,
SERVICE_MEDIA_SEEK,
SERVICE_MEDIA_STOP,
SERVICE_REPEAT_SET,
SERVICE_SHUFFLE_SET,
SERVICE_TURN_OFF,
Expand Down Expand Up @@ -181,6 +182,7 @@ async def test_media_play_pause_stop(
mock_stream_magic_client.now_playing.controls = [
TransportControl.PLAY,
TransportControl.PAUSE,
TransportControl.STOP,
]
await mock_state_update(mock_stream_magic_client)
await hass.async_block_till_done()
Expand All @@ -191,6 +193,9 @@ async def test_media_play_pause_stop(
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PLAY, data, True)
mock_stream_magic_client.play.assert_called_once()

await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_STOP, data, True)
mock_stream_magic_client.stop.assert_called_once()


async def test_media_next_previous_track(
hass: HomeAssistant,
Expand Down

0 comments on commit 738818a

Please sign in to comment.