No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ivan Pavlina 78ae123c0f Point manifest URLs at the renamed repository
The repository is ha-mikrotik-presence; the integration domain stays
mikrotik_presence.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 16:45:46 +02:00
custom_components/mikrotik_presence Point manifest URLs at the renamed repository 2026-09-10 16:45:46 +02:00
.gitignore Add MikroTik Presence integration 2026-09-10 16:43:16 +02:00
README.md Add MikroTik Presence integration 2026-09-10 16:43:16 +02:00

MikroTik Presence

A small Home Assistant integration that answers one question: is this device on the home network right now? It reads the RouterOS REST API and creates one device_tracker entity per device you configure. No traffic counters, no port switches, no firmware update entities.

Why not match on the MAC address

Modern phones rotate their Wi-Fi MAC address. When that happens the router hands out a new DHCP lease and any MAC-keyed tracker goes stale forever. The DHCP host name (option 12) is the device name the phone announces and it survives the rotation, so it is the primary matcher here. MAC addresses are still accepted for devices that never rotate, such as wired hosts.

Presence sources

A device counts as present when any of these is true, checked in this order:

  1. Its MAC is in the wireless registration table (associated to an access point).
  2. It holds a bound DHCP lease that the router has seen recently.
  3. It has a complete ARP entry in a live state (optional, on by default).

The result is held for consider_home seconds after the last positive check so a sleeping phone does not flap.

Setup

  1. Copy custom_components/mikrotik_presence into your Home Assistant config.
  2. Restart Home Assistant.
  3. Add the integration and point it at the router. A read-only RouterOS user is enough. The www service must be enabled for the REST API.
  4. Add one tracked device per person. Fill in the DHCP host name, for example S23-korisnika-Maja. Wildcards such as galaxy-* work.

To find the host names, run this on the router:

/ip/dhcp-server/lease/print detail

Requirements

RouterOS 7.x with the REST API reachable, and no extra Python packages.