Track users connectivity to Wi-Fi using OpenWRT

How to know what time a person reached or was at home? One of the simplest method is to track when the user was connected to Wi-Fi. This could be accomplished easily if you have OpenWRT firmware on your router.

Motivation

Initially I wanted to gather statistics on ping times on my Wi-Fi network. I later realised that I could leverage on that data to tell me if a person is at home, assuming his/her device connects to home Wi-Fi. There is no need for me to give example use cases of why this data might come in handy. I will leave that to your best imagination.

Setup

Pre-requisites

The tutorial that I am sharing here assumes that you have OpenWRT.

Install Collectd

Collectd is the tool for collecting data on your router, such as CPU, RAM, network usage, ping statistics, etc.

To install, execute the following:

opkg update
opkg install collectd
opkg install collectd-mod-ping
opkg install luci-app-statistics

Reload LuCI and you should now see Statistics menu in between Network and Logout.

Navigate to Statistics > Setup. Then Network plugins > Ping. Enable the plugin. Add the IP address of devices to monitor separated by a space.

Example of 3 devices to monitor:

192.168.1.110 192.168.1.120 192.168.1.130

Save & Apply and data should soon be appearing on Statistics > Graphs.

Example graph:

OpenWRT Collectd Ping Statistics

Caveat

LuCI Statistics does not provide much flexibility in filtering data to show. You will have to explore using rrdtool command line tool for that. Otherwise, the simpler way to go is to track fewer devices so that there is less noise on the graph.