Daenou / ansible-multiroom-audio

9 stars 0 forks source link

Properly disable bluetooth when not needed/configured #42

Closed nis65 closed 2 years ago

nis65 commented 2 years ago

I recently moved. So my multiroom setup changed heavily, i renamed multiple devices (including ones with a snapserver on it). At the old flat, all devices had a configured bluealsa-workaround-cable just because it was so easy to configure with these playbooks (and so cumbersome before without).

Now, I will probably only need bluetooth on 3 of the 6 devices. I manually deconfigured some of them, but I noticed later that they still show up on my mobile.

As discussed today, I will make a proposal how to properly disable bluetooth if desired:

nis65 commented 2 years ago

Did some tests today: Streaming some audio over bluetooth to a node and then entered on the Raspi:

rfkill block bluetooth

Immediately, the bluetooth connection is stopped (also visible on the client). rfkill list shows Bluetooth as

1: hci0: Bluetooth
        Soft blocked: yes
        Hard blocked: no

This is expected, "Hard blocked" would mean that some hardware switch has disabled bluetooth (which is not available on the Raspi afaik).

Unblocking bluetooth later with

rfkill unblock bluetooth

makes the bluetooth connection available again immediately and I can reconnect (as before) and stream again.

nis65 commented 2 years ago

So I think the nicest implementation would be as follows:

While this does not uninstall anything that was installed before when then node was "with bluetooth", it still disables bluetooth properly. For pristine systems, it is a perfect implementation, for modified ones it is good enough.

nis65 commented 2 years ago

fix merged in #47