@djboob66 Spotify itself worked flawless - regardless where I started it. It simply used any other audio (my monitor since it unfortunately has some crappy speakers inside) and did not wanted to use my BT-Audio at all.
Read the statement by Michael Teeuw here.
Posts
-
RE: GoogleAssistant, Raspotify and bluetooth audio...
-
RE: GoogleAssistant, Raspotify and bluetooth audio...
@bugsounet said in GoogleAssistant, Raspotify and bluetooth audio...:
With bluetooth, raspotify need many root permission, so it’s very complex…
I advice you to try with librespot, works with no problem with bluetooth [without config] (don’t forget to uninstall raspotify)after if you override
asound.conf
… I don’t guarantee the result
in my case, works with default configThanks! I’ll give it a try and let you know how it worked in a few days…
-
GoogleAssistant, Raspotify and bluetooth audio...
Hello again,
I finally had some time to work on my beloved mirror again - however, I feel like I’ve messed it up and wanted to reach out to you guys for advice since my google and forum search efforts are not fruitful any longer…Sorry if this becomes a long post again…
So - what I’m trying to achieve is having google assistant integrated with Raspotify and play music via my connected bluetooth speaker. Thanks to @bugsounet this is working nearly perfect.
I installed everything like raspotify, the google assistant etc. and it worked like a charm - youtube was playing using my speaker, raspotify was playing using anything but my speaker…
So I googled and figured out that raspotify seems to have issues with bluetooth connected devices…
And thats where the mess started - I stumbled over this: https://github.com/bablokb/pi-btaudio which sounded like it could do the job - I installed it and it completely f****ed up all my audio stuff. I figured it doesn’t like pulseaudio - fine, I uninstalled it. Still does not work. So I continued my google search - seems I thought that the problem is maybe that it does indeed set the default audio play device but completely ignores input devices…
I found the micConfig stuff here:
http://wiki.bugsounet.fr/en/MMM-GoogleAssistant/Tools
but thats not working any longer, guess it is not required any longer…Further googling led me to change the /etc/asound.conf file to:
pcm.!default "bluealsa" ctl.!default "bluealsa" defaults.bluealsa.interface "hci0" defaults.bluealsa.device "XX:XX:XX:XX:XX:XX" defaults.bluealsa.profile "a2dp" pcm.!default { type asym playback.pcm { type plug slave.pcm "bluealsa" } capture.pcm { type plug slave.pcm "hw:2,0" } }
Since I’m absolutely new to this I fear that this might already be confusing since it looks to me like I’m defining the default pcm device twice - once with “bluealsa” (something that comes from the installed “pi-btaudio” - so I’ve no idea whats actually done there) as well as once with the split between playback and capture device…
However - with that the mirror is at least “working” again… but the audio capturing is completely random now - its barely reacting to the hotwords.
Furthermore I cannot control the volume any longer.
The mirror is randomly restarting every 10 minutes.
The mirror in general is extremely “laggy” and unresponsive.
And last but not least raspotify is still not working :weary_face:I’m now contemplating how to move on. I could try to get rid of the “pi-btaudio” stuff since this is where all the mess started and reinstall pulseaudio. I could try to still fix the issue - maybe something still not working proberly with the config… Or try something else?
If anybody has a thought how I can proceed I’m more than thankful for any help.
Best regards
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@bugsounet said in Automatically wake bluetooth speaker from sleep/suspend:
humm…
i’m so kind today … so try v3.0.4 of GA with this recipe:var recipe = { commands: { [...] Note maybe you have to add path in the return value example `/home/pi/bla/bla/bluetooth_connector.sh`
That’s pretty sweet and works fine :) Thank you very much!
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@bugsounet said in Automatically wake bluetooth speaker from sleep/suspend:
(if you think that is the better solution… I will engage you for coding :D)
:face_with_hand_over_mouth:
It’s certainly not a perfect solution - I have to add that every time there is an update in the detector helper - ohh, surprise, there is an update in the detector module :D
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@sdetweil said in Automatically wake bluetooth speaker from sleep/suspend:
@stinger0815 start here
https://linuxcommand.org/lc3_wss0010.phpbut one point the filename does NOT NEED the .sh extension
The leap from this topic to my idea is that your ‘script’ can be named the same as the program u wish to run and no one could tell it was your script instead!
and your script can call the original program so you don’t have to recreate everything it doespath is an important topic here. covered in the linked topic
most of this works in windows too
Hey thank you very much! I’ve in the meantime started to look for a hack to get it to work:
in the node_helper of the detector module I’ve changed the function that sends the notification once the trigger command is received and added a child_process (from nodejs) there:
onDetected: function (from, detected) { this.deactivate() let ble = require('child_process'); ble.exec('sh bluetooth_connector.sh', function (error, stdout, stderr) { console.log('stdout: ' + stdout); console.log('stderr: ' + stderr); if (error !== null) { console.log('exec error: ' + error); } }); this.sendSocketNotification("DETECTED", { from: from, key: detected } ) },
The script that is called by exec “bluetooth_connector” only contains:
#!/bin/bash bluetoothctl \ connect <<BLE ADDRESS>> exit
pretty hacky but does the job for now. I’ll now try to figure out whether this is actually decoupled enough so that the exec does not block the rest of the application. As I can tell from the logs it looks like the script is decoupled and runs in the background - what is good.
So as this is running now I’ll look into the solution you gave.
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@sdetweil said in Automatically wake bluetooth speaker from sleep/suspend:
SO, you could make a script named the same as the pgm that GA will call on PIR wakeup
and inside that script do your thing and then call the original pgm (U will probably have to rename it, or move it a new location) passing the original parms…
I’ve done this a hundred times over the years…
Sounds pretty good to me - however, here comes the next problem. I’m pretty bad with all kinds of script based + OO languages. My only background is embedded development, so translating what you said sounds a little bit like creating a new callback function and from there calling the original one. BUT how?! :beaming_face_with_smiling_eyes: No, for real, I’ve looked the forum real quick for stuff like “how to invoke small scripts” but was not successful. Do you have by any chance some sort of quick-start guide or any other tutorial to look at? I feel bad for asking as this is nothing really “magic mirror” related rather a basic programming thing - however, still want to give it a try in order to avoid mistakes that could come from the MM structure/architecture.
Best regards and thanks again
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@sdetweil said in Automatically wake bluetooth speaker from sleep/suspend:
@stinger0815 well, you could add it to the boot sequence too…
make it a bash script, and call it from boot and GA recipe
Hey - I actually did not dig into the PIR wake that much and have not implemented it yet, sorry for that. But I thought it is more about switching on the display and not rebooting the whole mirror or am I wrong? If it actually runs over boot this could definitely do the job! I’ll check the module real quick…
-
RE: Automatically wake bluetooth speaker from sleep/suspend
@sdetweil said in Automatically wake bluetooth speaker from sleep/suspend:
i think you can create a recipe for GA to launch anything on specific words…
Thanks for the reply, that’s something I actually thought about but wanted to look for “better” options - simply due to the fact that the reconnection takes some time (roughly 5 seconds) and I did not wanted to delay the response or miss parts simply due to the system still booting…
thanks again!
-
Automatically wake bluetooth speaker from sleep/suspend
Hello all,
I’ve finally brought the Google Assistant to live and I’m quite happy with it. However, I’ve a quite practical problem.
My mirror will typically be used a few times per day but not throughout the whole day. And here comes the problem - I’ve connected a bluetooth sound bar for the audio. This soundbar goes to sleep mode after a couple of minutes without audio used. Unfortunately neither Rasbian nor the smart Mirror by himself will reestablish the suspended bluetooth connection once they want to play audio again - evn though that bluetooth is the “only” available audio output interface.Reconnecting the device is quite easy:
$ bluetoothctl $ connect <BLE ID>
So what I’m looking for is a way to either:
- list itemavoid the sleep with some sort of periodic output?
- any way to force the system to reconnect / wake the suspended bluetooth connection
- implement/run a short script once an action on the mirror is performed (could be the PIR - wake, any “OK google” input, the face recognition or anything else that indicates a user presence)
I would really appreciate any help.
Thanks :)