mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add TTS support to Heos (#35386)
* TTS seems unsupported on heos media player #32862 TTS seems unsupported on heos media player #32862 The type media_type music which is required by TTS was not covered. * Update homeassistant/components/heos/media_player.py Co-authored-by: Andrew Sayre <6730289+andrewsayre@users.noreply.github.com> * Update to test_media_player.py Test for TTS support to Heos #35386 * Update test Add TTS support to Heos #35386 * Update to test_play_media_music assert set to "Unable to play music: Failure (1)" seems to cause an issue. * test_play_media_music syntax Co-authored-by: Andrew Sayre <6730289+andrewsayre@users.noreply.github.com>
This commit is contained in:
parent
8895f9b70a
commit
2196bd66c7
@ -161,7 +161,7 @@ class HeosMediaPlayer(MediaPlayerEntity):
|
|||||||
@log_command_error("play media")
|
@log_command_error("play media")
|
||||||
async def async_play_media(self, media_type, media_id, **kwargs):
|
async def async_play_media(self, media_type, media_id, **kwargs):
|
||||||
"""Play a piece of media."""
|
"""Play a piece of media."""
|
||||||
if media_type == MEDIA_TYPE_URL:
|
if media_type in (MEDIA_TYPE_URL, MEDIA_TYPE_MUSIC):
|
||||||
await self._player.play_url(media_id)
|
await self._player.play_url(media_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -614,6 +614,29 @@ async def test_play_media_url(hass, config_entry, config, controller, caplog):
|
|||||||
assert "Unable to play media: Failure (1)" in caplog.text
|
assert "Unable to play media: Failure (1)" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
async def test_play_media_music(hass, config_entry, config, controller, caplog):
|
||||||
|
"""Test the play media service with type music."""
|
||||||
|
await setup_platform(hass, config_entry, config)
|
||||||
|
player = controller.players[1]
|
||||||
|
url = "http://news/podcast.mp3"
|
||||||
|
# First pass completes successfully, second pass raises command error
|
||||||
|
for _ in range(2):
|
||||||
|
await hass.services.async_call(
|
||||||
|
MEDIA_PLAYER_DOMAIN,
|
||||||
|
SERVICE_PLAY_MEDIA,
|
||||||
|
{
|
||||||
|
ATTR_ENTITY_ID: "media_player.test_player",
|
||||||
|
ATTR_MEDIA_CONTENT_TYPE: MEDIA_TYPE_MUSIC,
|
||||||
|
ATTR_MEDIA_CONTENT_ID: url,
|
||||||
|
},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
player.play_url.assert_called_once_with(url)
|
||||||
|
player.play_url.reset_mock()
|
||||||
|
player.play_url.side_effect = CommandFailedError(None, "Failure", 1)
|
||||||
|
assert "Unable to play media: Failure (1)" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_play_media_quick_select(
|
async def test_play_media_quick_select(
|
||||||
hass, config_entry, config, controller, caplog, quick_selects
|
hass, config_entry, config, controller, caplog, quick_selects
|
||||||
):
|
):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user