New custom components: macOS tts, and macOS local media_player


I’m running Home Assistant on a Mac mini and wanted to use its built-in text-to-speech. The tts is especially nice because it’s local (and therefore fast and private), and because the quality is pretty good.

So I’ve implemented two custom components, one for the tts and one to play the resulting media locally.

These still need to be cleaned up to pass the tox tests before they can be considered for inclusion into the distribution. Meanwhile, let me know whether they work for you.


Hey - this is fantastic thank you for creating it.

How might I use this to target other media players with the tts command? Do I have to specify the local MacOS one or can it also be used to point to say a cast device using the normal method?

If you’re asking whether you can replace the Mac media player with another - sure.
If you’re asking whether you can change the program that the Mac media player calls, that would be possible as well. The media_player/ code code has a hardcoded check for the existence of “/usr/bin/afplay”, and it calls that file. However, I don’t see any reason why you wouldn’t be able to call any other executable or script if you change those lines (there may be some issues to get arbitrary programs to run headless).

Sorry my question wasn’t clear in that I was referring to the “say” component.

Answered my own question through tinkering, in summary yes you can use the say component to target other media players, my guess is as long as they support m4a it’ll work.

In my case I’m using MPD running on some RPI’s, and MacOS itself to play my tts announcements now, which is much better than my previous setup.

Great, glad you got it to work. I agree, the Mac’s built-in TTS is pretty good.

I went through the process of installing this and it seems to have not been kept up to date with newer versions of home assistant. The media player entity is still available but the tts service is gone.

I’m running .112.5 on a mac mini running is 10.13.6 with no plans to upgrade to Catalina.

Any options to use the macos tts?