Bluetooth: Presence Detection

Hello, I couldn’t find a general topic about Bluetooth, so I’m creating one.

Through this post, I’m bringing up a bug (or at least a problem) regarding the detection of presence via Bluetooth that @lmilcent and I have noticed.

Currently, to be able to use a selected device as a presence detector in a scene, the added device must be present in a room. When it does not have one, it is impossible to find it in the device list « Device State Change » in a scene.

Would it be possible to activate in the scene list devices that are not associated with a room in a house?

To keep things consistent, I created an « outside » room for now, but it’s a bit confusing when you don’t see the nut in the list!

That’s not a bad idea :grinning_face_with_smiling_eyes:

Indeed, it is a problem

I wonder if it wouldn’t be better to create a special presence trigger so that this will be easier for the user to understand

I admit that without your tutorial on the forum I wouldn’t have found out how to manage a user’s presence.

The simplest thing would be to do as for all devices: triggering on state change.

  1. Bluetooth scans every 1 minute for example
  2. If my NUT is detected, the « Nut Louis » device is marked as present
  3. If my NUT is not detected, the « Nut Louis » device is marked as absent
  4. In the scenes, I can base myself on the state change of « Nut Louis » and check if it is at 1 or 0 (or a dedicated present/absent button in the scenes like for presence sensors).

This is much more consistent with the rest of Gladys and it’s easier to navigate.

I agree, and that’s already the case for the part of detecting entry into the house.

For the « detecting exit from the house » part, doing this in a scene seemed quite complex to me for something that is quite similar for everyone (everyone will do it in the same way, modulo some parameters), so I found that forcing people to recreate a complex scene that can just be a box in the scenes was overkill.

In fact, you are assuming that if your device is not detected even once at your place, it means you are no longer at home. However, in reality, Bluetooth disconnections of a few seconds happen all the time. That’s why historically on Gladys, people have rather made conditions based on a period of time without detection rather than on disconnection which causes false positives.

That’s correct. Initially, I wanted to do something else, but I think it’s still impossible to do with Gladys: to check the value of a sensor over a period of time (e.g.: no movement for 10 minutes).

Question about presence detection: I can’t figure out how to trigger scenes when a user leaves.
When I check the device value, it’s always 1 whether I’m marked as present or not.

In the documentation, you explain very well how to mark a user as absent or present with the « Check presence » box, but this action does not allow it to be used in « Continue Only If » for example.

Or did I miss something?

Why not link a device to the user profile?
Wouldn’t that be much simpler?

I just bought a Bluetooth key fob from Action for less than 2€.
I linked it to Gladys and it works perfectly.
Edit: Just that I have to click on it to activate it. Actually no need to click.

It’s exactly what I did, the dashboard shows present or absent. But how do I trigger a scene when I’m absent?

If you do the same scene with the action « user left home »
When he no longer sees your device, shouldn’t it change state, right?

It’s not working, it says: « This Action indicates that the user has left the house. »

This is not possible yet! :slight_smile: It’s a development to be done, you need to add a box « when the user leaves the house » and « when the user comes back home »

Thanks for the confirmation, I wasn’t entirely sure!

I’m leaving a message for those who might come across this. My message above is no longer relevant since Gladys v4.3 :slight_smile:

Hello, I am testing the feature, but my iPhone is never listed in Bluetooth Discovery

Hello @Thomas_Parquier, it’s normal that it’s not possible to do presence detection with our phones (both iOS and Android), for several reasons:

  • They do not emit continuously
  • They intentionally obfuscate their Bluetooth MAC address to avoid being tracked

To do Bluetooth presence detection, I recommend buying a Bluetooth keychain that will be seen by Gladys:

For example, the Nut: https://www.amazon.fr/Nut-Bluetooth-Télécommande-Localisation-Smartphone/dp/B01M4L7GHY

Too bad, thanks for the info
In this case, local network presence seems relevant to me (seen in another thread): what would be the procedure in this case?

To appear on the local network, you can use the « Shortcuts » app on iOS (or Tasker or Automate on Android) to detect that your iPhone has just connected to (or left) your home Wi-Fi network.

Then, to send the information to Gladys, on iOS you can use Gladys Plus’s Open API, I made a tutorial last week:

On Android, for someone with time and skills, it is possible to send the data via MQTT if the MQTT broker is available on the internet :slight_smile:

ok, thank you
Have you considered going through a Gladys detection module on the local network? mDns or something else?

Yes, there is a feature request in this direction:

If you’re interested, you can vote for the feature. For now, there are few votes on it, so it’s not a priority :slight_smile: