home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.73k stars 30.45k forks source link

TTS not working with picotts and vlc (or gstreamer) #71788

Closed KLForsythe closed 2 years ago

KLForsythe commented 2 years ago

The problem

With release 2022.5, the tts integration is no longer working with my configuration. It was working up to 2022.4.7.

Instead of hearing a local announcement through the speaker connected to my rPi, I see the following in my container logs:

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.

I am not using the deprecated option BASE_URL, which was noted as a breaking change in the docs - the INTERNAL_URL and EXTERNAL_URL options are set in the configuration.yaml, and work fine in versions 2022.4.7 and earlier, and haven't been able to find any other breaking changes that could contribute to this problem. But something must have changed other than the listed breaking changes - tts worked well with my configuration up until 2022.5.

I'd appreciate any assistance.

What version of Home Assistant Core has the issue?

2022.5

What was the last working version of Home Assistant Core?

2022.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

tts, vlc, picotts

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tts/

Diagnostics information

No response

Example YAML snippet

<configuration.yaml>

homeassistant:
  customize: !include customize.yaml
  packages:
    pack_2: !include voice.yaml
  auth_providers:
    - type: homeassistant
  internal_url: BASE_URL
  external_url: BASE_URL

frontend:
  themes: !include themes.yaml

config:

logger:

media_source:

system_health:

energy:

http:
  server_port: 8123

conversation:
history:
recorder:
  purge_keep_days: 1

logbook:
map:
backup:

mqtt:
  keepalive: 60
  protocol: 3.1
  tls_insecure: True

mqtt_eventstream:
  publish_topic: DEVICE_TOPIC
  subscribe_topic: hass2/#

mobile_app:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
input_boolean: !include input_boolean.yaml
``` media_player: - platform: vlc tts: - platform: picotts language: en-US cache: false notify: - name: tts platform: rest resource: TTS_URL method: POST_JSON headers: Authorization: HASS_TOKEN_REST content-type: application/json data_template: message: "{{message}}" entity_id: media_player.vlc language: en-US ``` ``` ### Anything in the logs that might be useful for us? ```txt 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 12.05.22 14:53:30 (-0400) homeassistant 2022-05-12 18:53:30 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=) 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 12.05.22 14:53:31 (-0400) homeassistant 2022-05-12 18:53:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling 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=) 12.05.22 14:53:31 (-0400) homeassistant 2022-05-12 18:53:31 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=) 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 ``` ``` ### Additional information _No response_
probot-home-assistant[bot] commented 2 years ago

tts documentation tts source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @pvizeli, mind taking a look at this issue as it has been labeled with an integration (tts) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

jingl3s commented 2 years ago

Hello, This issue is related to somehow an issue something near a year ago. The media_library is not handled by vlc source code. It tries to open the media-source url and the entity cannot discover the path.

As per error in the reported issue VLC is unable to open the MRL 'media-source://tts/picotts?message=Door+open&language=en-US'

And here mine not available in home assistant log [00007efd848594c0] main input error: Your input can't be opened [00007efd848594c0] main input error: VLC is unable to open the MRL 'media-source://tts/google_translate?message=hello&cache=true&language=fr'. Check the log for details.

I was able to use VLC to play some media library file by calling the entity with the full path. I am not able to search the VLC and TTS integration. I will fallback on espeak for now

KLForsythe commented 2 years ago

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://hjbb4d67bd2a65f576t8736.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.

Why is the media_content_id being configured differently? And what changes need to be made so tts can work in version 2022.5?

KLForsythe commented 2 years ago

@balloob @frenck Could this PR https://github.com/home-assistant/core/pull/70835 have caused the problem noted above?

Do you have any insight into what changes I need to make so that tts.picotts_say will work in HomeAssistant Container? I've followed all the instructions in the documentation and those listed in the breaking changes ( I am not using the deprecated base_url in the tts settings for example, and instead have internal_url and external_url set - this worked in 2022.4.7).

I would really appreciate it if you could help me figure out what has changed between 2022.4.7 and 2022.5 that is now preventing tts say services from getting the url they were setting previously.

balloob commented 2 years ago

Yeah, looks like VLC and GStreamer both don't resolve media sources. I will open a PR to fix that.

balloob commented 2 years ago

Here you go: