FIND (personalized indoor localization)

FIND

THE FRAMEWORK FOR INTERNAL NAVIGATION AND DISCOVERY

NOTE: these instructions have been updated for FIND version 3


FIND is an inhouse locator software to run on your Android mobile or other portable Linux device. A mobile to run FIND will detect WiFi access points in range and their signal strength that correlates with the distance to the access point. The set of signals can be compiled into a fingerprint which can be used to uniquely classify the current location of that device relative to the (immobile) set of WiFi APs in range.

You can extend the learnt data set at any time. Itā€™s not limited to a building or area.
You can use your mobile to learn your home, but also your workplace, school, supermarket, summer cottage or other favorite place youā€™re regularly staying at.
The only major requirement is to have stationary senders, so it might not work well in public places with many mobile users or cars if those provide a mobile (tethering) hot spot.
To get FIND to work with openHAB, you need at least a client and a FIND server.

FIND setup

The official FIND app client is available for Android only (sorry to iPhone users, but thereā€™s an Apple policy restriction). Search Play Store for ā€œfind hypercubeā€. Search for ā€œfind3ā€ to find the new app to only work with FIND v3 servers.

You do can find alternative download places for it such as here. Note that in order to install the .apk, you need to allow for ā€˜installation from unknown sourcesā€™ in your Android settings.
Same as with the enhanced app: I have not yet used Room+ yet so cannot confirm itā€™s working. Please let me know when youā€™ve tried it.

Alternatively, you can still run the Linux findclient binary on any fully accessible ARM hardware such as a Pi Zero. Thereā€™s a number of devices suggested on the FIND website.

Server side installation

If youā€™re running openHABian, thereā€™s a menu option to install the FIND3 server.
You can still run your own find server, but unlike the previous version, FIND 3 is really hard to setup manually. See install instructions at Setup Ā· FIND.
The passive monitoring feature has hardly been tested so be prepared to meet issues.
You will eventually also want to setup Nginx to proxy your connection to the API (and dashboard) through SSL so you can safely access from outside your LAN. Thatā€™s including API access it takes to learn a location.

Ensure JSON transformations are enabled in openHAB. When theyā€™re not, install the addon by adding it to the transformation line in services/addons.cfg or via the transformations category in PaperUI.

Configuration

Once installed, fire up the app and select a ā€˜familyā€™ name. The family usually means right that.
Technically it is a group of devices associated with a location you want to learn.
Weā€™ll reference what you enter here as YOURGROUP.
You can choose anything you want as long as thereā€™s no one else using this on the FIND server and you can have multiple ā€˜familiesā€™.
You can have multiple mobiles contribute to a family in the database on the FIND server, just use individual device names but the same group.

Use either http://openhab:8005/ for direct server access inside your LAN or https://openhab.my.domain:8003/ when youā€™ve setup Nginx to proxy access through your firewall.

Learning mode

Click to switch to ā€œLearningā€ and enter a location (room) name, then ā€˜Start Scanā€™. The app will connect to the server and start submitting fingerprints.
ā€˜Learnā€™ a room for 2 or 3 minutes and do no forget to click ā€˜stop scanā€™ before moving on to the next room. Move on and repeat the procedure in every room of your house you want FIND to cover.
You can access the server dashboard at http://openhab:8005/, enter your group name there. Use this to delete specific rooms if you feel thereā€™s a need because say recognition rate is bad. This can happen if a sender (WiFi access point) is being moved (note ā€˜sendersā€™ are mostly the APs of your neighbors, too, so you donā€™t get informed when they change).

Pi as a learning client

FWIW, you can also use any Linux machine as a learning client to ā€˜trainā€™ the FIND server by running the fingerprint client. It usually does not make much sense to use your PC or smart home server thatā€™s connected to mains power because you actually cannot move it, meaning you can just learn a single ā€˜locationā€™ (the room it is installed in). To use a phone is easier.
Still you might want to use a Pi running off a smartphone power bank for this.
If you encounter problems such as
14:27:35.615 scanWifi - INFO 008 Gathering fingerprint with '/sbin/iw dev wlan0 scan -u'
14:27:35.625 main - WARN 009 Scan failed, will continue after a rest
then try sudo ./fingerprint -iwlist.

openHAB2 integration

