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

@benjimatt should be fixed now.

yeah i pretty much pulled it as soon as you put it up. Looks good so far. the confidence drop is interesting. Quicker but barely and when it goes to zero it first sends a confidence of “” then it goes to “0” its strange Im using 3 in the behavior preferences file. But this is how it goes when i monitor my mqtt topics

Repetitions Sequence
3 100, 33, “”, 0

I mean it still works but it would be a hair quicker is it didnt post the blank confidence

1 Like

Interesting. I’ll review, although I think I know why this is happening.

Hey @andrewjfreyer or anyone clever’er than me. I was hoping you could point me in the correct direction.

I have been using Presence for the last few months, and its been amazing, works perfectly for me, set it up, and forgot about it, exactly how I like home automation to be. It’s just me in my house, so just one iPhone that it’s tracking, so never had a problem with the 2.4Ghz interference. But had some friends over the last few week’s, and for a bit of fun, got the MAC’s from them, and setup some greetings in the house for when they got here, tracking through Presence, well obviously, that killed off my 2.4Ghz, so need to move over to Monitor, but its just confusing me a little with all the switches and what not.

I have two pi zero’s I use, front and back. To follow your example, my front one does everything, the back just covers the rest of the house for when I am in it, so I would guess that the back one needs the -t flag ?

monitor -t[adr] scan for known devices only on mqtt trigger messages:

But then when I tried to run it with the -t flag, it doesn’t pickup my phone, which I guess makes sense ? as i need’s to be triggered to find it ? But the point of my back sensor is to cover the house if I am at the back of it, so with Presence, if i wonder back there, it just picks up my phone, or my bedroom is there, so at night, it has me covered.

Was wondering if you or someone can let me know what flag’s I should be running on each front and back one to have it tracking just phone’s, no need to worry about beacons or any of that stuff.

Currently, when I walk or drive upto my house, the pi’s with Presence can pick me up before I walk to the door, or as I drive into the garage in the car, and keep me covered in the house if i walk from front to back. Would like to try and replicate it with Monitor and without the interference for when I have guest mac’s added in.

Any help is super appreciated,

1 Like

based on how you are using it the default method may work just fine.

are you actually wanting to trigger the OTHER pi? Or do you want it to pick you up when you get near it? If it is the latter the default works just fine.

2 Likes

Sorry to jump in on this too, but what’s the benefit of running -tad on the second Pi over using the default options?

1 Like

thank you for the reply @benjimatt I just want it as an extender I guess, it’s never used to detect me as arriving, its just for when I go into the back of the house in the garage, or my bedroom, but if I am that far back, the front one can lose detection of me.

So default install on the back one, and the the =t flag on the front one to trigger departure scan’s from the front / garage door’s ?

1 Like

Less frequent scanning by nodes far away from places that a person could arrive (e.g., third floor). That’s it. Default settings would work fine too.

If you’re going to use trigger options, I’d suggest having your ‘main’ node flagged with -tr and your ‘remote’ node flagged with -tad. That said, what @benjimatt said is also true. Default settings can work fine too.

1 Like

Thank you for the reply @andrewjfreyer so just git pull, edit known devices, mqtt settings, and that should be it, shouldn’t experience any/much wifi interference from that ? I have two tablets that run HADashboard, and they were starting to experience very frequent drop outs, and switching off the Presence script certainly stopped it, but I love the way it worked so seamlessly. I have Monitor up and running now as above, using the same location/front location/back sensors, so HA is all unchanged, and will see how it goes from here.

Thank you again for the time and effort you have put into this, its simply the way home automation should be, set it and forget it :slight_smile:

Anybody using monitor successfully with Tile? Mine were always flakey in the beginning.

Thanks Andrew - and just to confirm with your response to @Cee, if we use -tad on the third floor, do you need to pair it with -tr on your main node to trigger the MQTT scan messages?

2 Likes

Yes. That is correct.

Yup! That’s more or less it.

