alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.44k stars 275 forks source link

[Regression] TTS broken when using service tts.speak #2369

Closed qJake closed 1 month ago

qJake commented 1 month ago

Describe the bug

When using service tts.speak, Alexa responds with the following:

To send TTS, set public url in integration configuration.

I have removed and reconfigured my AMP integration and confirmed my public URL is in fact set.

To Reproduce

  1. Use a custom TTS provider, such as OpenAI TTS.
  2. Create a service call:
    service: tts.speak
    data:
      cache: true
      media_player_entity_id: media_player.sample_alexa_device
      message: This is a sample TTS voice.
    target:
      entity_id: tts.openai_alloy
  3. Call the service.
  4. Alexa says "To send TTS, ..."

Expected behavior

Prior to the regression, the TTS audio would play correctly from the TTS service. It no longer does.

Screenshots

image

System details

Logs

Logger: custom_components.alexa_media.media_player
Source: custom_components/alexa_media/media_player.py:1423
integration: Alexa Media Player ([documentation](https://github.com/alandtse/alexa_media_player/wiki), [issues](https://github.com/alandtse/alexa_media_player/issues))
First occurred: July 27, 2024 at 4:17:57 PM (18 occurrences)
Last logged: 8:33:58 PM

To send TTS, set public url in integration configuration Please see the alexa_media wiki for details.https://github.com/alandtse/alexa_media_player/wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service

Additional context

This used to work recently (within 1 week ago), but I'm not sure when it broke - if it was an upgrade to the AMP component or to Home Assistant itself.

danielbrunt57 commented 1 month ago

To send TTS, set public url in integration configuration

Let me re-examine this aspect of the integration. I may have inadvertently broken it 🥺

Zylazy commented 1 month ago

The same problem here It happened after the upgarde, but I am not sure about the previous version. It must be 4.11.X And the same time i have upgraded HA 2024.7.3

Morpheus2018 commented 1 month ago

the same."To send TTS, .." problem answer when sending tts

cw-cdz commented 1 month ago

Here is a temporary work around until the fix is in:

# Edit custom_components/alexa_media/const.py make the following edit and restart home assistant

DEFAULT_PUBLIC_URL = "https://<your_url>/"

image

I noticed some updates from "public_url" to "hass_url" in #2319 , but it looks like not all logic was updated to read the new config option. I didn't have time to dig deeper because I'm on a tight deadline for another project, so this might not be the full picture.

MJHeijster commented 1 month ago

Ah, and here I was trying to figure this out for over half an hour. Glad it's being addressed :)

Also love this component, thanks for all your work.

Dare2Code commented 1 month ago

Thanks for that temporary workaround. I hope next hotfix address this.

qJake commented 1 month ago

Here is a temporary work around until the fix is in:


# Edit custom_components/alexa_media/const.py make the following edit and restart home assistant

DEFAULT_PUBLIC_URL = "https://<your_url>/"

image

I noticed some updates from "public_url" to "hass_url" in #2319 , but it looks like not all logic was updated to read the new config option. I didn't have time to dig deeper because I'm on a tight deadline for another project, so this might not be the full picture.

Thanks for this - if I edit this right now, will it just get replaced/fixed when the next HACS release installs? I just don't want to break anything in HACS if I edit this manually.

cw-cdz commented 1 month ago

Thanks for this - if I edit this right now, will it just get replaced/fixed when the next HACS release installs? I just don't want to break anything in HACS if I edit this manually.

Correct. The next time the integration is updated it will overwrite everything so this change will no longer be present.

pippo73 commented 1 month ago

Here is a temporary work around until the fix is in:

# Edit custom_components/alexa_media/const.py make the following edit and restart home assistant

DEFAULT_PUBLIC_URL = "https://<your_url>/"

image

I noticed some updates from "public_url" to "hass_url" in #2319 , but it looks like not all logic was updated to read the new config option. I didn't have time to dig deeper because I'm on a tight deadline for another project, so this might not be the full picture.

I would like to thank @cw-cdz for the temporary hack. Hope @alandtse will take in concideration this "solution" to fix the problem with the next release of this integration.

@qJake I hope the developer will consider this for the next release ;-)

qJake commented 1 month ago

Okay, so I made that code update, but I'm getting a different error - Alexa now says:

Sorry, I'm having trouble accessing your Simon Says NA skill right now.

EDIT: Nevermind - figured it out. Firewall was blocking public access to HA.

For anyone else that gets this error, check your firewall and make sure your .mp3 TTS URLs are publicly accessible!

The code workaround works great! 👍

danielbrunt57 commented 1 month ago

Here is a temporary work around until the fix is in:

# Edit custom_components/alexa_media/const.py make the following edit and restart home assistant

DEFAULT_PUBLIC_URL = "https://<your_url>/"

image

I noticed some updates from "public_url" to "hass_url" in #2319 , but it looks like not all logic was updated to read the new config option. I didn't have time to dig deeper because I'm on a tight deadline for another project, so this might not be the full picture.

I think you've hit the nail on the head! I downloaded the old 4.10.3 zip file and will try to do a file-by-file comparison with 4.12.1 of what's different and where and what I screwed up later this evening. My issue right now is sitting for any length of time is painful due to an abscessed pimple on my pelvis... image-1

qJake commented 1 month ago

Thank you for fixing this quickly! 🎉

kristoficko commented 1 month ago

Am I the only one who still has this issue with 4.12.4?

cw-cdz commented 1 month ago

Am I the only one who still has this issue with 4.12.4?

After updating, you need to reconfigure the public URL in the Integration. A side effect of the bug is that it caused it to lose the previous setting. Integration --> Alexa Media Player --> Configure

kristoficko commented 1 month ago

Thanks Brian,

figured that could be the issue, just now I'm struggling to obtain a working version, as the latest one 4.12.4 is giving me the "Unknown Error" as seen in #2393

cw-cdz commented 1 month ago

Thanks Brian,

figured that could be the issue, just now I'm struggling to obtain a working version, as the latest one 4.12.4 is giving me the "Unknown Error" as seen in #2393

I see. Have you tried downgrading to 4.10.3, authenticate again, and then update back to 4.12.4? Then reconfigure the URL and hopefully all will be well (just a theory).

kristoficko commented 1 month ago

That's a little bit tricky, as I don't have the URL field visible in the Configure dialog on an already deployed integration (Just the Excluded/Included devices and the time parameters). Need to remove and add the integration from scratch? Or am I missing something here?

cw-cdz commented 1 month ago

That's a little bit tricky, as I don't have the URL field visible in the Configure dialog on an already deployed integration (Just the Excluded/Included devices and the time parameters). Need to remove and add the integration from scratch? Or am I missing something here?

Initially, I suggested downgrading to a known working version (4.10.3). Since the HACS will not show this version, you would need to manually download it from GitHub: manual mode instructions.

However, upon reconsideration, here’s alternative approach that might work:

kristoficko commented 1 month ago

Sorry Brian, I didn't realize the field Public URL is version dependent. To recap what I did:

My AMP is working again, thank you so much for your support today!