HomePod Mini as TTS devices

Thanks @Mourkain - I see the homepods as they show up as media devices

Though I am able to call the notification service with alexa like this…

service: notify.alexa_media_XXXX
data:
  message: some message here
  data:
    type: tts

I don’t see any equivalent notify.apple_media_YYYY - so I’m a little confused!

Perhaps I’m asking the wrong question, as I’m not very familiar with HA yet.

You should use one of the tts-services, e.g. tts.google_translate_say depending on what TTS service you use.

3 Likes

Thanks @postlund !

service: tts.google_translate_say
data:
  entity_id: media_player.XXXX
  message: hello world

Is what I was looking for!

5 Likes

Hey! I’m brand new to Home Assistant. How would I get this working? I want to try to create an automation that does the followinging

  • When the Vibration Sensor mounted to the Washing Machine stops → Send a TTS alert to all HomePods in the house that says “The waching machine is done”. How would I go about this?

does that work fine with you? , because show me the error in the screenshot and that just when the entity is the homepod for other media player working fine

image

So it works pretty good on my OG HomePods, but when I send a TTS to my HomePod Mini.
It works for maybe the first Second and then Silence.

I got this in my Logs:
TimeoutError: no response to TEARDOWN rtsp:/ip…

Does anybody had this before?

It worked last time I tried it.

I’ve not played with my HA install recently because I’ve had covid and am still behind on other things!

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…

2 Likes

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
1 Like

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.

1 Like

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).

3 Likes