||4 years ago|
|README.md||4 years ago|
|ddwrt.items||4 years ago|
|ddwrt.sh||4 years ago|
|fritzboxtr064.items||4 years ago|
|presence.items||4 years ago|
|presence.map||4 years ago|
|presence.rules||4 years ago|
Detect a person with his/her smartphone entering or leaving the wireless home network.
Using the network binding does not do the job for Android and iOS based devices as these devices enter deep sleep at some point and are not pingable anymore and would appear as offline.
In my special case I need to check the devices on a Fritzbox 7490 (FRITZ!OS 6.93) and two DD-WRT based Atheros routers (TP-Link Archer C7, DD-WRT v3.0-r33525 std 10/17/17) I use as additional access points to cover the whole house.
If the device is logged into the wifi on one of the three access points it is marked as online in the network. If it is offline on all three access points it is marked as offline on the network after three minutes (I wait a bit as I noticed that openHAB needs some time to see the device on another access point if it is roaming around in the house). If both devices go offline the overall presence is OFF, too. I only use the global presence item for my rules (like turning down temperatures of the heaters), not the personal items for each person as I do not have any usecases (yet).
For getting data from the Fritzbox I use the Fritzbox TR064 Protocol Binding which works for a bunch of different Fritzbox models.
The data from the DD-WRT devices is sent by a script and REST to openHAB. I used these howtos but needed to change some details as it was not working here.
- openHAB Fritzbox TR064 Binding zur Anwesenheitserkennung
- DD-WRT Presence Detection with ARP for openHAB
- openHAB Presence Detection with a DD-WRT Router
The main difference here is that I kicked out user and password (as this cannot be set in openHAB 2.0/2.1 at the moment) and also I changed the command which gets the MAC addresses for all online devices. wl_atheros assoclist gets all online devices from all ath wireless (ath0 and ath1 for 2.4 and 5.0 wifi in my case) interfaces, which is exactly what we want here.
- ddwrt.items: Put this file into your /etc/openhab2/items directory and modify it for your specific setup.
- ddwrt.sh: Modify the content of this file for your specific setup and put it in your DD-WRT Startup Script (if you already have one please paste it under what you already have) and save it like described here and here. If you have two DD-WRT devices like me then you need to modify the script again for the second router (DDWRT1 to DDWRT2). I left two other devices in this script, but I only use the first two devices for presence detection. Leave these devices as well or remove them (then you need to change some other parts of the script, too).
- fritzboxtr064.items: Put this file into your /etc/openhab2/items directory and modify it for your specific setup (don't forget the MAC addresses for your devices). Don't forget to install/activate the fritzboxtr064 binding first and prepare the Fritzbox like described here.
- presence.items: Put this file into your /etc/openhab2/items directory and modify it for your specific setup.
- presence.map: Put this file into your /etc/openhab2/transform directory and modify it for your specific setup.
- presence.rules: Put this file into your /etc/openhab2/rules directory and modify it for your specific setup.