Search for Bluetooth device

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Moto1987
Posts: 30
Joined: 09 Apr 2016 13:02

Search for Bluetooth device

Post by Moto1987 » 20 Dec 2017 10:17

Hello, is it possible to implement an Action or Flow Start with following Typ?

"Search for Bluetooth device"

I know Bluetooth LE is allready there but I have an device with Bluetooth 2.1 not 4.0 and above.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Search for Bluetooth device

Post by Martin » 20 Dec 2017 11:04

Hi,

You can add a trigger General Broadcast with action android.bluetooth.adapter.action.DISCOVERY_STARTED (use the [...] button and use the magnifying glass to search for discovery) to execute a flow when the device actively starts to search for BT devices (e.g. when opening the BT system settings page).

But maybe I did not understand your request properly. Could you please describe what you want to achieve? Do you want Automagic to detect when a BT scan is executed or do you want to start the scan from Automagic? Should Automagic also handle the result and connect to a particular device when found?

Regards,
Martin

Moto1987
Posts: 30
Joined: 09 Apr 2016 13:02

Re: Search for Bluetooth device

Post by Moto1987 » 20 Dec 2017 21:33

I have the problem that my phone does not automatically connect to my bluetooth car radio. The manufacturer has brought out various updates but it did not help.
Now I would like to that automagic scans in certain intervals for Bluetooth devices and if my radio is "there" it also connects immediately. Gladly the trigger can be that I am not connected to my WiFi. The next problem is that my radio only got the Bluetooth version number 2.1. Search for Bluetooth LE Devices is allready implement but not the other one.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Search for Bluetooth device

Post by bogdyro » 22 Dec 2017 11:39

Hi. I also connect my phone to my audio in car. It isn't very reliable most of the time. The thing I found works best is just have Bluetooth ON when I disconnect from my WiFi at home. The car stereo starts at the same time as my engine. Connection is almost instantaneous then. If however in the parking lot I still have a WiFi signal and bleutooth on my phone gets activated minutes after I started driving, it won't connect. Maybe the car stereo doesn't try to establish a connection anymore. I even got to the point that I left an old phone in the car that starts it's wifi whenever I turn on the engine. That triggers my usual phone's bluetooth and starts scanning for devices. That way it keeps bluetooth ON only when I'm driving. Overkill :)
Anyway, what I'm trying to suggest is that you should use action Connect/Disconnect bluetooth device in Advanced Audio Distribution profile. You don't have to search for it beforehand. It's up to you however to limit the action to when you're in the car.

Moto1987
Posts: 30
Joined: 09 Apr 2016 13:02

Re: Search for Bluetooth device

Post by Moto1987 » 24 Dec 2017 13:05

Now i have managed it on the following way.

There is an incomming call and when i'm not connected to an wifi the phone should Do connect to my car Bluetooth and all i can say is that it worked for me.

xdauser
Posts: 35
Joined: 05 Aug 2015 17:55

Re: Search for Bluetooth device

Post by xdauser » 29 Dec 2017 00:25

Some car manufacturers bluetooth implementation is terrible. Unfortunatel mine is as well far from being perfect. What I did is using NFC Tag sticker to phone holder in my car. Whenever I put phone in it, it starts appropriate flow to switch on Bluetooth on and connect to cars Bluetooth system. It works like a charm.

Second solution would be using Bluetooth ble beacon sticked to Car USB charger. Whenever phone is nearby it and beacon gets energized by switching car's accessory (ignition) into on position Automagic executes appropriate flow.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Search for Bluetooth device

Post by bogdyro » 29 Dec 2017 08:40

Didn't know about BLE beacons. Do they have to be recharged often? Could be useful as you don't have to actually take the phone out of the pocket to get it connected.
Are they easy to find/buy?

xdauser
Posts: 35
Joined: 05 Aug 2015 17:55

Re: Search for Bluetooth device

Post by xdauser » 29 Dec 2017 16:34

bogdyro wrote:Didn't know about BLE beacons. Do they have to be recharged often? Could be useful as you don't have to actually take the phone out of the pocket to get it connected.
Are they easy to find/buy?
You do not have to recharge it if it installed all the time in USB charger. Nowadays most of modern cars has this built-in or you can buy cheap USB charger and stick it into cigarette lighter port. Device itself draws very little energy, and it only fires when you have ignition switch into on position so no worries about car's battery discharge problem.

Just ask for Bluetooth ble usb dongle/beacon uncle google and you will have thousands of them for your choice. It is very small and not intrusive device.

Moto1987
Posts: 30
Joined: 09 Apr 2016 13:02

Re: Search for Bluetooth device

Post by Moto1987 » 29 Dec 2017 17:40

For me is the problem that i don't have any nfc in my phone (asus zenfone 3) otherwise i would do that too

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Search for Bluetooth device

Post by Desmanto » 29 Dec 2017 18:19

Check out the similiar BLE tag here : viewtopic.php?f=5&t=6883
It is used for home automation.

Need to setup a periodic timer, so only enable this flow when some certain event happen (example, disconnected from wifi and time range).
BLE device can last for months with single CR2032 battery. (depends on the model). Make sure the phone also support BLE (most mid-class phone from 2016+ should have it already)

Alternative workaround, put a small wifi AP on car. It can be powered by powerbank or just car charger. Reduce the wifi power transmit so it doesn't have a big range (not to interfere with home's wifi).
Use wifi scan/wifi available to scan for it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Locked