Triggers for wireless client events [solved]

Is there an infrastructure in either wpad or OpenWRT/LEDE somewhere to configure a trigger to run when a wireless client connects or disconnects?

I have searched extensively throughout the documentation and Google and have come up with nothing. I find it surprising that there is nothing available and I hope I am just missing something.

You could listen with a bash script to the log and filter only that event with your mac and disassociated/associated.

Example:
logread -e 'associated' -f

This command will listen to new log messages that include associated, so you will get only connect and disconnect of wifi clients. I´m not that good in regex, but you could extend this example to also include your device mac address...

Probably there will be a better solution, but don´t think there exist any event based implementation for connect and disconnect of wireless clients...

not that I know of, I would watch the logs and take action when the appropriate
log event happens. You can do this in rsyslog (and probably syslog-ng) or via
some other log watching tool like SEC

hostapd utils

1 Like

Ah! Awesome! Thanks for the tip. I'll check out the utils package.

That worked perfectly. Thanks!

For those curious I have "presence detection" with this method with Domoticz. Most methods people setup a cron job or other automated job that queries every so often for the status of clients. Using hostapd_cli is much more efficient.

1 Like

Please add [solved] to your thread title if you are happy with the answer. (pencil right after the title)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.