Same error for me
Do you use Macs at home? If so I have a TTS system that works natively through AIrfoil (Mac software) that lets me address groups of speakers or individual speakers and set the voice to whatever I want on the fly in HA, set speaker volume on the fly and more. I’ve written about it numerous times on the forum but happy to detail it out for you - if you use a Mac somewhere.
Interested in hearing more about this. Does AIrfoil work w/ HA or is it completely separate? Also, it sounds like AIrfoil would be have to be installed and running on the Mac, so not a good solution for MBP-only environments where this critical piece of the infrastructure might be mobile. Very curious about your use case and if mine might be similar enough that your solution would work here.
Airfoil is a Mac app, so it must be run on a Mac. If you are using a MBP the, yes, it’s going to stop working when you take your laptop with you. If you use something like VMWare and have an extra computer laying around, you can always install MacOS on the VM and install Airfoil on that instead.
Works fine, but I wish someone could hack into Homekit’s Intercom so we can broadcast messages without stopping currently playing media. The status quo is unacceptable for me.
Maybe I’ll change my Node-Red flow to not notify when media is playing…
Can you share your config? I have several homepods and it’s working with none of them. I also get Failed to call service tts.google_say. Unknown error
when calling the TTS service. TTS to a Fire Tablet works, so TTS itself works just not to HomePods.
Sorry, totally missed your reply:
First you need to setup the TTS (you should have already have, i think) on your configuration.yaml
tts:
- platform: google_translate
then it’s just a simple service call for me:
service: tts.google_translate_say
data:
entity_id: media_player.homepod_kitchen
message: "The entrance door was opened."
cache: true
That is a use case I implemented in my smart home as a “last call” for my trash collection:
alias: Mülltonnen Last Call
description: ""
trigger:
- platform: time
at: "07:40:00"
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.nachste_leerung_numerisch
below: "1"
- condition: state
entity_id: binary_sensor.werktag
state: "on"
action:
- service: tts.cloud_say
data:
entity_id: media_player.kuche
message: >-
Heute wird {{ states('sensor.welche_tonnen_werden_geleert') }} geleert.
Ist das rausgestellt?
mode: single
In your case you’d have to modify the condition to check the vibration sensor and then call the tts.cloud_say service. You’d have to define the tts.cloud_say service in advance. media_player.kuche is my Homepod Mini in our kitchen.
I’ve tried this, but it’s just throwing me error. Just says unknown error.
service: tts.google_translate_say
data:
entity_id: media_player.kjokken
message: "Test! Hvordan fungerer dette?"
cache: true
What is in the error log?
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 216, in async_say_handle
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
await result
File "/config/custom_components/apple_tv/media_player.py", line 292, in async_play_media
File "/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py", line 382, in stream_file
await self.relay("stream_file")(file, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/raop/__init__.py", line 371, in stream_file
audio_file = await open_source(
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 484, in open_source
return await FileSource.open(source, sample_rate, channels, sample_size)
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 428, in open
src = await loop.run_in_executor(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/miniaudio.py", line 943, in decode_file
filenamebytes = _get_filename_bytes(filename)
File "/usr/local/lib/python3.10/site-packages/miniaudio.py", line 815, in _get_filename_bytes
raise FileNotFoundError(filename)
FileNotFoundError: media-source://tts/cloud?message=Test!+Hvordan+fungerer+dette?&cache=true
Sounds like a bug to me, the media-source URL should be resolved into a http address before being passed to pyatv. Not sure why that is though.
For anyone who stumbles across this thread (like I did):
tts works with HA and the homepod mini (purchased in June 2023). However, I’m noticing an 8-10 second delay before the message is heard (using the appletv integration). In contrast, tts to a wireless sonos speaker (like sonos move), it is nearly instantaneous with the sonos integration.
Has anyone noticed quite a delay between sending a tts say message to the homepod mini? (either with nabu casa or google translate, they seem to be similar in response time)
Anyone know how to shrink that delay? I need a warning when my garage door is told to close remotely, and the homepod mini’s delay is making it challenging (the door is closed by the damn time the tts message is heard).
I experience the same thing for sure. The delay varies. Sometimes it’s a second or two and others it’s like 10. Would be glad to know if anyone has an idea as to why this occurs and/or how to alleviate it!
I’m seeing a similar delay on my Homepods (OG) for TTS messages. I’d also be interested in any ways to reduce this!
Also, has anyone been able to resume previously playing media when using Piper TTS with homepods? I previously used a script to grab the current volume and content_id for apple music before playing the TTS message (similar to the scripts described here), but that doesn’t seem to be working anymore. Now playing a TTS message causes the current app to change and the previous music doesn’t resume.
Could somebody please advise which ports (TCP and UDT) need to be open between HASS and HomePod Mini for them to communicate?
I have the HASS and the HomePod on the separate VLANs. If I turn off all the firewall rules between the VLANs, HASS talks to HomePod no problem and I can do TTS. With only the following ports open the communication stops and HASS integration cannot reach the HomePod. I also have AppleTV and iPhones on the same VLAN as the HomePod. HASS has no problem reaching those with only the aforementioned ports rules open.
Airplay ports:
TCP: 7000
UDP: 6002, 49152-65535
I am trying to figure this out as well. Disable all firewall and it works. I have tried many of the ports listed in this article from Apple (but not all) and still can’t get it to work. Maybe I will try all and cut back one by one. TCP and UDP ports used by Apple software products - Apple Support
Any luck?
I thought I was on to something. I would get it to work if I disabled my firewalls. I then went back and added specific ports and port ranges and would get it to work for a couple tries. Or so I thought. It turns out that it is something in Home Assistant communication to HomePods that stoped working. If I disabled the firewall and tried a few times it still stopped working. I am not sure exactly what is causing it. It always works fine to my browser window, but rarely ever works to my HomePods.
I am wondering if it has something to do with running in a Docker container. The container has lots of memory, cpu, and disk available.
I hope to upgrade to a Home Assistant Green soon and I will try from that.
I’m on RPI 3b+. Works with firewalls off, drops after some time when I turn firewalls on.
Planning to transfer to VM. Then it should be easier to trace the comm problems with Wireshark.