TTS not working with 2022.5

There are some changes in 2022.5 that I was very excited to see! Unfortunately, when I updated to that version, I found that the tts integration was no longer working. I’ve looked through the changelog and docs (and there are related breaking changes), and have not been able to figure out how I need to adjust my configuration so that our tts notifications will work on version 2022.5. tts does work with our setup on version 2022.4.7.

I am running HomeAssistant Container.

Dockerfile:

FROM ghcr.io/home-assistant/raspberrypi3-homeassistant:2022.4.7
COPY . /.

RUN apk update && apk add --no-cache vlc 

EXPOSE 8123 1883

With configuration.yaml options internal_url and external_url set (and working as expected in version 2022.4.7 and earlier), and the following set (and working as expected in version 2022.4.7 and earlier)

tts:
  - platform: picotts
    language: en-US
    cache: false

notify:
  - name: tts
    platform: rest
    resource: "${EXTERNAL_URL}/api/services/tts/picotts_say"
    method: POST_JSON
    headers:
      Authorization: HASS_TOKEN_REST
      content-type: application/json
    data_template:
      message: "{{message}}"
      entity_id: media_player.vlc
      language: en-US

This works beautifully in versions 2022.4.3 and earlier. But with version 2022.5, I am encountering an error:

12.05.22 14:53:31 (-0400)  homeassistant  [efe46080] main input error: Your input can't be opened
12.05.22 14:53:31 (-0400)  homeassistant  [efe46080] main input error: VLC is unable to open the MRL 'media-source://tts/picotts?message=Door+open&language=en-US'. Check the log for details.

Here are the full details:

12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 172.17.0.8 for /api/services/notify/tts using bearer token
12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/services/notify/tts to 172.17.0.8 (auth: True)
12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=tts, service_data=message=Door open>
12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=notify, service=tts, service_data=message=Door open>)
12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (SyncWorker_4) [paho.mqtt.client] Sending PUBLISH (d0, q0, r0, m157), 'b'simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336'', ... (126 bytes)
12.05.22 14:53:30 (-0400)  homeassistant  2022-05-12 18:53:30 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336: '{"event_type": "call_service", "event_data": {"domain": "notify", "service": "tts", "service_data": {"message": "Door open"}}}', mid: 157
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 172.17.0.8 for /api/services/tts/picotts_say using bearer token
12.05.22 14:53:31 (-0400)  homeassistant  [efe46080] main input error: Your input can't be opened
12.05.22 14:53:31 (-0400)  homeassistant  [efe46080] main input error: VLC is unable to open the MRL 'media-source://tts/picotts?message=Door+open&language=en-US'. Check the log for details.
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/services/tts/picotts_say to 172.17.0.8 (auth: True)
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=tts, service=picotts_say, service_data=message=Door open, entity_id=media_player.vlc, language=en-US>
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=media_player, service=play_media, service_data=entity_id=['media_player.vlc'], media_content_id=media-source://tts/picotts?message=Door+open&language=en-US, media_content_type=music>
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (SyncWorker_0) [paho.mqtt.client] Sending PUBLISH (d0, q0, r0, m158), 'b'simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336'', ... (185 bytes)
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=tts, service=picotts_say, service_data=message=Door open, entity_id=media_player.vlc, language=en-US>)
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=media_player, service=play_media, service_data=entity_id=['media_player.vlc'], media_content_id=media-source://tts/picotts?message=Door+open&language=en-US, media_content_type=music>)
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336: '{"event_type": "call_service", "event_data": {"domain": "tts", "service": "picotts_say", "service_data": {"message": "Door open", "entity_id": "media_player.vlc", "language": "en-US"}}}', mid: 158
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (SyncWorker_1) [paho.mqtt.client] Sending PUBLISH (d0, q0, r0, m159), 'b'simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336'', ... (264 bytes)
12.05.22 14:53:31 (-0400)  homeassistant  2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on simplyhome.hass.event.dbb45b5111d98d67bd2a153844b3c336: '{"event_type": "call_service", "event_data": {"domain": "media_player", "service": "play_media", "service_data": {"entity_id": ["media_player.vlc"], "media_content_id": "media-source://tts/picotts?message=Door+open&language=en-US", "media_content_type": "music"}}}', mid: 159