You need to use the MQTT v2 binding including to get the data from find3server into openHAB.
Check the section on generic things and channels.

  • create a broker thing to contain IP address of the broker. This can be 127.0.0.1 if you run mosquitto (or any other MQTT broker) on the same box as OH2.
  • create a ā€˜Genericā€™ type MQTT thing and name it Find3-YOURGROUP or similar, YOURGROUP being the ā€œfamilyā€ that you have setup the database for in FIND
  • create a ā€˜Stringā€™ type channel for each device you will be using for tracking
    Name it after the user this channel is meant to track and set MQTT state topic as YOURGROUP/location/DEVICE-X. Use DEVICE-X as the device name on this userā€™s phone.
    Use JSONPATH:$.location as the Incoming Value transformation.

Use e.g. mosquitto_passwd -b /etc/mosquitto/passwd openhab2 secret to create a MQTT user in the mosquitto password table.
You can also add authentication using curl -X PUT "http://<yourfindserverip>/mqtt?group=YOURGROUP then FIND will automatically manage the passwd file and restart mosquitto using a SIGHUP signal.
FIND3 publishes to mqtt channel ā€˜YOURGROUP/location/YOURUSERā€™.
You can watch mqtt events like this: mosquitto_sub -v -h mymqttserver -u mymqttuser -p secret -p 1883 -t 'YOURGROUP/location/#'.

openHAB items

You need to add the username of the person to track to get the information in.
The JSONPATH definition will pull in the current location.

In your location.items file, you simply need to reference the channel you created by name

String	mqttfind_johndoe			"John Doe is @ [%s]"	(All)	{ channel="mqtt:topic:aabbccddee:findjohndoe" }

FIND3 links

Main Page : FIND

Github : FIND

14 Likes

How do you find the battery drain on your phone if you run the app in the backgroud/fulltime?

Havenā€™t done any measurements but havenā€™t particularly noticed additional drain either. Note FIND does not need to actively ping anything (like e.g. GPS) but works passively. I suggest you run it without the server first and see for yourself.

Are there any other portible devices able to youse find? I have looked a while ago and only found srh like the photon. Instead of my phone (which i leave lying around all the time) i would like yousing some watch or similiar, or even sth the size of a bt beacon?

Well the findclient and fingerprint binaries run on every WiFi-enabled Linux ARM device, so you should be able to get a Pi0, nanoPi or similar. Thereā€™s a couple of pointers over at the FIND website.

1 Like

Hi, I want to use Pi as a leaning client. But it is not sending any finger print on server. I have created a cluster of 2 Pi devices
Can you please help me.

What sort of answer do you expect to a question with a lazily short explanation like this? Download and use the fingerprint client as described in the tutorial.

1 Like

looks good.

Hi @mstormi,
Iā€™m looking for some advice if I may -

I have a local find server up and running and everythign works great. I have experimented with different Android apps but none have fit my needs.

  • I tried the standard FIND app but as is well documented it does not update in the background.
  • I tried this app (also called FIND) on github, compiled and installed it but I also has issues updating in the background despite what is stated in this discussion. I made a comment on that discussion asking for clarification but have not yet had a reply.
  • I tried Room+ as also suggested in the github discussion linked above. I was unable to install it from google Play as the site displays ā€˜Sorry! This content is not available in your country yet.ā€™ - I am in the USA. So I sideloaded the APK found on another site (I checked that it was the latest version). I see that this app requires the ā€˜Proā€™ licence in order to enable background tracking - If I click the ā€˜Buy Proā€™ link in the app I get: ā€˜Error - The item you requested is not available for purchaseā€™. I emailed the author of the app but I have not had a reply.
  • I tried Zanzito and it works pretty well, even in the background and with the screen off. However it only updates every 30s and there is no way to configure this. I would like to have it update more frequently, and ideally have this interval controlled based on if the phone detects motion. I emailed the author of the app but I have not had a reply.

I have a moto x4 phone running Oreo.

The ideal app for me would:

  1. Report my fingerprint to my FIND server even when the app is in the background and the phone screen is off.
  2. Allow me to configure the interval that the app reports to the FIND server
  3. Add additional configuration that uses the phoneā€™s other sensors to detect movement and report more frequently. So a report interval when not in motion setting and a report interval when in motion setting would be ideal.

I realise such an app likely does not exist but I would appreciate your insight and suggestions in getting closer to this ideal.

