Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Bluetooth auto-connection
#1
Hi guys!

My name is Marco, this is my first Post; I've tried to search a solution for my needs (maybe i've not been looking good), so I explain you my "problem":

I own a Rpi Zero W with latest Moode version, powered by original Rpi power supplier (The black one that comes with Rpi 3).

I listen to webradios and my music collection (which is stored on a WD MyCloud 3tb Nas), using wireless connection, "pushing" everything via bluetooth to my JBL GO bluetooth speaker.
Great feature, it works great and it allowed me to eliminate cables and cords, and also to move the speaker along my apartment (when I go to the bathroom, etc..).

The only "annoying" thing (ok, it's a small thing) is that every time I turn on my Rpi, I've got to connect it to the bluetooth speaker before starting playing music.

Would it be possibile to make the Rpi, when I turn it on, automatically connect to the (previously paired) bluetooth speaker?

Thank you so much!
Reply
#2
Hi Marco,

This can be added to moOde 4.2 :-)

Btw, are u running moOde 4.1 ?? Reason I ask is that after looking at the code I think the UI will disable when Audio output is set to Bluetooth. This is a logic bug.

Would you be able to test a fix?

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(04-10-2018, 01:27 PM)Tim Curtis Wrote: Hi Marco,

This can be added to moOde 4.2 :-)

Btw, are u running moOde 4.1 ?? Reason I ask is that after looking at the code I think the UI will disable when Audio output is set to Bluetooth. This is a logic bug.

Would you be able to test a fix?

-Tim

Hi Tim,

and thank you so much for your kind reply Smile 
I'm running moOde 4.1 and It's correct: the UI behaves like that when audio output is set to Bluetooth.

I'm quite a newbie to linux (and i'm learning quickly!) but... I wait for your instructions, even in order to understand if i'm able to test a fix!
Reply
#4
Hi,

1. Open an SSH session
2. Edit worker.php file
sudo nano /var/www/command/worker.php

3. Page down to the code block below and add the code that is bolded

//
// BEGIN WORKER JOB LOOP
//

while (1) {
sleep(3);

session_start();

if ($_SESSION['maint_interval'] != 0) {
chkMaintenance($maint_interval);
}
if ($_SESSION['cardnum'] == '1') { // TEST experimental usb audio hot-plug mgt
sysCmd('alsactl store');
}
if ($_SESSION['btsvc'] == '1' && $_SESSION['audioout'] == 'Local') {
chkBtActive();
}
if ($_SESSION['airplaysvc'] == '1') {
chkAplActive();
}
if ($_SESSION['extmeta'] == '1') {
updExtMetaFile();
}
  if ($_SESSION['ckrad'] == 'Clock Radio') {
chkClockRadio();
}
  if ($_SESSION['ckrad'] == 'Sleep Timer') {
chkSleepTimer();
}
if ($_SESSION['playhist'] == 'Yes') {
updPlayHistory();
}
if ($_SESSION['w_active'] == 1 && $_SESSION['w_lock'] == 0) {
runQueuedJob();
}

session_write_close();
}

4. Ctrl-o <return> Ctrl-x to save the file.
5. Reboot

BTW, if the UI is disabled how are u able to play any music to your Bluetooth Speaker ?

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
Ok, now that everybody at home are sleeping (son & wife, it's 10.40 pm here in in Italy) it's time to have fun (or to get angry) with my Rpi.

Well... the UI it's not disabled, there is, but there's a sort of blank page; there is anyway the lower bar "Browse-Library-Playback", so I tap op Library, then on Playback again and everything works almost fine.

Thank you Tim, let's start to follow your precious instructions... I'll tell you!
Reply
#6
So... I made a backup copy of the Sd image, then modified worker.php file.
UI Works now fine, thank you!
...but still missing the bluetooth "auto-connection" :-) ihihih
Reply
#7
Great, thanks for testing :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#8
Hello,

I re-open this thread because I have the same issue  Sad
I have installed moode 6.4.2 on my raspberry pi 3. Everything works fine except auto-connection between my bluetooth speaker (paired) and my HiFi system.
I was listening a web radio on my Hifi system and I want to listen now on my bt-speaker.
When I switch on it, moode web display a dark page with only "bluetooth active" which goes to blu-config.php and no sound.
I must manually turn on "mpd Audio output --> bluetooth" and playback my web radio
When I switch off my bt-speaker, same issue: sound output is on "bluetooth"
Is there an option that I have to check?

In audio config/renderers/Bluetooth:
bluetooth is ON
pairing agent is ON
Speaker sharing is OFF
Resume MPD is YES

I have tried the Tim's solution but the code is commented

Thanks for your help
Ludo
Reply
#9
How would moOde know whether it's a BT speaker connecting or some other device like a phone, laptop or desktop?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#10
moOde, no but me, yes Smile
I have paired a sound device.
You say that's not possible to have auto connection between 2 devices: local and bluetooth, that's it?
I thought there was a commutation because in Blu-config, there is this message:
"Connect, Remove and Disconnect will also automatically change to the selected MPD audio output"

Too bad if it's not possible
Reply


Forum Jump: