OK, check out the testing branch. It supports multiroom in both modes (wifi direct and router), it should autodetect if your firmware version is older than 4, it automatically falls back to wifi direct mode. Can be overridden with the option multiroom_wifidirect: True if one wants to use wifi direct with newer firmwares too (perhaps having a mix of devices with new and old fw). For firmware versions bigger than 4, multiroom is done in router mode by default.
Check out carefully the new linkplay.join and linkplay.unjoin services as they differ from the original ones. Had to re-arrange them to comply with the HA in-house standard coming from sonos integration, and make linkplay compatible with custom:mini-media-player. Check out the description there how to set it up for speaker grouping features, the platform name is linkplay. Old multiroom services removed, as this part of the integration had to be rewritten almost completely.
New service added linkplay.command, check out the description in the Dev tools in HA. Supported commands are Reboot, PromptEnable, PromptDisable, SetRandomWifiKey, WriteDeviceNameToUnit, TimeSync, RouterMultiroomEnable.
Most of them are self-explanatory;
SetRandomWifiKey is there as an extra security feature, one could make an automation in HA to change the keys on the linkplay APs to some random values periodically.
WriteDeviceNameToUnit would write the name configured in HA to the player’s firmware so that the names would match exactly in order to have multiroom in wifi direct mode fully operational (not needed for router mode).
RouterMultiroomEnable theoretically router mode is enabled by default in new firmwares, but there’s also a logic included to build it up, this command ensures to set the good priority.
TimeSync is for units on networks not connected to internet to compensate for an unreachable NTP server. Correct time is needed for the alarm clock functionality (not implemented yet here)
New services added linkplay.snapshot and linkplay.restore in order to make usage with TTS easier. Currently only the source input is being snapshotted and restored (which of course can be a webradio stream).
And look for any suspicious while you start joining in home-assistant.log. Check if versions are detected correctly. If not, add multiroom_wifidirect: True to your config to all your players.
Now it starts to become more difficult, as on my units with firmware 4.2.8020 and 4.2.8230 things work fine in both wifidirect and router multiroom mode…
Log Details (WARNING)
Logger: homeassistant.helpers.service
Source: helpers/service.py:258
First occurred: 12:43:39 AM (1 occurrences)
Last logged: 12:43:39 AM
Unable to find services.yaml for the linkplay integration
Log Details (WARNING)
Logger: custom_components.linkplay.media_player
Source: custom_components/linkplay/media_player.py:551
Integration: LinkPlay (documentation, issues)
First occurred: 12:52:26 AM (1 occurrences)
Last logged: 12:52:26 AM
presed pause for: media_player.baie
Bucatarie = master
Baie = slave
When playing everything is ok.
Whem Bucatarie is stopped, below is the logbook for Baie. Is this normal?
12:31:30 AM
Baie changed to playing
12:31:30 AM
Baie changed to idle
12:31:19 AM
Baie changed to playing
12:31:19 AM
Baie changed to idle
12:31:08 AM
Baie changed to playing
12:31:08 AM
Baie changed to idle
12:30:57 AM
Baie changed to playing
12:30:57 AM
Baie changed to idle
12:30:46 AM
Baie changed to playing
12:30:46 AM
Baie changed to idle
12:30:36 AM
Baie changed to playing
12:30:36 AM
Baie changed to idle
12:30:24 AM
Baie changed to playing
12:30:24 AM
Baie changed to idle
12:30:13 AM
Baie changed to playing
12:30:13 AM
Baie changed to idle
12:30:02 AM
Baie changed to playing
12:30:02 AM
Baie changed to idle
12:29:51 AM
Baie changed to playing
12:29:51 AM
Baie changed to idle
12:29:40 AM
Baie changed to playing
12:29:40 AM
Baie changed to idle
12:29:29 AM
Baie changed to playing
12:29:29 AM
Baie changed to idle
12:29:26 AM
Baie changed to playing
12:29:26 AM
============>>>>>Bucatarie changed to idle
As stated in the readme, snapshot currently only stores input source.
Volume is problematic, because Linkplay module stores volume levels separately for different input types, so if you change volume before playing TTS, you’re actually changing the volume of the current source not the volume of the source where TTS will play. That’s why snapshotting with the volume needs a different approach.
I have TTS sound on speakers. I don’t know about tts files, all I have is activated google TTS, restarted HA and TTS text input appeared automatically in lovelace properties of the media player. And it plays.
It has issues that while Linkplay module finishes changing input source to TTS stream, half of the message is gone, but this is problematic with other platforms aswell, so I will think of a different approach here too. Perhaps combined with the volume speciality as above.
OK check out the master branch again. Major change is that you have to remove from config the unavailable_message: option as I switched to using Home Assistant’s built-in availability state flag, which makes availability display equal to the other components. You’ll have to first remove entire config and replace the component, restart HA, add back the corrected config and restart again.
Make sure you update all the files!
Snaphot & restore includes volume, source input and player state attribute. Snapshot actually prepares the unit for TTS so stops playback in advance - this also to handle the gap biting the first words of TTS (present at many other similar speaker integrations). Check the readme and the service descriptions.
(currently only tested with web streams and physical inputs).
Removed player name change when playing web streams, started to get confusing and it’s not needed with mini-media-player card since implementing streams as sources.
Something not good…
No speaker on lovelace after restart.
Log Details (ERROR)
Logger: homeassistant.components.media_player
Source: custom_components/linkplay/media_player.py:164
Integration: Media player (documentation, issues)
First occurred: 11:26:05 PM (2 occurrences)
Last logged: 11:26:05 PM
Error while setting up linkplay platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/linkplay/media_player.py", line 164, in setup_platform
mac_address = resp_json['STA_MAC']
KeyError: 'STA_MAC'
OK hold on. Again issue caused by old firmware. No problem.
This was an experiment to assign unique IDs based on devices mac address within HA. Not really needed actually, so removing this approach for now. Looks like your device doesn’t report a mac address at the key I was expecting, disregard. Not important.