jrouleau / bluetooth-autoconnect Goto Github PK
View Code? Open in Web Editor NEWA linux command line tool to automatically connect to all paired and trusted bluetooth devices.
License: MIT License
A linux command line tool to automatically connect to all paired and trusted bluetooth devices.
License: MIT License
Often I have my headphones already connected to my phone. After turning on my PC, the headphones automatically get connected to my PC and lose the phone connection.
Can I somehow configure this daemon to only try to connect if the devices aren't already connected?
Got that error message:
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
I'm having an issue - bluetooth-autoconnect only attempts to connect once at startup, then when it fails it doesn't try again. It seems to only be when the mouse it already on from a previous session. If I turn the mouse off, then turn it on after bootup, it connects automatically. It will also connect if I put it into pair mode, and manually type bluetooth-autoconnect -v at startup...
Is this package designed to only attempt to connect once to a device, then if it fails it doesn't retry? If so, can I change this functionality?
Add device inclusion/exclusion filter arguments, e.g.:
bluetooth-autoconnect [-d] --include <other_mac>,<another_mac>
bluetooth-autoconnect [-d] --exclude <mac_address>
My solution for this was the add a systemd-sleep script to power off the bluetooth adapter before sleep and power it back on when resuming. The running daemon will pick up the powered on adapter event and rescan.
#!/usr/bin/env bash
case "$1" in
pre )
bluetoothctl -- power off >/dev/null
;;
post )
bluetoothctl -- power on >/dev/null
;;
esac
exit 0
Hello
I am using a macbook air 2015 with linux mint 19.1 I have followed the installation but when I ran the command bluethooth-autoconnect I get the following error:
/usr/bin/env: invalid option -- 'S'
Try '/usr/bin/env --help' for more information.
I wonder what have I done wrong during the installation.
cheers
Has anyone had success with running bluetooth-autoconnect on Raspberry PI OS Lite bullseye?
On RPI3B+ Stretch it works perfectly and I'm trying to get it to run Raspberry PI OS Lite bullseye.
Appreciate any success story and guidance regarding packages versions/configuration etc. necessary to get it working on RPI4B Lite bullseye would be greatly appreciated.
Thanks,
RP
Traceback (most recent call last):
File "/usr/bin/bluetooth-autoconnect", line 12, in <module>
from gi.repository import GLib
ModuleNotFoundError: No module named 'gi.repository'
Fix was to add python-gobject
to the PKGBUILD
dependencies.
I have a Bluetooth speaker as a slave in a Master/Slave power strip with the main system as a Master.
This helps enormously with energy savings.
When the system wakes up, the service needs to restart with delay so the just powered on Bluetooth speaker can reconnect to the system.
One way to solve the problem is by creating an executable reconnect_to_bluetooth.sh
at /lib/systemd/system-sleep
:
#!/bin/sh
case $1/$2 in
pre/*)
echo "Other"
;;
post/*)
sleep 40 # Because Bluetooth speaker turns on in about 30 seconds
systemctl restart bluetooth-autoconnect.service
;;
esac
Hi,
it seems to connect fine the first time but if I switch the bluetooth device off and on again, it is not being picked up by the script anymore.
Nothing appearing on bluetooth-autoconnect -v -d
.
It's stuck in GLib.MainLoop()
without doing anything.
Is this repository compatible with Debian?
Getting the following when attempting to install with yay
:
$ yay -S bluetooth-autoconnect
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1] bluetooth-autoconnect-1.3-1
1 bluetooth-autoconnect (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> A
:: Deleting (1/1): /home/walter/.cache/yay/bluetooth-autoconnect
:: (1/1) Downloaded PKGBUILD: bluetooth-autoconnect
1 bluetooth-autoconnect (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> N
:: (1/1) Parsing SRCINFO: bluetooth-autoconnect
==> Making package: bluetooth-autoconnect 1.3-1 (Mon 16 Jan 2023 03:58:22 PM SAST)
==> Retrieving sources...
-> Downloading bluetooth-autoconnect-1.3.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 4478 0 4478 0 0 1193 0 --:--:-- 0:00:03 --:--:-- 2652
==> Validating source files with sha256sums...
bluetooth-autoconnect-1.3.tar.gz ... Passed
==> Making package: bluetooth-autoconnect 1.3-1 (Mon 16 Jan 2023 03:58:27 PM SAST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found bluetooth-autoconnect-1.3.tar.gz
==> Validating source files with sha256sums...
bluetooth-autoconnect-1.3.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
-> Extracting bluetooth-autoconnect-1.3.tar.gz with bsdtar
==> Sources are ready.
==> Making package: bluetooth-autoconnect 1.3-1 (Mon 16 Jan 2023 03:58:29 PM SAST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Stripping unneeded symbols from binaries and libraries...
-> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "bluetooth-autoconnect"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: bluetooth-autoconnect 1.3-1 (Mon 16 Jan 2023 03:58:30 PM SAST)
==> Cleaning up...
error: could not set install reason for package bluetooth-autoconnect (could not find or read package)```
I've been encountering an issue where my bluetooth headset (Bose QC 35 II) doesn't automatically reconnect if I walk out of range for a sufficient amount of time. The bluetooth adapter on my laptop obviously isn't power cycled so the daemon doesn't know to trigger a connection attempt. How would it? Unless the device tries to connect (which in the case of my headset, it gives up trying to reconnect after some minutes), how would bluez or the daemon possibly know that the device is back in range?
I may consider adding an option to set a probe frequency, but my assumption is that it would have a significant impact on power usage. I'm not yet certain if this can be done in a power efficient manner.
For now, as a workaround, I manually run bluetooth-autoconnect
upon returning to my laptop.
Any ideas or knowledge on the topic are welcome
set up bluetooth-autoconnect, bluetoothd logs the following message when the OS boots:
bluetoothd[506]: profiles/input/device.c:ioctl_is_connected() Can't get HIDP connection info
Raspberry PI OS 64bit Lite bullseye
Gnome 3.38
Apple wireless keyboard
Apple magic trackpad
If you disable bluetooth device or auto power off when idle and then enable again, connection not restored. I need restart bluetooth-autoconnect service for connect device.
On log seen this:
error connecting to device /org/bluez/hci0/dev_A0_5A_5C_94_9A_16: Input/output error
pulseaudio-bluetooth-autoconnect references pulseaudio in systemctl enable. If one is using pipewire then pulseaudio is not installed. Need to accommodate the "new kid on the block".
Hi,
I've noticed that after running the bluetooth-autoconnect
script in daemon mode it is visible as "python3" in processes list. Is it possible somehow to change the process name to e.g. bluetooth-autoconnect
or python3/bluetooth-autoconnect
(permanently e.g. by modifying script file)?
Currently the only way to check if the script is running is to use ps u -C python3
command but it won't show other processes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.