There must be some additional change that needs to be made to make this compatible with version 2022.5, but other than being sure to remove BASE_URL and use INTERNAL_URL and EXTERNAL_URL instead (which was already done and working for version 2022.4.7), I didn’t see anything in the changelog indicating what needs to be changed.

I’d greatly appreciate any help.
Thank you!
Kathryn Forsythe

Hello, I used google translate and tts over my homepod mini’s for spoken notifications. With 2022.5 this stopped working. In my case removing the base-url in config also did not help. Is the cause of this that the homepod mini’s are not supported in the media browser? Worked like a charm before, would be a shame if this can’t be resolved.

[140178649850016] Error handling message: Unknown error (unknown_error)

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py”, line 27, in _handle_async_response
await func(hass, connection, msg)
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 626, in handle_execute_script
await script_obj.async_run(msg.get(“variables”), context=context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1513, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 405, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 449, in _async_step
self._handle_exception(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 472, in _handle_exception
raise exception
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 447, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 680, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1627, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1664, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File “/usr/src/homeassistant/homeassistant/components/tts/init.py”, line 217, in async_say_handle
await hass.services.async_call(
File “/usr/src/homeassistant/homeassistant/core.py”, line 1627, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1664, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 204, in handle_service
await service.entity_service_call(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 677, in entity_service_call
future.result() # pop exception if have
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 964, in async_request_call
await coro
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 714, in _handle_entity_call
await result
File “/config/custom_components/apple_tv/media_player.py”, line 292, in async_play_media
await self.atv.stream.stream_file(media_id)
File “/usr/local/lib/python3.9/site-packages/pyatv/core/facade.py”, line 382, in stream_file
await self.relay(“stream_file”)(file, **kwargs)
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/init.py”, line 371, in stream_file
audio_file = await open_source(
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/audio_source.py”, line 484, in open_source
return await FileSource.open(source, sample_rate, channels, sample_size)
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/audio_source.py”, line 428, in open
src = await loop.run_in_executor(
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.9/site-packages/miniaudio.py”, line 929, in decode_file
filenamebytes = _get_filename_bytes(filename)
File “/usr/local/lib/python3.9/site-packages/miniaudio.py”, line 807, in _get_filename_bytes
raise FileNotFoundError(filename)
FileNotFoundError: media-source://tts/google_translate?message=This+is+a+test

I have the same issue, TTS worked great for a while but now longer works.

TTS still working from my Sonos speakers

I tried switching from vlc to gstreamer, to see if it made a difference. With gstreamer, just as with vlc, tts works in 2022.4.7 but not in version 2022.5.4. However, the logs provided some additional information.

On making the following service call:

service: tts.picotts_say
data:
  entity_id: media_player.gstreamer
  message: hello

In version 2022.4.7 (which works), I see the following in the logs:

17.05.22 14:02:59 (-0400)  homeassistant  2022-05-17 18:02:59 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [4011783168] Sending {"id":2,"type":"event","event":{"c":{"media_player.gstreamer":{"+":{"lu":1652810579.62104,"c":"1c9edb9d075bd7c41e745e8bcc5af2c9","a":{"volume_level":1.0,"media_content_id":"https://dbb4d67bd2a153844b3c336.balena-devices.com/api/tts_proxy/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_en-us_-_picotts.wav","media_duration":-1,"media_title":"","media_artist":"","media_album_name":""}}}}}}

While making the same service call in version 2022.5.4 (which does not work), I see the following:

:32
17.05.22 14:27:54 (-0400)  homeassistant  2022-05-17 18:27:54 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [4015399048] Sending {"id":2,"type":"event","event":{"c":{"media_player.gstreamer":{"+":{"lu":1652812074.154196,"c":{"user_id":"aa5c86f2f6744bfa97fc0947ec32d3ca","id":"0180d346c8724988a8c08c5c26c44aaa"},"a":{"media_content_id":"media-source://tts/picotts?message=hello"}}}}}}

As you can see, there is a substantial difference between the media_content_id in the working version vs the non-working version.

Removing the apple tv beta and using the general apple tv integration solved my problem.

1 Like

When I try to integrate my homepod mini using the general Apple TV integration, the setup process completes however I don’t see the homepod as an entity. Did you need to do anything additional to get it to appear in HA?

How to set speed of picotts ?

Kindly guide.

Thanks