Bluetooth BLE - Tiles

I added bluetooth ble to my configuration, and as a result Home Assistant added a lot of devices to known_devices.yaml - so all is well and good. However, I have no idea what these devices are. If I do a mac address lookup, most addresses cannot be found. Is there any other way to detect what the devices are?
Other question, more or less related: I also bought some Tiles and added them with the Tiles component. But maybe they can also be detected as bluetooth BLE? And if so, maybe they update their location more often and more correct in the house?

Tiles work really well, but not with the Tile or BLE components :stuck_out_tongue:

In my experience, the BLE component + Tiles crashes frequently and requires a HA restart and the Tile component is (phone) GPS-based, so useless if you want to use the Tiles for precise presence detection.

What I use is this: [monitor] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection - on a dedicated Pi (it needs exclusive access to BT), but if you don’t do anything else with your BT, you can also use it on whatever you’re currently running HA.

I still have some issues even with this (mainly the script exiting sometimes), but it can run well for days, notifies me when it’s down and doesn’t require a HA restart to get going again.

Using this (as a home/not_home device tracker, not a Boolean percentage) and the Tiles, I am recognized instantly upon entering the house and tagged not_home about 4-5 mins after exiting the house, which is perfect, since it doesn’t declare me not_home when taking out the trash :stuck_out_tongue:

1 Like

Hi johnflorin, thank you for explaining your solution!
I have an Intel NUC, and the BLE componentan sich works, it’s not like all the issues you can have with the Pi. I also so the monitor solution; at first sight it looks pretty hard to setup, but maybe that’s not true. Still in doubt if I should go that route, or trying to stick to the BLE component and figure out what is what. If you would tell me it’s pretty easy to setup, I might give it a spin.

Meanwhile, I have abandoned the Tile component :-).

I also avoided MQTT for the longest time for fear of its difficulty :slight_smile:

Overall it was pretty straightforward, I outlined what I did in post 33 here: Bluetooth LE Tracker issues

BTW, the BT issues I experienced were not on the Pi, but on a VM with an ASUS BT-400 USB dongle, the Pi has been fine BT-wise so far (with Monitor).

john, thanks for the procedure :-). Since I’m not on Pi, I cannot simply follow it, I assume. Let me first see at home if standard BLE component can show the tiles.

Yep, if standard BLE works without crashing you should be good to go, but I have yet to see someone say that it works well for an extended period of time with Tiles. As for the guide, I’d say you can definitely follow it, Raspbian or Ubuntu (I assume? on your NUC) is pretty much the same thing for the 3-4 commands needed for the script.

Even after all these years working as an IT-developer, I still hope I’ll be the first person to have a stable configuration out-of-the-box with the ble component #eternallynaive :smiley:

1 Like

I have the same problem with tile and given up . but if i recall a reddit post you should put the tile into broadcast mode (the one where it tries to find the app), connect to it and then delete the app or something and it should show up on the system. ive never got it working, which is sad. I think the mac adress for the tile might be hidden and thats why no other device than my phone can find it.

EDIT: also inside the known devices file you can usually find manifacturer and more information than the frontend supplies.

1 Like

What worked for me was to pair the Tile to the app initially, delete the app from the phone, run the HCI scan from the underlying Linux terminal, find out the MAC (it’s easy to see which one it is, it will be the only one with the name “Tile” besides all the other crap MACs it sees), then use the MAC in the BLE component or Monitor script. I did nothing with the Tile itself besides the initial app pairing, it will always be broadcasting after that if you delete the app.

HCIscan is indeed working!
For future reference: in the Linux console:

sudo hcitool lescan

I found indeed the mac addresses.
For the moment I can’t find them in known_devices.yaml though.
Now rebooting etc., see if that helps. The rest I have to test at home.
Thanks @johnflorin!

Ok, 1 succeeded, 3 to go! Something for tonight :-).

1 Like

@johnflorin I guess you were right. I can indeed detect the tiles with the ble component, but home/away is not reliable. To be continued!

If you look at the HA log after being declared Away, do you also see an “Unexpected error when scanning” entry?

