That looks good. Do you have another type of media player to test on?
I’ve been testing it both on this Sonos player (terrassen), and on my doorbell (esphome media_player).
Can you play music on these?
Yes. This is my node red code for ringing the doorbell:
return { payload: {
domain: "media_player",
service: "play_media",
target: { entity_id: target },
data: {
announce: true,
media_content_type: "music",
media_content_id: "http://ha.local:8123/local/sounds/" + file,
}
}};
It works very well.
The sonos player is used as a second doorbell and for spotify music.
Select your device in its integration, browse media/TTS/ and try in there and see what happens.
Under the sonos integration / Text-to-speech I have cloud, google no com, google en com and piper.
I tried the sample text on all of them.
No reaction, and nothing in the log file.
from the same UI I can play my spotify playlists etc.
Are the players on the same subnet as your home assitant server?
Yes they are
Well, Im out of ideas here…
Thanks for trying. There must be something rotten deeper in my system, I guess.
In my cabin, which has a far simpler configuration, this works just fine.
Have you tried removing those devices and adding them back in?
Yes, the sonos player was removed, used in my cabin (and working), moved back and re-added. no change.
I took a look at this is a debugger, as i’ve been doing some dev work on the Sonos integration, and the URL it will send to Sonos using tts.speak and google is something like this:
If you turn debug on for Sonos it will log the URL for
_LOGGER.debug("Playing %s using websocket audioclip", media_id)
You can then use that URL in a browser and it should play. If it does not then there’s may be a firewall, network config issue.
Revisiting this problem, since it’s still there.
When testing this on an esphome media player, I can see in the esphome log that it tries to play the file:
https://mydomain.no/api/tts_proxy/sUR4opdRPVEajVxvkgc1Sg.mp3
When I paste this link into my pc browser, it works just fine, so the file is ok.
Under /config/tts this file appears:
d525ce82b1f026def3c573598cd000e210414819_tr-tr_-_tts.piper.mp3
So my question now is:
Where is this located in the file system, and why can’t the media player find it, when the browser can?
I’m on a learning curve with some of the ESPHome based Voice Assistant stuff, but a recent thread on Discord mentioned that there may be a problem in ESPHome’s ffmpeg_proxy being able to handle “certain kinds of certificates” when trying to retrieve the TTS generated mp3 file using https. My guess is that this is the same problem you are encountering.
My guess is that these two files are one-and-the-same, and the tts_proxy is translating the file names.
I copied the generated file to /config/www and tried to play it on the esphome player. it did not work, even if it works just fine on my pc!
But: It doesn’t play on sonos media players either! So I guess that rules out the esphome media player as a suspect.
It appears to be a media_player problem. I have created an issue in github.
Solved!
Hi,
I don’t understand what this “automatic” setting is actually used for. Do you?
In my case when the “automatic” setting is off, the UI displays an actual/useable URL, but when the “automatic” setting is on, the UI displays an obscured and grayed out URL.
I don’t either. I see the same as you do, and it worked when I changed it. So I’m happy (until I find that something else is broken).