[monitor] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection

add tile in: known_beacon_addresses
my file looks like this

# ---------------------------
#
# BEACON MAC ADDRESS LIST; REQUIRES NAME
#
# 	Format: 00:00:00:00:00:00 Nickname #comments
# ---------------------------
F2:A3:TT:98:65:95 tile one
"random"

Ok. My other problem is that I cannot find the mac address. Tried several different free bluetooth ios app, and it doesn’t provide mac address.

monitor doesn’t see the Tile either. I use this cmd.

sudo bash monitor.sh -trd -x -b

ok then i dont know why, change battery in tile? haha :stuck_out_tongue:

Did you find a app with a -dBm meter? Hold your Tile against your phone while scanning. Then it should get lowest dBm. mMaybe try press the button on the tile to “wake up” i dunno :stuck_out_tongue:

That app is for android correct? I use apple. The app I use for my iphone, I can see the Tile, but the data info does not show the mac address. Just bunch of useless info I don’t need.

From here: BluetoothLE Tile - Detect on raspberry Pi? - #6 by happybubbles

Ok. I finally managed to find the Tile Mate mac address after many failed attempts using various scripts and ios mobile apps by using this Switchbot-MQTT-ESP32 code tweaking it along with the help from its author.

Plug the ESP32 into the pc after uploading the code and using the monitor serial console to look for all scanned devices. You will need to change this line in the code before uploading it.

# find
pScan->start(initialScan, scanEndedCB, true);

# change to
pScan->start(initialScan, scanEndedCB);

It will scan for 300 seconds. If you are lucky, not like me, you should see in the log Tile next to name. That will be the mac you are seeking.
If there is no Tile next to name, compare this UUID as it is from a Tile Mate (removable battery model) non Pro version.

Advertised Device found: Name: , Address: d6:u9:41:6d:a4:52, manufacturer data: 4c0002159d41000035d6f4ddba60e7bd8dc491c04a25f111cf
Processing Rescan MQTT...
Scan Ended

Hi,

I’m sorry as I’m sure this has been asked already. I use the appdeamon script with monitot but what would be the optimal monitor arguments for a single node that is placed at the front door and a contact sensor
at the front door being the only gateway sensor. We only ever leave/enter through the front door.

I struggle to understand how -tad or -tdr works (especially with 1 node).

I asked in that forum but no luck

Thanks

each individual letter is a switch that changes a setting in monitor.sh, you need -tad for your setup.

Hi fellas
I’ve been running monitor on a rpi zero for a few years now, but recently I’ve noticed it hasn’t been keeping track on my devices.

I logged into the pi and watched it working and noticed this error

[+] 0.2.197 18-04-2021 02:48:38 pm [CMD-MQTT] 
warning: network is down. 
enqueuing command to try
again after a delay

Has anyone come across this before and know what maybe causing it?

Also after I while I can’t post arrive or depart, yet when I tried restart I saw this message


/support/btle: line 430: packet_pipe: No such file or directory

Coming back to this I’ve noticed my commands to scan arrive or depart doesn’t work, yet restart does.

My Monitor on my rpi0 suddenly stopped working. I keep getting:
“[CMD-MQTT] warning: issue connecting to mqtt server (lookup error). enqueuing command to try again after a delay”
“[CMD-ERRO] fatal mqtt error - messages may not be delivered as intended (issue connecting to mqtt server (lookup error). enqueuing command to try again after a delay / 4)”.

I am running HA broker add-on with password. I can ping the broker IP.

Any ideas? Thanks!

Hi,

First of all, thank you so much for building this, I really appreciate it!

I’m having a weird issue where the Pi zeros I have around our house have a much harder time picking up my wife’s phone versus mine. I’ve attached some example graphs so you can see what I mean.

We have identical iPhone 11s, so I’m struggling to see what could be leading to the difference… I have 4 Pi zeros around the house - they all reflect a similar difference in sensitivity, and it occurs even when we’re sitting next to each other with our phones essentially equidistant from the sensors.

Any idea what could cause her iphone 11 to be so much harder to pick up than mine?

Thanks so much again!!

There are a couple things you could do to try and get more detail on this problem. Are the phones paired to the nodes? So you can get a reading of the rssi signal of each phone.

You could also enable the ibeacon in the HA mobile app and see if you get the same result when tracking that.

Got this working today and it seems to solve most of my presence detection problems. Need to distribute this further around the house, but I can already say this is very promising! BIG THANKS @andrewjfreyer and to others who have contributed to this project!

1 Like

Please excuse what’s probably a very simple beginner question - but I just want to make sure this is what I need before splashing out on a couple of pi zeros. Is this suitable for an HA installation running in VirtualBox on a Mac (and which doesn’t therefore have direct access to Bluetooth)? Am I right in understanding that a separate raspberry pi would report back over wifi, and would be able to detect the presence/absence of iphones and items equipped with ibeacons?

I can’t find a clear answer in the docs, or in the forum - but perhaps that’s because to more experienced readers the answer may be obvious!

1 Like

Yes, that’s indeed the way it works. To give an example:

  • Pi4 with HA installation (supervised install), in my office at home, no monitor.sh
  • PiZero, next to the front door, with monitor.sh
  • PiZero, in the kitchen, with monitor.sh (this is the Pi for my Grocy barcode scanner)
  • PiZero, in the garage, with monitor.sh
  • PiZero, next to the outside car park, with monitor.sh

All these PiZeros report back to HA and are notifying each other to perform a scan under some circumstances.

My recommendation (but that’s really only me!) is, don’t use the BT on your server installation. This one is reserved for my BT devices like thermometers and such. The presence detection (aka monitor.sh) is running best at the “gates” to your appartment/house.

The communication between your monitor.sh instances and HA is btw not WiFi, it runs with MQTT (that is using WiFi, ok, point taken) :smiley:

The only thing I can’t say for sure, how monitor.sh is running with Apple devices. I’m only using Android, but in theory there shouldn’t be any problems. Maybe some things need to be adjusted on the iPhone, so it sends BT data, but that will be configurable. :slight_smile:

Hi Patrick, thank you so much, that’s exactly what I wanted to know. I now need to go and spend some money :smiley:

Have fun! :slight_smile: :+1:

Anyone have connected to MQTT Broker using ssl certificate? In the mqtt_preferences file, what certificate it’s asking? Shouldn’t it be at least 3 separate paths?


# MQTT CERTIFICATE FILE (LEAVE BLANK IF NONE)
mqtt_certificate_path=''