#Hey there Is there a way to route the
1 messages Β· Page 1 of 1 (latest)
You can remove the "speaker:" part from voice_assistant in the ESPHome config of the Atom Echo and add this to on_tts_end:
- homeassistant.service: service: media_player.play_media data: entity_id: media_player.kitchen media_content_id: !lambda 'return x;' media_content_type: music announce: "true"
You also have to allow the device to make service calls in Home Assistant Devices > ESPHome > CONFIGURE (on the Atom Echo entry)
@harsh yacht forgot to tag you π
Holy crap, that's smart!
Unfortunately I do not have a proper yaml file for the Atom Echo after following the guide π
My yaml file does not have a speaker section
What have I done wrong?
I'm using that one together with ESPHome Beta (that's important): https://github.com/esphome/firmware/blob/main/voice-assistant/m5stack-atom-echo.yaml
You need to remove that line: https://github.com/esphome/firmware/blob/1cc35128b9d3d2e7edf2dd62331a058cc27e754d/voice-assistant/m5stack-atom-echo.yaml#L59
And you can also remove the speaker from the code (but that's not neccessary)
I followed the guide on the home assistant page and it automatically installs the firmware
is that not the latest one?
It should be, but since I didn't used the web installer and adoption features so far, I can't say much about that
okay π How do I set it up without the web installer
THANKS SO MUCH by the way
I just checked. It is using the beta firmware
but when i open the config file of the atom it is not complete
substitutions:
name: m5stack-atom-echo-8a1468
friendly_name: M5Stack Atom Echo 8a1468
packages:
m5stack.atom-echo-voice-assistant: github://esphome/firmware/voice-assistant/m5stack-atom-echo.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
api:
encryption:
key: xxxxx
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
thats all i have
You can remove the "packages" & "substitutions" part and copy and paste the config I linked above
The firmware is beta, yes - but do you have the Beta Addon from ESPHome installed?
If not, you can't compile the firmware
The ESPHome min_version is 2023.10.0b1
You're welcome π
Ja π
Ich auch π Danke! Da wΓ€re ich nie alleine drauf gekommen. Ich melde mich, falls ich wieder zu doof bin nachdem ich das installiert hab.
By the way, I had problems running ESPHome Stable and Beta together. I simply stopped ESPHome Stable and disabled Autostart on Boot. When the current version then comes out of the beta phase, you can then simply switch again.
Das hab ich auch gerade gemacht. Bevor ich Probleme bekomme
Sorry @rain cliff π
Nico just told me that I should probably disable the stable ESPhome add-on while using the beta
Oooh I like that! I think I'll see if i can expand that to "Play on remote media player if there is one in the area the atom is in, and if not, use the speaker"
Sooooo.... @remote salmon I managed to flash the atom echo and when I ask it a question it plays a response on the speaker of the echo and then on my media_player it plays back: "To send tts set public url in integration configuration." What am I missing? π
So, no success. Nothing happens. The Atom Echo keeps playing the response on its on speaker even though I deleted the line and my Alexa Media-Player does not announce the response. When I change the message to a static text it works. Is there a problem with the variable?
@harsh yacht It's weird that the Atom Echo keeps playing the response even if the config for the speaker is removed. Did you also remove the speaker config or just the speaker from voice_assistant? It should not be needed to remove that, too - but maybe I'm wrong here.
I can't say much about the Alexa Media Player, but is your HA instance reachable from outside your WiFi? I assume that this is needed for Alexa Speakers.
When you say it works with static text, then it seems like you are using the service call to send text instead of a sound file to Alexa. That service call you can put under on_tts_start - there the variable 'x' contains the text to be spoken. The only downside is, that the TTS service for the voice assistant can't be disabled - so Piper or HA Cloud TTS is still running, even if you use Alexa's TTS via the service call (if you set TTS to None in Home Assistant, it doesn't work anymore - at least for me).
Great info's here for getting my m5stack atom echo installed into home assistant. Installed the ESPHome beta (thank you nico) but after the compiling, the upload to the device stopped due to an unreachable port #6053 as addition to my defined static IP. How do I config the port #6053 in the yaml file, which is also the latest 2023.10.0b2? Thanks in advance.
edit-1 after retry it wants to make a connection thru port #3232?
========================= [SUCCESS] Took 48.38 seconds ========================= INFO Successfully compiled program. INFO Connecting to 192.168.1.247 ERROR Connecting to 192.168.1.247:3232 failed: [Errno 113] No route to host
@solar pike I don't know - connection issues can have many causes. Are you sure that the device uses that IP? If you have set this in the router, it will not necessarily be applied immediately. Maybe the easiest workaround is installing via "Plug into this computer". Then you can upload the code with ESPHome Web directly.
Thank you Nico, will change to your workaround.
I retried installing with the mentioned workaround. The ESP Device is connected on https://web.esphome.io/?dashboard_install but in home assistant it stays offline. The server gave a strange timestamp at line 1: ets Jun 8 2016 00:22:57
The last two lines of the logfile;
I (668) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU.
Any other options to troubleshoot?
I am still in awe of how simple and effective this was π Thank you, sir!
do you mon to on_tts_end or on_end? Would you mind posting your full section? I'm having trouble getting it to work ...
voice_assistant:
id: va
microphone: luxe_microphone
...
on_tts_end:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.office_speaker # <-- replace with an actual media_player you have
media_content_id: !lambda 'return x;'
media_content_type: music
announce: "true"
also go to Integrations > ESPHome > click Configure on your satellite and make sure Allow the device to make Home Assistant service calls. is checked
hmm, that's about as I have it, I also have the service calls allowd, I'm getting the echo to play sound from dev tools with this service call:
service: notify.alexa_media
data:
message: hallo beef
target: media_player.echo_dot
but not from the esphome device.
I also get an mp3 response url in the esphome logs that plays fine on the computer, but nothing on the echodot ...
I assume media_content_id would be the path the to mp3 file?
use developer settings to tune the exact call to the echo dot (e.g. I see you are calling notify.alexa_media. does media_player.play_media work on it?). then copy the service call to ESPHome and recompile
I don't have an Echo dot to debug
the URL
Just a short answer, since I don't have time at the moment - but if you want to send text (instead of an MP3) to the speaker you can do that, too. That's what I wrote above in this thread:
When you say it works with static text, then it seems like you are using the service call to send text instead of a sound file to Alexa. That service call you can put under on_tts_start - there the variable 'x' contains the text to be spoken. The only downside is, that the TTS service for the voice assistant can't be disabled - so Piper or HA Cloud TTS is still running, even if you use Alexa's TTS via the service call (if you set TTS to None in Home Assistant, it doesn't work anymore - at least for me).
I'm happy that I could help π
phew, if I use this
service: media_player.play_media
data:
media_content_id: http://homeassistant.local:8123/api/tts_proxy/87f5386b815d9a16b10115e2f80fb535454f1d72_de-at_242eaed1e8_cloud.mp3
media_content_type: music
target:
entity_id: media_player.echo_dot
the dot says: "when you send tts, please send announce = true. music can't be played this way". But when I add announce: "true" to the data section, I receive an error.
oh! this was in the logs:
FileNotFoundError: [Errno 2] No such file or directory: '/config/www/alexa_ttshttp://homeasssitant.local:8123/api/tts_proxy/87f5386b815d9a16b10115e2f80fb535454f1d72_de-at_242eaed1e8_cloud.mp3_input.mp3'
that looks like a malformed url, or am I wrong?
that is the result of the same request as above just with announce: "true" in the data section
@wide terrace That URL looks very malformed - after a quick search I think it looks like Alexa Media Player can't easily play MP3 files (I could be wrong here). I think @harsh yacht had a similar problem. Maybe he solved it?
If not I'd suggest to switch to text notifications (code not tested) in on_tts_start:
on_tts_start:
- homeassistant.service:
service: notify.alexa_media
data:
message: !lambda 'return x;'
target: media_player.echo_dot```
yes I got text notifications to work last night using a similar config to yours in on_tts_start. thanks!
I'd really prefer to get the mp3 to be played though ...
Yep, the notify-version works. It takes rather long to announce it after the command though. But thank you so much! π
Did not mean to post this in a thread π
I have a question.. I follow all thia thread and I try to use HomePod mini to play_media. I was the first to check whether disabling this service would work:
service: media_player.play_media
target:
entity_id: media_player.sypialnia_homepod
data:
media_content_id: >-
https://MY_PRIVATE_DOMAIN:8123/local/2.wav
media_content_type: music
announce: true
and everything works perfecetelly. So the second step was to update the Atom Echo. The last step was starting the pipeline.. and unfortunately it doesn't work. But while debugging the pipeline, I noticed that no wav files were returned but a raw file. Example from pipeline:
tts_output:
media_id: >-
media-source://tts/tts.piper_2?message=Wybacz,+niestety+nie+mog%C4%99+tego+zrozumie%C4%87&language=pl_PL&voice=pl_PL-mc_speech-medium&audio_output=mp3
url: >-
/api/tts_proxy/bb4c44570a13d4d6785b9dd975a41a337846fa48_pl-pl_0ef4cd4fbe_tts.piper_2.raw
mime_type: audio/mpeg
And that's the reason why this it not works Is there any way to fix this? How to allways return wav file, not raw file? It's probably related to pipper, but I don't know what to do about it..
I will follow this issue, thank you @ripe ether
@ripe ether I found a workaround for this problem in HomePod mini.. but it is still not effective, because two times we render the same text.
voice_assistant:
...
on_tts_start:
- light.turn_on:
id: led
blue: 0%
red: 0%
green: 100%
brightness: 100%
effect: pulse
- homeassistant.service:
service: tts.speak
data:
media_player_entity_id: media_player.pokoj_adama_homepod
message: !lambda 'return x;'
entity_id: tts.piper
...
Ok so this workaround is definitely working. How do I choose which voice it should use? By default it uses an American male voice. I'd like to choose the GB Alan low voice.
You set that in the pipeline
Apologies, I just found the configuration settings for the add on.
Oh, with piper.
Hmm but that didn't work when I called the service
Yeah
I've already set it in the pipeline btw
What didn't work? What service did you call? This thread is about routing voice responses to another media player
I used the above yaml file to route the voice response to the homepod. That part worked. However, the routed voice response wasn't using the accent/voice I chose in the voice assistant pipeline. I assume it's because I didn't add a parameter which specified it in the service call in the above yaml file. To test it, I'm in the developer settings calling tts.speak with piper as the entity and I can only hear the American voice. I have since gone into the piper add on and changed the settings there and restarted the add on but it has not changed. I will now delete the cache and try again. Please do let me know if I should switch to the main thread for this question.
Cache was the issue
Just got it to work
Shall I delete my previous responses?
Gotcha
Glad you figured it out
I think the deleting cache solution was yours from earlier in the main thread so thanks either way π
When I tried the above script, it started to read out the URL that should be played. π
In on_tts_start you get the text with x - in on_tts_end you get the URL. If you want the text for TTS you need to put the script in on_tts_start
ohh.. that was my mistake. my bad.
Hi Guys, is there a way to see spoken sentence in home assistance? I'm using cloud by Nabu, must be returned somewhere by Microsoft Cloud as variable / string as none of STT is done by esp in fact.
I created a text_sensor for that:
text_sensor:
- platform: template
name: Last Command
id: last_command
icon: mdi:microphone-message
voice_assistant:
[...]
on_stt_end:
- lambda: |-
id(last_command).publish_state(x);
In configuration.yaml ?
looks like esp code
yup, just modified my espcode, let me check
Yes, this is part of the ESPHome config - not Home Assistant. I don't think you get it directly inside HA (but you can check if there's an event for that)
I'm asking because I've checked dev tools and other obvious places and I wasnt able to see any output from STT engine
Thanks @remote salmon works like a charm!!
Can i also extract response as text sensor? It's visible in esp log console....
Yes, you can. Just create another text sensor and publish the state from on_tts_start - there the variable x contains the text response
That works, thanks again!!
sorry i wasnt able to get it to work last night. not able to test it right now cause im at work but thought id still post to make sure i set the config up correctly.
i need to add on_tts_end to the config right? or is it supposed to be under on_end?
voice_assistant: id: va microphone: echo_microphone speaker: echo_speaker noise_suppression_level: 2 auto_gain: 31dBFS volume_multiplier: 2.0 vad_threshold: 3 on_listening: - light.turn_on: id: led blue: 100% red: 0% green: 0% brightness: 100% effect: pulse on_tts_start: - light.turn_on: id: led blue: 0% red: 0% green: 100% brightness: 100% effect: pulse on_tts_end: - homeassistant.service: service: media_player.play_media data: entity_id: media_player.room media_content_id: !lambda 'return x;' media_content_type: music announce: "true" on_end: - delay: 100ms - wait_until: not: speaker.is_playing: - script.execute: reset_led on_error: - light.turn_on: id: led blue: 0% red: 100% green: 0% brightness: 100% effect: none - delay: 1s - script.execute: reset_led - script.wait: reset_led - lambda: |- if (code == "wake-provider-missing" || code == "wake-engine-missing") { id(use_wake_word).turn_off(); } on_client_connected: - if: condition: switch.is_on: use_wake_word then: - voice_assistant.start_continuous: on_client_disconnected: - if: condition: switch.is_on: use_wake_word then: - voice_assistant.stop:
This is mine, I hope it helps:
edited, pastebin below
Well, pastebin here
https://pastebin.com/U9V3nYU1
This is unrelated to streaming on other devices
Ty! Am I understanding correctly that this takes the text that would be sent to tts so that you can pipe it through tts to a speaker?
Oh, sorry
Your config looks right. on_tts_end, x has the audio response url
I just have a sonos speaker (media_player.room) that I want the tts output to go to instead of the atom echo speaker
Yes, that's how you do it. But feel free to flash and test, it's not like you can break anything. At worst, it won't behave as you expect it to
Okay thank you. I was confused because my config has on_end but no on_tts_end so I added it. Will test it again when I get home with this congih
I forgot to remove speaker: echo on this config oop
Ty for the help
okay i am home now and flashed it with that code. it detects the wakword and the full assist pipeline works but the audio does not play on the sonos speaker. the logs show this:
`
[D][voice_assistant:502]: Event Type: 5
[D][voice_assistant:633]: Unhandled event type: 5
[D][voice_assistant:395]: State changed from STOPPING_MICROPHONE to AWAITING_RESPONSE
[D][voice_assistant:502]: Event Type: 6
[D][voice_assistant:502]: Event Type: 7
[D][voice_assistant:554]: Response: "Turned on light"
[D][light:036]: 'M5Stack AGuru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400e0f87 PS : 0x00060a30 A0 : 0x800d3a30 A1 : 0x3ffbfcf0
A2 : 0x3ffc02a8 A3 : 0x3ffc0368 A4 : 0x3f4058fa A5 : 0x3ffdc444
A6 : 0x00000000 A7 : 0x00000017 A8 : 0x800e0f84 A9 : 0x3ffbfcd0
A10 : 0x00000000 A11 : 0x400e60f0 A12 : 0x0000022a A13 : 0x3f405ca6
A14 : 0x3ffbfd2c A15 : 0x00000000 SAR : 0x0000001a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace: 0x400e0f84:0x3ffbfcf0 0x400d3a2d:0x3ffbfd90 0x400d80f4:0x3ffbfdb0 0x400d3f89:0x3ffbfe50 0x400d86ea:0x3ffbfed0 0x40181531:0x3ffbffb0 0x401815b9:0x3ffbffd0 0x400e3e68:0x3ffbfff0 0x400e6a0e:0x3ffc0020 0x400d8d86:0x3ffc0040`
idk how to upload the full log file on here but i think thats the import part
anyone have a clue?
Paste the log using dpaste.org or something and also try the ESPHome Discord server https://discord.com/channels/429907082951524364/1163574334472863815
hey, though i haven't encountered the same error as you did, i was unable to play the audio output through my sonos (symfonisk) speaker if i called the media_player.play_media service on "on_tts_end" event. lambda indeed returns the desired url but my sonos speaker has an issue with raw mime-type. so it won't play anything. however, it did work relatively well here:
on_tts_start:
- homeassistant.service:
service: tts.speak
data:
media_player_entity_id: media_player.sonos
message: !lambda 'return x;'
entity_id: tts.piper
it returns text (not url) here. but... it can't play longer responses π¦
That probably means that Piper is hitting a timeout because it takes too long to compose an audio response. Probably your hardware is too weak
Regarding raw, that will be fixed soon enough and the TTS output will be converted to the format required by the satellite
thank you for your insight both here and in your previous messages. i have longed to use a different audio output than the atom echo. you guys helped me a lot in what seemed impossible π the echo plays most of the longer replies but sonos won't. but as you say, it will be wonderful once raw is fixed
Just wanted to say thank you so much for pointing me to this! So great that I can use my existing Google Nests for the response, so thank you π
The thing is, I have to figure it out if my google mini is playing something and disrupted by tts to return to previous state. I bet there is a script / blueprint for that
I believe there is no announce I can hook to tts.cloud_say as I'm sending delta to speaker:
service: tts.cloud_say
data:
cache: true
message: ""{{states('sensor.m5stack_atom_echo_last_response') }}""
entity_id: media_player.nestmini6103
enabled: true
I'm not sure what you're doing there, but i don't think it's what this thread recommended π
you are right, I'm not redirecting audio, just sending lambda as TTS to speaker, anyway, thanks for input.
Saving for later
Is there any trick to removing it (or effectively disabling it) if you're using the github va yaml as a package? I'd prefer that if possible. (I have it effectively replying through alexa_media_player notify.* by adding to on_tts_start, but it's still also talking through the echo.)
On mine, where I send the response to Google Nests, I've just removed the speaker section under voice assistant in the config. Had to clean the build files before installing, but they work no problem
Did you replicate the entire voice_assistant section in your yaml? I'm trying to avoid that; I'm using the package from https://github.com/esphome/firmware/blob/1cc35128b9d3d2e7edf2dd62331a058cc27e754d/voice-assistant/m5stack-atom-echo.yaml and am trying to keep my local yaml minimal. (Sorry if I misunderstood your answer.) It looks to me right now if I want to remove that one line from voice_assistant I have to replicate the entire package yaml locally.
Separately, though, do you mind sharing your Nest response portion? That could be a great output option for me too. π
I think I misread your question, as I'm not using the github yaml as a package. But if it's helpful, I've uploaded an example of one of my satellites here (uses a Google Nest for the response, and has the speaker part removed). https://github.com/celodnb/ha_assist/blob/main/living_room_mic
this should work on the S3-BOX3 yeah?
anyone sucessfully done it?
i cant get remove the speaker section, i'll get an error.
and i get an empty URL from the x
i see this in logs,
`[D][esp-idf:000]: W (42186) AUDIO_PIPELINE: There are no listener registered
[D][esp-idf:000]: I (42188) AUDIO_PIPELINE: audio_pipeline_unlinked
[D][esp-idf:000]: W (42189) AUDIO_ELEMENT: [i2s] Element has not create when AUDIO_ELEMENT_TERMINATE`
post the full config please
Please use a code share site to share code or logs, for example:
- https://dpaste.org/ (select YAML for the language, and consider picking a longer expiry)
- http://pastie.org/ (select YAML for the language)
- https://paste.debian.net/ (you guessed it, select YAML as the language)
Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.
The speaker is still there in this config. Paste what you tried and doesn't work
when i removed speaker it didnt pass the validation
Have you remived both the component and the reference from the voice_assistant have you added a media_player component instead and asded it to the voice_assistant component? Can you post the full config after you delete the speaker?
Oohh.... how should i setup media player? What plattform?
can i use MPD?
sorry i am kind of new to esp
I2s media player
Check out this example https://gist.github.com/tetele/75815c53cfd2a02412ef153f9c2d24e2
you dont have an box3 config to share mate?
i found the pins but
my code is in esp-adf and i2s_audio is not supported it said in the logs
I was offering the best deal on the whole wide internet: post your config and we can fix it based on your needs, but you want a turnkey config. Well, tough luck, i don't have it and the offer is up. Since you're keen on learning stuff, i2s is supported by esp_idf and esp-adf. media_player isn't.
thanks for the encouragement buddy i got it now