Are you using the NUC’s BT for any other purpose? If not, it won’t cost you anything to check out the Monitor script, it works very well…

Well well… since you mention it (added debug for device_tracker):

Unexpected error when scanning: Set scan parameters failed: I/O error
13:16 components/device_tracker/bluetooth_le_tracker.py (ERROR)

I now run HA on the NUC, but when I look at the installation instructions for [Monitor], it seems to explain how to do this for a Pi. I wonder (I still have a Pi somewhere): should I install monitor on the Pi as something separate, or will it be better to add it on the NUC? Any ideas about that?

For Monitor, just follow the Pi steps from 7 onwards, because if you have working BT on your NUC you’ve already done the other prerequisites.

The steps after 7 are all generic and apply to any Debian Linux installation, on Pi or otherwise.

I am only using the Pi because I’m using the HA server’s BT for communication with a Mi Flora sensor and Monitor’s author specifically mentioned not doing other things with BT while his script is running.

1 Like

I tried to follow your procedure, but still stuck on it (I don’t know anything about MQTT sorry…)
This is my config in Mosquitto add-on:

{
  "logins": [],
  "anonymous": false,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Discovered MQTT in HA.
Then when I run monitor:

error: required package ‘mosquitto_pub’ not found. please install ‘mosquitto’ and ‘mosquitto-clients’.
error: required package ‘mosquitto_sub’ not found. please install ‘mosquitto’ and ‘mosquitto-clients’.
error: minimum required mosquitto_sub version 1.5+ not found. please update.
error: minimum required mosquitto_pub version 1.5+ not found. please update.

mqtt_preferences:

# IP ADDRESS OR HOSTNAME OF MQTT BROKER
mqtt_address=192.168.0.29 --> should I use my duckdns.org or just the ip-address??

# MQTT BROKER USERNAME
mqtt_user=mosquitto --> where do I create/define this user? I created it in HA itself

# MQTT BROKER PASSWORD
mqtt_password=******

# MQTT PUBLISH TOPIC ROOT 
mqtt_topicpath=monitor --> ok?

# PUBLISHER IDENTITY 
mqtt_publisher_identity='' -->??

# MQTT PORT 
mqtt_port='1883' --> unencrypted, but I disabled this one

# MQTT CERTIFICATE FILE
mqtt_certificate_path='' --> ???

#MQTT VERSION (EXAMPLE: 'mqttv311')
mqtt_version=''

Are you able to help me a little?

Hmm, you installed the MQTT addon in HA, but did you install Mosquitto in the underlying Linux server?

I assume you’re on a NUC, on which you have HA installed in Docker, so you need to login into the server itself (same place where you did the steps to install the Monitor script) and do this:

# get repo key
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key

#add repo
sudo apt-key add mosquitto-repo.gpg.key

*#download appropriate lists file *
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list

*#update caches and install *
apt-cache search mosquitto
sudo apt-get update
sudo apt-get install libmosquitto-dev mosquitto mosquitto-clients

I assumed installing it as addon in HA was indeed enough as installation, but it’s not, so it seems? :slight_smile:
I use Linux Mint (=Ubuntu). So the procedure might be slightly different?

Yeah, there are 2 components: the MQTT addon in HA (which is the “MQTT server” in this situation) and the Mosquitto package in the underlying Linux install, which is the “MQTT client” that Monitor uses in order to be able to communicate with the “MQTT server”.

And yes, the user you need should be created in HA itself and its user+pass inputted in mqtt_preferences

Sorry for hijacking this old thread…

I’ve been trying to solve the presence detection puzzle for some time. It would be great if the swing gates start opening when someone is approaching home. With the phone’s gps, half of chance we’ll need to wait 5-10 secs at the gates before they open. Not really ideal. So I followed this thread and purchased a couple of tile pro (2020), which has the longest advertised range (120m).

After paring, deleting the tile app and running “sudo hcitool lescan”, lots of MAC addresses show up expect the “Tile”. So my guess is either they’ve made some changes on this new model or I’m doing something wrong? Or does anyone happen to get this 2020 model worked already?

Any help would be appreciated.