Custom Component: Sonos_TTS - notifications with sonos speakers

Hi there,
I was searching for a way of using sonos player with the notification component. I only found ideas for scripts, but no native notifier for using e.g. in alerts.
So I wrote my first custom component that was even my first piece of python code.

https://github.com/ulfalfa/sonos-tts.git

Open for comments, feedback and optimizations - there are still some limitations but maybe we can fix it together…

1 Like

Very interesting.
From the known limitations, I didn’t get whether a playing music (e.g.from Spotify on Sonos) would be resumed after the voice notification?

Yes, the interrupted music should resume (that was always working in my tests) - it

  • does a snapshot
  • pauses the current play
  • joins the speaker (if the notification entity is a group)
  • sets the volume
  • plays the tts
  • waits for finishing (state=paused)
  • and restores the snapshotted state of the players (=resuming the playlist)
1 Like

Cool, I will try it.
It will also be nice to choose which TTS to use, e.g. one already set up in config.

Also, many would appreciate if it would be possible to install the component via HACS.

I added the possibility to specify the tts service to use when setting up notifiers. Maybe this should be also overridable when executing the notification (as additional data field) ?!
After testing it a little bit and had some feedback I’ll give it a try with HACS.