i looking for a way to check if a MAC address is connected by WiFi and when the last activity was, preferably via Python.
I want to use it as an alive monitor for IOT devices (like ESP32) and for Presence detection of family member (home/away via their smartphones).
Can somebody help me on the way please?
I have found librouterOS that facilitates commands and I think maybe via arp list or torch I may have success.
Preferably a system that is “energy friendly” on de remote device (eg no ping …).
ip_0 = ‘router ip address’
user_0 = ‘username’
pass_0 = ‘password’
com_0 = ‘ip dhcp-server lease print’ #com_0 = ‘ip dhcp-server lease print where mac-address=XX:XX:XX:XX:XX:XX’ # Add the MAC address of the device
com_1 = ‘ip arp print’ #com_1 = ‘ip arp print where mac-address=XX:XX:XX:XX:XX:XX’ # Add the MAC address of the device
All you ask for I have setup using Mikrotik->Splunk monitor.
To see if some is only, I look at the DNS request, since this is going on nearly all the time when a user is connected.
This way I pick up both cabled and wifi clients.