hasscc / hass-edge-tts

🗣️ Microsoft Edge TTS for Home Assistant, no need for app_key
357 stars 62 forks source link

I can't get this to work. #36

Closed wptracy closed 1 year ago

wptracy commented 1 year ago

I can't get this to work. Alexa complains, says: Sorry, text to speech can only be called with the notify dot Alexa underscore media service. Please see the Alexa underscore media wiki for details.

Home Assistant 2023.1.7 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230110.0 - latest

[core-ssh custom_components]$ wget -O - https://raw.githubusercontent.com/hasscc/get/main/get | DOMAIN=edge_tts REPO_PATH=hasscc/hass-edge-tts ARCHIVE_TAG=main bash -
Connecting to raw.githubusercontent.com (185.199.109.133:443)
writing to stdout
-                    100% |********************************|  3970  0:00:00 ETA
written to stdout
INFO: Archive URL: https://github.com/hasscc/hass-edge-tts/archive/main.zip
INFO: Trying to find the correct directory...
INFO: Found Home Assistant configuration directory at '/config'
INFO: Changing to the custom_components directory...
INFO: Downloading...
Connecting to github.com (140.82.114.4:443)
Connecting to codeload.github.com (140.82.113.10:443)
saving to '/config/custom_components/main.zip'
main.zip             100% |********************************|  8333  0:00:00 ETA
'/config/custom_components/main.zip' saved
INFO: Unpacking...
INFO: Removing temp files...
INFO: Installation complete.
INFO: 安装成功!

INFO: Remember to restart Home Assistant before you configure it.
INFO: 请重启 Home Assistant
[core-ssh custom_components]$ 

[core-ssh custom_components]$ ls
alexa_media  edge_tts     hacs         xiaomi_miot
[core-ssh custom_components]$ ls edge_tts/
__init__.py    manifest.json  tts.py
[core-ssh custom_components]$ 

restarted, then:
added edge_tts to configuration.yaml:

# Text to speech
tts:
  - platform: google_translate

  - platform: edge_tts
    language: en-US # Default language or voice (Optional)

test in Developer Tools:

service: tts.edge_tts_say
data:
  entity_id: media_player.william_s_office_echo_dot
  message: >-
    You can replace this text with any text you wish. You can either write in
    this text box or paste your own text here.  Try different languages and
    voices. Change the speed and the pitch of the voice. You can even tweak the
    SSML (Speech Synthesis Markup Language) to control how the different
    sections of the text sound. Click on SSML above to give it a try!  Enjoy
    using Text to Speech!
  options:
    voice: Eric (neural)

Alexa complains, says: Sorry, text to speech can only be called with the notify dot Alexa underscore media service. Please see the Alexa underscore media wiki for details.

rany2 commented 1 year ago

@al-one Is this related to https://github.com/hasscc/hass-edge-tts/issues/33?

wptracy commented 1 year ago

I deleted google_translate, but it still didn't work. tts:

rany2 commented 1 year ago

In entity_id replace media_player with notify.alexa_media.

wptracy commented 1 year ago

Like this?

service: tts.edge_tts_say data: entity_id: notify.alexa_media.william_s_office_echo_dot message: >- You can replace this text with any text you wish. You can either write in this text box or paste your own text here. Try different languages and voices. Change the speed and the pitch of the voice. You can even tweak the SSML (Speech Synthesis Markup Language) to control how the different sections of the text sound. Click on SSML above to give it a try! Enjoy using Text to Speech! options: voice: Eric (neural)

image

rany2 commented 1 year ago

@wptracy Could you check these links:

It appears that this is a change in alexa_media_player

rany2 commented 1 year ago

Like this?

I'm not entirely sure, but I think the links I sent above match the issue you're facing.

rany2 commented 1 year ago

voice: Eric (neural)

P.S. your voice is invalid. It should be en-US-EricNeural.

wptracy commented 1 year ago

This is in my automation, and it works.

service: notify.alexa_media_william_s_office_echo_dot data: message: Shelly Flood Detected Water

I replaced entity_id: notify.alexa_media.william_s_office_echo_dot with entity_id: notify.alexa_media_william_s_office_echo_dot And Alexa doesn't say anything.

service: tts.edge_tts_say data: entity_id: notify.alexa_media_william_s_office_echo_dot message: >- You can replace this text with any text you wish. You can either write in this text box or paste your own text here. Try different languages and voices. Change the speed and the pitch of the voice. You can even tweak the SSML (Speech Synthesis Markup Language) to control how the different sections of the text sound. Click on SSML above to give it a try! Enjoy using Text to Speech! options: voice: Eric (neural)

rany2 commented 1 year ago

I'm sorry but I don't think anyone here might be able to help you but there is also this thread with people with similar issues: https://github.com/custom-components/alexa_media_player/issues/1683

wptracy commented 1 year ago

I changed voice and tried again. Alexa still complains.

Text to speech tts:

service: tts.edge_tts_say data: message: >- You can replace this text with any text you wish. You can either write in this text box or paste your own text here. Try different languages and voices. Change the speed and the pitch of the voice. You can even tweak the SSML (Speech Synthesis Markup Language) to control how the different sections of the text sound. Click on SSML above to give it a try! Enjoy using Text to Speech! options: voice: EricNeural entity_id: media_player.william_s_office_echo_dot

wptracy commented 1 year ago

Where is you find the acceptable voice like en-US-EricNeural Is there a list?

rany2 commented 1 year ago

I honestly haven't use HASS in a while (I only maintain the edge-tts library which this uses) but the list is accessible from https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py#L24 or https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=6A5AA1D4EAFF4E9FB37E23D68491D6F4 (either ShortName or Name would work)

wptracy commented 1 year ago

This was working all along. I just didn't know how to use is. These are the currently supported media plays for Home Assistant. https://www.home-assistant.io/integrations/media_player/ Currently only supported on Sonos, Spotify, MPD, Kodi, Roon, Owntone, Squeezebox and Universal.

The Edge TTS card appears in the Media TTS Card. It plays on supported devices. Screenshot from 2023-02-03 14-43-16 Screenshot from 2023-02-03 14-43-08

rany2 commented 1 year ago

So this is solved?

wptracy commented 1 year ago

yes