Auto Connect Bluetooth Headset

  • Reviving and old thread

    Auto Connect Bluetooth Headset

    I have some Sennheiser (HD 4.40 BT) headphone en route, so I have been reading up on what I am up against in using them.

    After reading the thread above I am vague on various points.

    First, are they setting up a button on a remote control to force the BT reconnect, or is it a control button on the headphone?

    Second, what is the filename and location where this line is added to?

    <key id="0x07">RunScript(/storage/autoConnect.py)</key>

    Third, I guess there is a map for these key id numbers available somewhere in case I need something other than key 7?

    Fourth, after reading to the end of the thread and making the suggested edits, is this the correct final code for the python file (understanding that I am going to insert my bt mac add.)?

    Python
        import xbmc
        import os
        from subprocess import call
         call('echo -e "connect ##YOUR-BT-MAC##\nexit" | 
    
    bluetoothctl', shell=True)
        current.close()

    Finally, I suppose even more MAC addys could be added to the code for BT keyboards, mice, etc, to have the whole crew reconnect, if needed? Or assign a different button for each device and have a custom python file for every button/device combo?

    Many thanks LE community!

    Edited 6 times, last by WarpLover: clarity, completeness (April 5, 2020 at 5:29 PM).

  • I've no idea about the Python script, but the "Controller 6C:21:A2:9B:16:AE (public)" line contains the BT device MAC adddress.

    You might want to experiment with the audio switcher add-on in our repo.

  • I've got the headphones I ordered now. Paired up beautifully with my cellphone. I use them for music, not the phone.

    I bought the headphones to work with my Wetek Play 2 box running LE 18.2. Both BT 4.0.

    My cellphone paired up easily. Asked me to authenticate a numeric sequence, and life was good.

    Now for "the box". I reboot "the box" and go straight to Bluetooth in libreelec system area. Two or three devices populate the BT list on the box depending on if BT is turned on on my phone, or not. When the phone is off, two devices show up. I found out one is the neighbors 4k TV. The other device just shows the BT symbol and a MAC address. Can't pair. Can't connect to it. I wonder if that is my Wetek Hub in the other room? It would be BT 4.0 as well. I'm in an apartment. Could be anything.

    When I cycle on the power for the Sennheiser HPs I hear "power on", "no connection" (with cellphone BT off). The list of Bluetooth devices on the wetek box doesn't change once the headphones are on. One would expect an extra device would show up on the wetek BT list.

    I would think the headphones were the problem except they worked fine with media on the cell phone.

    I am new to BT. Never had a need for it before. And I certainly have never had BT headphones before, so the problem could easily be me.

    Any suggestions or directions?

    Off the wall noob BT questions.

    If I am paired and using the HPs with the cellphone and switch the wetek box on. Could I tell the box to pair with the HPs, and would it drop the pairing with the cellphone in favor of pairing with the wetek box?

    I cannot figure out what the headphone MAC address is, since it doesn't show up when pairing with my phone or on the wetek box. And I don't see it on any of the headphone paperwork. No windows BT machine to check for the MAC.

    Thanks for making it this far.

  • I went to a friends and tried the headphones on a rockchip box running OSMC. I fumbled for a while but we got it to move from the discover column to the paired column. The BT symbol shows blue from a moment but turns red immediately if it doesn't receive a reply. So, it paired, but sound still came from the TV not the headphones.

    With that experience I brought them back home and tried again. I was able to get the wetek running 18.2 LE to pair them up, easier than the rockchip box. But the same results. Screen shows they are paired, but sound still comes from the TV and nothing from the headphones.

    Help?

  • I've googled. Most help is for windows.

    so I found a post that suggests running pactl

    I don't know what to look for but these lines looked informative. SUSPENDED is seen twice.

    My MAC address does not change on reboot.

    > Server String: /var/run/pulse/native

    > Library Protocol Version: 32

    > Server Protocol Version: 32

    > Is Local: yes

    > Client Index: 3

    > Tile Size: 65496

    > User Name: root

    > Host Name: Play2

    > Server Name: pulseaudio

    > Server Version: 12.2

    > Default Sample Specification: s16le 2ch 44100Hz

    > Default Channel Map: front-left,front-right

    > Default Sink: bluez_sink.00_16_94_37_57_23.a2dp_sink

    > Default Source: bluez_sink.00_16_94_37_57_23.a2dp_sink.monitor

    ...

    path=/org/bluez/hci0/dev_00_16_94_37_57_23 aut

    odetect_mtu=0

    > 7 bluez_sink.00_16_94_37_57_23.a2dp_sink module-bluez5-device.c s16le

    2ch 44100Hz SUSPENDED

    > 7 bluez_sink.00_16_94_37_57_23.a2dp_sink.monitor module-bluez5-device.c

    s16le 2ch 44100Hz SUSPENDED

  • Resolved.

    Note to other noobs:

    After you pair your headphones, you'll need to go into system settings | audio

    and change the audio output to bluetooth audio.

    old people don't know such things