@fillilutten, these are common questions that aren’t sufficiently explained in the documentation. Sorry! Above, I wrote an analogy to try to highlight the difference between presence
and monitor
and why each functions in the way it functions. The following analogy is a bit different.
Blackout Gymnasium
You’re in a pitch black gymnasium along with some other people.
Some of the people in the gym periodically make sounds (e.g., eating a chip/crisp, dribble a basketball, cough, etc.), others sit quietly and don’t make a sound unless you specifically ask them and still others periodically say their own name out loud at regular intervals whether or not you want them to.
For privacy reasons, we can’t just shout “WHO’S HERE” because then everyone would say their name at once and we couldn’t hear anything. So, all have agreed that anyone in the gym who might respond will only respond if their own name is called, like taking attendance in a classroom.
You’d like to know if your friends are in the gym too. How can you find out if your friends are there with you if you can’t see them? How can you find out if your friends have left the gym if you can’t see them?
Well, if our friends say their name out loud it’s easy to know if they’re present or absent. All we have to do is listen. Otherwise, we don’t know if our friends are present without asking for them one at a time since none of the sounds we hear are clearly associated with any particular person and our other friends won’t respond unless we specifically ask for them.
So, let’s come up with a strategy to figure out which of our friends are in the gym.
-
Strategy 1: Ask your friends if they are there at regular intervals. If a friend doesn’t respond, you’ll presume they’ve left.
-
Strategy 2: Wait until you hear a sound, then ask our friends if they’re present.
Strategy 1
Here’s how Strategy 1 might play out if my friends are John and Jane:
Me: Is John here?
(WAIT FOR 5 SECONDS FOR JOHN TO RESPOND)
Me (to self) - JOHN is not here.
Me: Is Jane here?
Anon: Jane is here!
Me (to self) - JANE is here.
(WAIT 30 SECONDS)
Me: Is John here?
(WAIT FOR 5 SECONDS FOR JOHN TO RESPOND)
Me (to self) - JOHN is not here.
Me: Is Jane here?
Anon: Jane is here!
Me (to self) - JANE is here.
(WAIT 30 SECONDS)
Me: Is John here?
Anon: John is here!
Me (to self) - JOHN is here.
Me: Is Jane here?
(WAIT FOR 5 SECONDS FOR JANE TO RESPOND)
Me (to self) - JANE is not here.
...
After asking for John and not hearing a response, we presume that John is not in the gym. We also presume that Jane is in the gym with us because she answered. Later, we determine that John has arrived and Jane has left.
The only problem with this strategy is that we’re constantly shouting into the gym. That makes it difficult for other people in the gym to hear.
Strategy 2
Here’s how Strategy 2 might play out if my friends are John and Jane:
...
(--- SOUND ---)
Me: Is John here?
(WAIT FOR 5 SECONDS FOR JOHN TO RESPOND)
Me (to self) - JOHN is not here.
Me: Is Jane here?
Anon: Jane is here!
Me (to self) - JANE is here.
(FIVE MINUTES PASS)
(--- SOUND ---)
Me: Is John here?
(WAIT FOR 5 SECONDS FOR JOHN TO RESPOND)
Me (to self) - JOHN is not here.
(THIRTY SECONDS PASS)
(--- SOUND ---)
Me: Is John here?
Anon: John is here!
Me (to self) - JOHN is here.
Again, after asking for John and not hearing a response we can presume that John is not in the gym with us. We also presume that Jane is in the gym with us because she answered.
Later, we hear another sound and ask for John (we don’t need to ask for Jane since we know she’s already there). With this strategy, we’ll have to periodically ask whether Jane and John are still present, but we’ll get to that a bit later.
What does this have to do with bluetooth?
The blackout gym is analogous to the bluetooth environment around a raspberry pi.
Some bluetooth devices in the environment periodically broadcast a random address (i.e., make an untraceable/unidentifiable sound), some bluetooth devices sit quietly and don’t broadcast unless you specifically ask them, and still others periodically broadcast their own name out loud at regular intervals whether or not you want them to.
-
Modern phones and some beacons are the first category of devices. They advertise randomly, but they do not advertise themselves.
-
Older phones and other bluetooth devices do not advertise at all, but will respond to a request if you know their MAC address.
-
Some beacon bluetooth devices will advertise their name (and/or other information) publicly whether or not you want them to.
presence
employs Strategy 1 above and monitor
employs Strategy 2 above to check for the presence of your phones. Since presence
only asks known devices whether or not they are in the nearby bluetooth environment, it cannot detect beacons while monitor
can.
More simply:
-
presence
periodically asks every device in your configuration whether it is present. This adds noise to the 2.4GHz environment (sound in the blackout gym) and may interfere with other devices.
-
monitor
- with default settings - waits for a random advertisement (unidentifiable noise) and then asks every device in your configuration that is absent whether it is present. Since it is already listening for random advertisements, monitor
also reports beacons/ibeacons that advertise their own name.
So, @fillilutten , in answer to your question, monitor is “interested” in the entire bluetooth environment beacuse your “known devices” only make unidentifiable advertisements/sounds. Your phone does not say “ANDREW’S PHONE” or “PHONE 12345” - it only says “THERE IS A DEVICE HERE”. We still have to figure out which device it is.
That’s why we need to “monitor” the bluetooth environment instead of just waiting for your phone to advertise itself (since your phone doesn’t do that!).
I hope that helps!