Thanks

Iā€™m afraid I canā€™t comment on any alternatives because Iā€™ve only ever been using the original FIND app.

Please keep sharing your FINDings (hah!), Iā€™ll be happy to add them to the tutorial.

Yeah Iā€™m finding this app to be pretty useless. If itā€™s not going to update in the background it doesnā€™t serve a purpose other than another app. Going to be trying out some from the post above.

Hey @mstormi ,

maybe you can help me.

I donā€™t get my find server wired up with mqttā€¦

I am using openhabian and installed mosquitto and find server via openhabian-config.

mosquitto is running and working. I already control my sonoffs with it. FIND server is also running and via website i can see all the information.
But somehow i cant combine FIND and mqttā€¦

my item:
String mqttfindSimon "Simon is @ [%s]" (All) {mqtt="<[simonbroker:sasi/location/simon:state:JSONPATH($.location)]"}

mqtt.cfg
simonbroker.url=tcp://localhost:1883
simonbroker.user=openhabian
simonbroker.pwd=xyz

findserver is stating:
MQTT is setup!
Your password is: zCeAcu
You can listen on topic 'sasi/location/USER'

Can you help me? what am i missing? :confused:

Do a tail -F on /var/log/mosquitto/mosquitto.log, then sudo systemctl restart findserver.service
journalctl -u findserver.service should tell you findserver output, check what it is saying.
If that doesnā€™t show anything useful, check whatā€™s the parameters findserver runs with (use ps -ef), stop it (sudo systemctl stop findserver.service), cd to /var/lib/findserver and manually start it there. See what it tells you. Maybe it stops, maybe it tells you Not authorized (meaning mosquitto does not know the user findserver is trying to connect as).

Finally, connect to mosquitto using mosquitto_sub, track for topic ā€˜#ā€™ and start the FIND app.

I following this thread a awhile.
For my application it would be very helpful to know if persons arriving, are in the room or leaving.

But so far Iā€™m discouraged by the thing that the android client dosenā€™t update while in the backround.
To me it seems to restrict these nice idea verry much.

So Iā€™m interested in any ideas.

Iā€™ve updated the client section of the tutorial. In particular, see the download link for Room+.

I would like to request any of you to help by testing Room+ and the enhanced version of the original app.
Please share your findings here.

1 Like

I did a mini-review further up this thread on all of the apps I could find that integrate with FIND.

I see that @mstormi recommended you try a couple of apps - see my post for the issues I encountered with them, (and others), and please let us know if you are able to make any progress.

I think that Zanzito is our best bet but the author of the app seems to have either abandoned it or is busy with other projects. Maybe if a few of us contact him with similar requests it may convince him to pick it back up.

Iā€™ll give it a try - 30s update is quite acceptable.

I love this integration, but as someone else mentioned, itā€™s ridiculous trying to search for relevant topics with ā€˜FINDā€™ as a keyword :smiley: Iā€™ve been trying OpenHAB for a few weeks now, and after some steep learning curves, really like the potential this has for going into my new house in the near future. Iā€™m finding lots of helpful guidance within the forums, but Iā€™ve hit a speedbump recently - it seems that anytime I reboot my RPi (running openhabianPi 2.2.0 stable), the findserver.service looks like it starts up before mosquitto, since it doesnā€™t pull any events from MQTT, and gives me the following error via

journalctl -u findserver.service

Feb 03 07:37:44 openHABianPi findserver[336]: DEBUG: 2018/02/03 07:37:44 mqtt.go:48: Network Error : dial tcp [::1]:1883: getsockopt: connection refused

but connects fine if I restart the findserver.service (after everything else starts up).

I know how to create service dependencies in Windows, but still learning the nuances of linux. :slight_smile: Is there an easy solution to create this dependency? Any help is greatly appreciated - cheers!

Update: I edited findserver.service with systemctl edit and added the mosquitto dependency as:

[Unit]
Description=FIND internal positioning server
Documentation=https://www.internalpositioning.com/server/
After=mosquitto.service

Consistently now gets updates from mqtt upon boot, without connection error. Is there an OpenhabianPi setup script that should have this added, or is my case abnormal? I suppose it would depend on how mqtt was previously installed?

Thanks for raising. Iā€™ve made an openHABian PR of it.

1 Like