[pulseaudio] Random assignment of RAOP/AirPlay sinks to corresponding OpenHAB pulseaudio things

Dear community,

My audio setup includes a Trivum MusicCenter that provides a plurality of AirPlay receivers, each AirPlay receiver assigned to a speaker located in a particular room.

When integrating the AirPlay receivers into OpenHAB 3.2.0 via the pulseaudio binding, I noticed that the assignment of the respective AirPlay sink is based on the PulseAudio Name. Pulseaudio in turn appears to receive this name from the audio sink. In the case of the Trivum MusicCenter, this name is identical for all provided AirPlay sinks. It is the device description that shows the individual user-defined names of the AirPlay receivers as showing up on iOS devices. PulseAudio seems to append an enumerater 2, 3, 4 etc. after the name to make the name unique. Here is a shortened output of “pactl -s localhost list sinks”:

Ziel #4
	Status: IDLE
	Name: raop_output.arm-7.local
	Beschreibung: Kinderzimmer
Ziel #5
	Status: IDLE
	Name: raop_output.arm-7.local.2
	Beschreibung: Bad
Ziel #6
	Status: IDLE
	Name: raop_output.arm-7.local.3
	Beschreibung: Wohnzimmer
Ziel #7
	Status: IDLE
	Name: raop_output.arm-7.local.4
	Beschreibung: Schlafzimmer

Unfortunately, the sequence of detecting the above-listed AirPlay sinks changes from discovery to discovery. Therefore, the name of a particular audio sink changes over time. The audio sink named “raop_output.arm-7.local.4” may be “raop_output.arm-7.local.2” tomorrow. So the respective OpenHAB pulseaudio thing cannot reliable assigned to a particular speaker.

Did anybody else run into this issue and has a workaround to overcome this problem? In the meantime, I created an issue:

[pulseaudio] Bug/Feature Request: Avoid random assignment of pulseaudio sinks to openhab things #12555

Best regards,