Bluetooth Auto-Connect on startup

  • Hi guys,

    I have an issue with my soundbar not connecting automatically on startup; I need to go to settings and manually connect it though it is paired already. I have found a way to connect through ssh with:

    Code
    bluetoothctl
    pair <your mac address>
    trust <your mac address>
    connect enter your MAC add


    I have created a script , and made it executable. It works when executed through ssh.

    Bash
    #!/bin/bash
    bluetoothctl << EOF
    connect enter your MAC add
    EOF
    Code
    chmod +x ~/scripts/autopair

    The final step would be to make that script launch when Kodi starts but I can't find how... I'm pretty new to this... ;(

    Thanks a lot for your help

  • FlashiHD , registered only to thank you for your exemple of code for autoconnect bluetooth on startup.

    I was looking for this trick for connecting automatically my Z407 speakers to my raspi4 which I use as a media center connected to my beamer.

    No more need to manually connect the audio system for enjoying videos.

    Big thumbs up to you. :thumbup: :thumbup:

    Edit: I just changed the sleep 5 to sleep 15 to give enough time for the "bluetooth audio device changer" add-on to start. Then the bt connection on startup also changes the default audio device to bluetooth (instead of default hdmi).

    Edited once, last by Mirrabeau (June 25, 2021 at 7:40 PM).