Presence (OPEN)

I tried to using mobile phones, it just wasn’t reliable enough.

I have since used BLE iBeacons and a Raspi3 (that has BLE and Wi-Fi). The wife has one and I have one and so do my kids. The raspi3 has a python script (modified by me but not mine originally) to detect the iBeacon MAC address via BLE and passes this on vi Wi-Fi network to Openhab. Rules do the rest so I know ‘who’ is home and how many are home (for heating setting security alarm etc) The iBeacon is a little bulky for the key ring but smaller ones battery time is in months whereas the one I use is 2 years with a 5 second ping time.

Could you all send me links too the ble beacons that you are all using thanks

Please search the forum for existing threads before you open a new one.
You would have found this thread and the presentation linked to here.

1 Like


Running OH quite a while, detection is based on WIFI and IFTTT…which runs mostly ok.
Since a couple of days I am looking into BLE detection but I am lost what to buy.
I wonder if some can give me a hand for specific device, that is supported by OH and uses BLE and WIFI. The idea is to place it into a wall outlet to ensure it is always running.
Any hints? Thanks for your effort

Well what to buy is easy, any BT beacon does. The problem is how to query BT from OH
(it’s easy with WiFi, there’s bindings to track devices on IP or MAC level, but no such thing exists for BT).
BT binding is experimental, using onboard BT on RPis easily interferes with anything to run on serial devices.
I suggest looking at FIND. Runs on Android, and uses both, WiFi and BT, to triangulate its position. There is a tutorial on integrating FIND with OH, but note that’s still based on old FIND v2. BT support requires FIND v3 (works as well with OH but there is no tutorial yet).

Maybe I made myself unclear or I am completely wrong. I am not looking for software / app, I am more into the hardware thing. I try to round up quickly:

We do have a couple of Apple and Android phone, Bluetooth always enabled.
Isn’t there a way to buy a wall outlet based beacon, that will detect the phone(s) and fires a switch in OH in order to switch on presense?
In fact it does not matter who will enter the room or the house, I just want to have a third way (beside WIFI and IFTTT) that comes into place in order to detect presense.

You’re completely wrong then. A BT beacon is a simple, essentially passive device to only announce its ID. It does not provide any function other than that. If you want to use it to detect proximity, you need to run a program somewhere on the mobile device to detect it’s moving into sending range of that beacon (i.e. it’s not running on the beacon). In other words: on your phone(s).
Alternatively, you could take the beacon for a walk (to be the moving part) and run the detection program on your (fixed location) server. But for that see my previous posting, BT and servers don’t really work well with each other.

Thanks so much for clarification.


I want show my way of presence detection. I build myself a plug board to detect if a certain key is plugged in. The plugs are standard audiojacks in which i soldered a resistor. Then I have a another resistor so I get a voltage divider and measure the analog voltage between the resistors. To read more than one jack I’m switching between the different plugs with some FETs (probably working with transistors as well, just had FETs liing arround) where every jack has its own resistor Value and therefore a different measured voltage. After measuring the voltages I send the information back to openhab via MQTT.



Cool idea! :sunglasses:

I like it but I don’t like the idea of the audio jacks too fiddling maby the same style thing using a wireless protocol NFC maby

This can be done with iButton and 1wire with magnetic contacts as well

Great :slight_smile: Please share your Stuff.

construction parts
wiring diagram
Software code

I put the code and some further explanations to github:
Construction parts are quite simple: audiojack male, audiojack female, and differnte values of resistors. Thats it.

To decode the MQTT-Message I used testBit like in the example posted here

1 Like

Hi all,

Well, I am new to OH but I am learning :slight_smile:

What about the following idea? I wouldn’t say that this is going to be complicated to do, but help people having fun with OH.

Let’s say that people using OH have the OH app installed on their phones, mostly maybe. This app on the phone might have one network service discovery mechanism implemented, possibly multicast based, and the same service must also be implemented on the server side. If this was available, both OH server and the client device would instantly know of each other’s presence on the same network.

What do you think?

You don’t need for your idea OH application. Just use network binding, and assign one IP in your router to your phone’s MAC address and your’re done. However this solution is uncertain as many of the phone sleeps and durig that wifi is turned off when you do not use it or teher is no application what wakes it up. But in that case the battery will run out faster. Presence detection is a combined issue. This is one good idea, but stil not waterproof. Best ones are based on facial recognition, network and gps combination.

Hi, you are right @kovacsi2899

I am using network binding for devices that I have with static addresses. But what if, because of any reason, you want to detect presence of the mobile which has dynamic IP assigned?

You can set up in your router that certain MAC address will get always same IP. Means it is a dynamic IP from device point of view, but it always receives the same IP. If you have more wifi devices it should be in AP or Mesh network set up and in that case your main router manages the IP assignment.

That is ok, and I have several devices with reservations in dhcp, but that is not relevant here.
My question about the app and NSD service implemented in it would open some additional possibilities if implemented, not only the presence detection, like sending mobile id(s) and other stuff to OH server, guest(s) presence detection…