How to get an automation based on my phone connected via bluetooth

Hi there
I’ve been searching a lot around here, but I just can’t seem to find how I can get it done. I would expect I just miss something stupid, but I can’t get clear what. Hopefully anyone here can help me out.

I want an automation to be trigered when my mobile phone comes in the bluetooth range of the bluetooth receiver which is connected via USB on my raspbarry pi which is running home assistant.

My bluetooht donle seems to be configured correctly.
When I do bluetoothctl in the terminal on my bluetooth device, I get a bunch of bluetooth devices in the screen.

Also the integration seems fine, but it does not show bluetooth devices which can be used.

When I check the release video of 2022.8 which contains the bluetooth support:
Especially starting minute 27:00 it shows alle the bluetooth devices coming in. But at my side they just don’t appear.

Therefore when I create an automation, for device or for entitiy I can’t put somthing in line sensor.samsung_bluetooth_connected because I just have not connected my samsung smartphone yet.

Who knows how I get this installed / setup?
I’ve got the latest version of HA installed.

If you could help me out, I would be so thankful. Is there someboady out there that has the golder hint?

Wkr, Menno

These should not be necessary if you have configured your BT dongle in the frontend… but you may want to read over:

Thanks Didgeridrew for the quick reponse.
Unfortunately I still can’t get it to work.

I’m running home assistant OS on a Raspberry Pi 4, and start to be affraid that in that combination it’s not possible what I want, though it sound really stange to me that such a “simple” thing like bluetooth can’t be used in this setup.
But hopefully you or anyone else can help me further.

I have the internal Bluetooth device of the raspberry Pi 4, and an extra USB bluetooth device. Both seem to be installed correctly according to the HA UI.
I even tried without the USB device, to check if they might interfere with eachother.

I added:

  • platform: bluetooth_tracker
    To my config.yaml file.
    And to be sure I restarted Home Assistant.

When I let Home Assisant check my config.yaml file, it reports:
Platform error ‘device_tracker’ from integration ‘bluetooth_tracker’ - Requirements for bluetooth_tracker not found: [‘PyBluez==0.22’].

When I try to solve this using:
pip install PyBluez==0.22

It fails one:
command ‘gcc’ failed: no such file or directory

When I try to fix that using:
sudo apt-get update
sudo apt-get install build-essential

It fails on:
sudo: apt-get: command not found

As far as I can read this might be because home assistant OS is a bit limited.
But I don’t have the experience with linux based systems nor with docker containers to start using those on my raspberry pi.
I understand there might be add-ons available that could help me in this. But so far I can’t find them.
Are you aware of these?
Or are there other ways to achieve my goal in this?

By the way, when I add:

  • platform: bluetooth_le_tracker
    To my config.yaml file, and let Home Assistant check it, it reports that the config is correct.

But when I then check in the terminal the directory “config” for a “known_devices.yaml” file, it’s not there.

And when I check in the list of devices in the UI, there are no extra bluetooth devices shown.

And when via “devellopment tools” → “services” I try to start a service like “bluetooth_tracker.update”, this service is not there on my system.

I really tried my best, but I just can’t get it to work. What am I doing wrong? How can it be so hard to get this up and running?

I hope anyone can help.