This app allows you to see who's currently in your office, flat etc. It works by looking for MAC addresses of devices connected to your router and sends this info to Firebase every few minutes. The web app connects to Firebase and displays up-to-date presence information.
-
Setup Firebase:
- Sign up for a free Firebase account and create a database.
- Go to "Security Rules" tab, click "Load Rules" button and select
rules.json
file. - Go to "Data" tab and add users. You can check required schema in
users.json
file. You can add them by hand or modifyusers.json
file and import it by clicking "Import JSON" button. - Take note of your database URL and its secret, which can be found in "Secrets" tab.
-
Run
npm install
to install all dependencies. -
Run
grunt setup
- this will ask you for your Firebase URL and its secret and generate the app intodist
folder. -
Setup scanning script on your server:
-
Copy generated
scan_macs_dist.sh
file to your server:scp scan_macs_dist.sh your-server:/usr/local/bin/scan_macs.sh
-
SSH to your server and change owner of the script:
sudo chown root:root scan_macs.sh
-
Setup cron by running
sudo crontab -e
. It should be ok to run the script every minute:* * * * * /usr/local/bin/scan_macs.sh
NOTE: The bash script uses
curl
andnmap
commands, so make sure you've got them installed on your server. -
-
Open
dist/index.html
file in your favorite browser and you're done!
The configuration is saved into config.json
file. You can change your database URL or authentication token there and then run grunt build
to regenerate the app using the new configuration.
The web app doesn't need any server - once you generate it you can simply open dist/index.html
file in your browser and it will work.
However, you'll probably want to host it somewhere, so that it's available for others too. You can use e.g. GitHub Pages for that. To do it, fork this repo and run grunt setup deploy
. You can also host it on a custom domain - just provide custom_domain
during setup
task.
Presence is released under the MIT License.