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

I found a but with the -u flag - should be fixed now. Thanks for pointing this out!

1 Like

Does this work on raspbian stretch? I was planning on using it on an existing install.

Not sure if this has been asked over the 442 posts, sorry if it was.
Would it be possible to use this with a OBD car adapter to detect if a car is home?

If the bluetooth adapter is on car and not acc power, then yes - so long as the garage/street is in range of your bluetooth sensor.

Yes, the instructions are written for stretch lite for Zeros.

1 Like

If that doesn’t work for you I use a USB iBeacon for my car detection. Because they are off when the car is turned off I have ZERO false arrivals while the car is in the Garage overnight. This has allowed me to open my garage on arrival with 100% confidence it will not fire by mistake. I placed one in both of my cars and my Wife loves that the garage opens for her when she gets home :slight_smile:

https://www.amazon.com/gp/product/B019G0VVZC/ref=oh_aui_detailpage_o06_s00?ie=UTF8&psc=1

8 Likes

I can’t get my phone (iphone x) to show up in hcitool lescan, only scan (when I’ve made it discoverable). I’m guessing that won’t do. Any ideas about why my phone isn’t found with lescan? It has been before, but I reinstalled my rpi for this.

Clever. I like this solution.

It’s certainly showing up, but as a random address! :slight_smile: That’s the entire point of the monitor script - an iPhone does not broadcast its name or real address at all. It will respond to name requests (hcitool name 00:00:00:00:00), but for privacy reasons, it will not report its presence via lescan or respond to a scan unless it is in discoverable mode.

In fact, the random addresses broadcast that are visible via lescan change every few moments (about 180 seconds, in my experience).

If you want to see this, turn on an lescan, and toggle bluetooth on and off on your phone. You should see a new device pop up, with a completely random address. Do it again, and you’ll see yet another random address.

Thank you for clarifying! I’m not seeing it in the mqtt sub either, so I guessed that was the issue, but then I understand. Maybe I’ve messed up something else. I have my broker on another ip.
Edit: I was the mqtt settings. Now working with the phone, but I have a beacon aswell, and that only reports confidence 0, although it’s on top of the pi…
Are the beacons supposed to be in another file?

Well today i finally had the time to setup the monitor and I like how much information it gives-me however i’m stuck on A problem, that is clearly between the chair and the keyboard (me)

Starting monitor.sh (v. 0.1.466)…
Warning: Variable mqtt_publisher_identity does not appear in: mqtt_preferences. Using hostname: raspberrypi.

I have declare this variable on the mqtt_preferences but i keep getting this erros and can’t find out how to get over it.

this is how i have it declared:

PUBLISHER IDENTITY

mqtt_publisher_identity=sala

Would Monitor -r scan just like presence? Both of the Pi’s Im using are using ethernet connections so im not too worried about congestion. I only have two bluetooth devices that need monitoring.

Need quotations around “sala”

Yes, that’s right with respect to the -r flag. However, the interference comes from the Bluetooth radio, not from WiFi itself.

I have tried “all” combinations:
mqtt_publisher_identity=sala
mqtt_publisher_identity=‘sala’
mqtt_publisher_identity=“sala”

mqtt_publisher_identity= sala
mqtt_publisher_identity= ‘sala’
mqtt_publisher_identity= “sala”

None is working, i’m out of ideias, from what i know order of the declaration is irrelevant but, can it be?

---------------------------

MOSQUITTO PREFERENCES

---------------------------

IP ADDRESS OF MQTT BROKER

mqtt_address=myipwithoutquotation

MQTT BROKER USERNAME (OR BLANK FOR NONE)

mqtt_user=myyserwithoutquotation

MQTT BROKER PASSWORD (OR BLANK FOR NONE)

mqtt_password=mypasswithoutquotation

MQTT PUBLISH TOPIC ROOT

mqtt_topicpath=location/monitor

PUBLISHER IDENTITY

mqtt_publisher_identity=“sala”

PUBLISHER IDENTITY

mqtt_publisher_identity=’’

MQTT PORT

mqtt_port=‘1884’

MQTT CERTIFICATE FILE

mqtt_certificate_path=’’

Hello

1 - please see the big blue box at the top of this (and every) page. Formatting your code snippets correctly will allow others to help you more easily.

2 - you seem to have two entries for mqtt_publisher_identity in the above? Please post your preferences file in full (using the tip set out in the blue box). For example, here is one of mine:

# ---------------------------
#								
# MOSQUITTO PREFERENCES
#								
# ---------------------------

# IP ADDRESS OF MQTT BROKER
mqtt_address=192.168.XXX.XXX

# MQTT BROKER USERNAME (OR BLANK FOR NONE)
mqtt_user=XXXXX

# MQTT BROKER PASSWORD (OR BLANK FOR NONE)
mqtt_password=XXXXX

# MQTT PUBLISH TOPIC ROOT
mqtt_topicpath=presence

# PUBLISHER IDENTITY
mqtt_publisher_identity='XXXXX'

# MQTT PORT
mqtt_port='1883'

That is because i was trying more and more options and copy some variables.

I also tried to remove mqtt_topicpath variable and included everything on the mqtt_publisher_identity with no luck.

At the end of the day I will try one by one adding each variable to see if i can come up with something.

Also this is a fresh installation on a new pie zero w and on a new jessie install, brand new card running as a service with this parameters and pipper:
-d 1>&2 >> logging_output.log

In this example file, you have the publisher identity variable defined twice. Is this a direct copy paste?

It was and i have corrected it, like I said before I’m trying everything, also changing the variable location (line) and the only combination that worked is with it on the first line, any other place and it gives me the error.

It’s working so I can’t complain for using a program that @andrewjfreyer have dedicated his personal time to share with us, So once more thank you.

@jpm hit me up on discord if you’re still having issues with this. We’ll get it figured out.