Bluetooth speaker and fallback to 'internal' speaker


#1

Hallo,

I managed to set up Mopidy to use an external bluetooth speaker (Sony SRS-X77).
But now I want to add a fallback option, that if the bluetooth speaker is not connected Mopidy routes audio to the Phat Beat DAC (say internal speaker) of my pi.
Any hints how to do this?

Bluetooth config set up with bluealsa (https://github.com/Arkq/bluez-alsa):
mopidy.conf:
[audio]
output = alsasink device=btspeaker
mixer_volume = 30

/etc/asound.conf:
pcm.btspeaker {
type plug
slave.pcm {
type bluealsa
device “5C:93:A2:8B:EE:81”
profile “a2dp”
}
hint {
show on
description “SRS-X77”
}
}

Before using the bluetooth speaker I was using a Phat Beat DAC with the following config (https://github.com/pimoroni/phat-beat):
mopidy.conf:
[audio]
mixer = software
mixer_volume = 35
output = autoaudiosink
[softwaremixer]
enabled = true
[alsamixer]
enabled = true
card = 0
control = PCM

The task sounds easy: If not connected to bluetooth speaker -> use Phat Beat DAC.
I would really appreciate if someone knows how to do this.

The ‘project’ behind this question is to realize a Phoniebox with bluetooth output and internal speaker fallback.

Thanks
Daniel