1 Like

This error should be fixed now.

Update: 0.1.672

Major Change Log:

  • README.md example updates, phrasing updates
  • Updated reporting formula for confidence loss
  • Various bugfixes

Note the beta branch, if you’d like to test out features before they’re merged with the master branch.*

2 Likes

Yeah looks good now. These are the settings im currently using.

Repetitions Sequence
2 90.0, 45.0, 0

This is giving me a very quick depart. :clap::clap:
To make sure my Depart is being seen this is the script that is ran when the door (trigger) opens / closes

mqtt_depart:
  sequence:
  - delay: 00:00:10
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:20
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:30
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:40
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:50
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish

This is all works well so far. I have a fall back just in case arrival is happening same time as a depart scan. My Win 10 vm Pings my away devices every 2 seconds (yes this is aggressive) until they are declared home. Id say its about 50 / 50 for which method is triggering my arrival. But for depart / Not home status Monitor is the only thing I am using because its the only thing that is actually reliable IMHO.

Thanks for the hard work. Just a thought.,…for a further future release if you are bored. Once all the Known_Devices are declared HOME can we either stop the arrival scans or make it where I have less scans. All my devices will be home for easily 10 hours and while we are home the devices are essentially doing arrivals scans for no reason especially since my Pi’s are set to scan depart on a trigger.

Either way I love the way things are working right now.

5 Likes

As a newbie to monitor I found things a little confusing at the start, so if possible I’d like to suggest the following updates to the readme.md please as it would have helped my past self understand things quicker. :slight_smile:

  1. Could you explain some of the command line options in more detail please? For example, as you have described above, using -tr and -tad in combination to help reduce scans on far away devices. Another is the -x option - where does it retain MQTT messages and what benefit does this give? Where does the -E option report scan status messages? How does the -m heartbeat signal help? Could you give advice or insider tips on how best to combine the options?

  2. The the following default entry in mqtt_preference confused me initially because monitor doesn’t match up with your examples in Readme.md where all the MQTT topics start with location. Could the default entry be changed to match please?

# MQTT PUBLISH TOPIC ROOT 
mqtt_topicpath=monitor
  1. Could you also clarify that mqtt_publisher_identity=''" relates to first floor second floor, etc in your examples?

  2. The Home Assistant example name: "Home Occupancy Confidence of 00:00:00:00:00:00" doesn’t match up with entity_id: sensor.home_occupancy_confidence. Could you change it to something like the following please?

- platform: min_max
  name: "Home Occupancy Confidence of Andrew"
  type: max
  round_digits: 0
  entity_ids:
    - sensor.third_floor
    - sensor.second_floor
    - sensor.first_floor

- alias: Occupancy 
  hide_entity: true
  trigger:
    - platform: numeric_state
      entity_id: sensor.home_occupancy_confidence_of_andrew
      above: 10
  1. This sentence was confusing: Do this with all other cell phone/laptop devices that you'd like to track via mqtt messages posted/formatted like this: as it implies the text below that sentence should also be in the known_static_addresses file.

  2. More Home Assistant code examples would be useful if possible please. A full example showing how you do the presence automations, etc, perhaps as an extra file in GitHub that would work as a HA package file https://www.home-assistant.io/docs/configuration/packages/)

  3. Step 7 in the installation instructions has two different ways to install software - is there a difference between apt-get and aptitude?

sudo apt-get update
sudo aptitude install libmosquitto-dev mosquitto mosquitto-clients

Sorry to rip apart your instructions like that, I just want to help others adopt your excellent software easier than how I found things.

Thanks!

2 Likes

Thank you again, just ran it on default settings for the last 24 hours with just my MAC in and seem’s to be almost a interference free zone now, tablet only dropped out once or twice instead of way too many times, it was filling my log with annoying errors.

Just added in a second MAC, will see how that goes :+1:

1 Like

Clever! I’m going to implement this myself. Good solution.

1 Like