Hello there,
I was testing this thing for a whole day and got new data. Let me share it with you.
- VLC. It does write data to a pipe already via telnet, they even list it in the players options in their official manual:
VLC
Use --aout afile and --audiofile-file to pipe VLC's audio output to the snapfifo:
vlc --no-video --aout afile --audiofile-file /tmp/snapfifo
But there is something beautifull about the VLC in the HomeAssistant which I would like to share in the end as a bonus to all of you, who spent their time helping me out with this situation - maybe you would find it usefull in your projects.
- Snapcast situation.
I decided to try MPD instead of Mopidy to make the experiment pure to understand if it is Mopidy or Snapcast, or both of them. Besides, MPD seemes to be a bit easier to understand in operation. So, I installed the mpd on NUC with Snapserver. I did amend the config as per the directions from:
āhttps://github.com/badaix/snapcast/blob/1f98c790734f7b5de01497fa5243149dddd6dc0b/doc/player_setup.md#mpdā - I created a pipe named it ātestā pipe in the snapserver.conf file and directed the sound data there in the mpd.conf to write to that pipe.
Then I installed MPD client on my phone. Then I added to a playlist radiotation just like that:
sudo su
echo "http://wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3" > /var/lib/mpd/playlists/einslive.m3u
And it did appear in the playlist in the client on my phone, and it said to start playing but no sound was produced againā¦ Then I started to collect logs. So, the logs needed:
- From MPD server on NUC (192.168.1.246)
- From Snapcast server on NUC (192.168.1.246)
- From Snapcast Client on RPi4 (192.168.1.247)
When I collected those I found some minor āexeptionsā which seemed insignificat to me, but I decided to tackle those, and discovered, that no metter what I did I could not get read of that one:
bind to '0.0.0.0:6601' failed (continuing anyway, because binding to '[::]:6601' succeeded): Failed to bind socket: Address already in use
So, best solution to me seemed to reinstall whole thing from scratch - for that purpose I came across this:
sudo apt-get install --reinstall mpd
As the text on the screen stopped emerging all my 3 sound scources with snapclients installed (phone, laptop and RPi4 with speakers) started to play radio I added into the list, that is it - Black Magic! I guess, we will never know the true source of the phenomena observed, unless someone with experience tells us one day leaving a comment below, but for those of you who run into something similar - when you seem to do as per the manual but nothing works - consider reinstalling that thing from scratch, maybe some module you are using is outdated, or whatever elseā¦ it might help.
The moment it started to play radio, it started to playTTS as well - so once you are done with phase 1, phase 2 is completed automatically. Was it a Mopidy or some outdated lib - as I said we may never know, but it has lead me to some interesting use of VLC player as a result of these 3 days of investigationā¦
- Bonus - VLC.
VLC is nothing special by itself, but in Home Assistant it stands alone from the other platforms for the fact, that it is speaker defined - meaning that one can define as many mediaplayers of that platform as you have spekers connected to your Pi - and yes, I do mean blue toothā¦ You can have dozens of these, I suppose. At the moment of me writing that, I have tested it with 2 sets of speakers: BT + wired, connected to my Pi4, but same applies to any number. So, having dozen of mediaplayers in one HA instance associated with one and the same Pi is not a great use - unless you have this:
āhttps://github.com/custom-components/remote_homeassistantā
What it allows you to do - is to have an unlimited number of independent instances of HA joined into a single cluster - you can import any entity into your main HA instance, including mediaplayers. And this turns your dozens of local VLC players for individual speakers into dozens of network VLC players for individual speakers. How to use it - you can dinamicaly determine which output to use while your programm execution, which is impossible when using MPD or Mopidy - the output scource is defined before the start and cannot be chanded before the end. You can have several BT speakers in your room, play all of them - all players envolved, some of themā¦ - and these speakers are connected to a single Piā¦
And another bonus - you can build as many Zigbee networks as you have Piās now - I already have 3 ZHA integrations in One Home Assistant while they say you cannot have more than one - easy, one is in the main instance, and other two are in my test Pi4 and in HA, running on bare metall NUC. This is very usefull when you have 3 floores or have devices which do not want to live in one network. Since in every room I will have RPi for the multi-room - yes, right, every room will have itās own zigbee network as well, and they all will be joined in my main HA instance where my general code is runningā¦ Hope you will find use of this as well.
Thanks for your help!