The Approximate Library makes it easy to identify a close by device and then watch its traffic. In this video the ESP32 reads the Google Home's MAC and IP addresses; with this information it forms a pair and the LED now flashes to show the network traffic.

This behaviour can be written in just a few lines of code (the use of the OLED display has been omitted for clarity):

#include <Approximate.h>
Approximate approx;

const int LED_PIN = 22;

char *pairedMacAddress = new char[18];
bool paired = false;

void setup() {
    pinMode(LED_PIN, OUTPUT);

    digitalWrite(LED_PIN, HIGH);
    if (approx.init("MyHomeWifi", "password", /*ipAddressResolution*/ true)) {
        digitalWrite(LED_PIN, LOW);
        approx.setProximateDeviceHandler(onProximateDevice, APPROXIMATE_PERSONAL_RSSI);
        approx.setActiveDeviceHandler(onActiveDevice, /*inclusive*/ false);

void loop() {

void onProximateDevice(Device *device, Approximate::DeviceEvent event) {
    switch(event) {
        case Approximate::ARRIVE:
            paired = true;


        case Approximate::DEPART:
            paired = false;

void onActiveDevice(Device *device, Approximate::DeviceEvent event) {
  if(paired) {
    int payloadSizeByte = device -> getPayloadSizeBytes();
    digitalWrite(LED_PIN, HIGH);
    digitalWrite(LED_PIN, LOW);

As well as watching a device, knowing its MAC and IP addresses, we can also interact with it - like a universal remote control. Approximate makes it easy to identify devices by manufacturer (OUI) and then write different behaviours for each:

Approximate works with 2.4GHz WiFi networks, but not 5GHz networks - neither ESP8266 or ESP32 support this technology. This means that devices that are connected to a 5GHz WiFi network will be invisible to this library. Approximate will not work as expected where MAC address randomisation is enabled - the default iOS setting.

The Three WiFi Meters project makes extensive use of the Approximate Library.

All these examples and more are fully documented here: