Sure. I am building a new local hass.io addon best on BestLibre’s Mopidy addon which adds Icecast during the installation along with a few extra Mopidy extensions like MQTT control.
When you start playing music on Mopidy, the output is sent to Icecast which outputs the audio to a local stream on your hass.io installation.
E.g. http://hassio.local:8000/mopidy
This local stream can be sent to Sonos using the media_player
integration of your Sonos by adding it to the media_content_id
parameter of the media_player.play_media
service.
E.g.
entity_id: media_player.your_sonos
media_content_id: x-rincon-mp3radio://hassio.local:8000/mopidy
media_content_type: music
This is still a work in progress and I have to test it more thoroughly to see if the music keeps playing without to much pauses.