Prototype for a "friend doorbell", dispatching push notifications when known devices connect to the local network.
NetTrack is a thin wrapper over a couple shell commands.
- pings the broadcast ip for the current subnet:
ping -c 1 192.168.1.255
- checks the arp cache:
arp -a
- Diffs the arp table results against the last check of the arp table, filtering out incomplete/blacklisted devices.
- Sends notifications for any new arrivals.
NetTrack is available in docker. Access to the host network is required.
docker pull matthewoden/net_track:latest
See the provided ./docker-compose.yml file for an example docker configuration.
The elixir release can be run without docker, if desired.
MIX_ENV=prod mix release
# using the default release location:
_build/prod/rel/net_track/bin/net_track migrate
_build/prod/rel/net_track/bin/net_track foreground
NetTrack uses Postgres for blacklist/activity persistance, and expects the database and user to exist on the postgres instance prior to deployment.
NetTrack uses ifttt.com for push notifications. You'll need an IFTTT account, and enable the following services:
Make note of your webhook key, as we'll use that later.
The following environment variables can be used to configure your NetTrack instance
NETTRACK_DB_USER #your postgres user
NETTRACK_DB_PASSWORD #your postgres password
NETTRACK_DB_DATABASE #your postgres database
NETTRACK_DB_HOST #your postgres host
IFTTT_WEBHOOK_KEY #your IFTTT webhook token
NETTRACK_DB_PORT #your postgres port, defaults to 5432
TODO:
- add debounce period for disconnects within a set period
- add UI layer for adding nicknames, blacklists
- add option to use sqlite for persistance
- add option to not send notifications if certain devices are absent
- add option to take a list of IFTTT endpoints for notifications
- add API layer to enable hooks into homebridge