Pulseaudio network sink is using wrong device

  • Setup:

    Raspberry pi 4

    HifiBerry Digi+

    so on the start, libreelec is detecting two outputs. One is HDMI and second is hifiberry.

    In autostart.sh I'm doing:

    1. pactl load-module module-udev-detect tsched=0

    2. pactl set-default-sink alsa_output.1 # the hifiberry

    3. pactl load-module module-rtp-recv sink=alsa_output.1 # hifiberry

    now the problem is that network sink is created just after loading module-udev-detect and sadly it's set default to builtin hdmi. What's worse it has DONT_MOVE flag

    hence I can't move it with pacmd/pavucontrol to alsa_output.1 sink. And when I try to play something through network stream it's using hdmi output instead of spdif.

    Any idea how to fix this/change the sink for the network stream?