Community discussions

MikroTik App
 
Kobe14
just joined
Topic Author
Posts: 20
Joined: Tue Oct 14, 2014 5:15 am

Drop inactive hotspot devices after x minute

Mon May 09, 2022 8:38 am

Hi, i'm currently running mikrotik hotspot + unifi AP.
I'm using unifi AP + home asssitant to trigger several automations based a number of active hotspot clients.

The issue that i'm facing is that unifi AP also lists clients that aren't authenticated in their active clients list. E.g :
User A, B, C
User A and B logged in and authenticated.,
User C only connects to wifi but not authenticated.
The Unifi integration in home assistant would count this as 3 active clients.
And this false positive messes up the automations.

So i was wondering if with scripting we could somehow drop the user C from the list after the predetermined time has passed with above scenario?
Mikrotik couldn't do this.. not even with login timeout option.
 
Kobe14
just joined
Topic Author
Posts: 20
Joined: Tue Oct 14, 2014 5:15 am

Re: Drop inactive hotspot devices after x minute

Thu May 12, 2022 3:35 pm

Ok after digging deeper, apparently i need to query "A" flagged clients on ip > hotspot > hosts
Question is,
is this even possible from API standpoint to query single flag on a multi flagged client?
e.g an authorized client would be flagged as H&A since they are also DHCP.
what would be the API syntax for this? Cant find anything about this in the docs.
 
afuchs
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Wed Jul 03, 2019 11:10 am

Re: Drop inactive hotspot devices after x minute

Thu May 12, 2022 4:17 pm

I am not an expert in Scripting but with
[/ ip hotspot host print where authorized 

you get a list of all authorized and with
[ /ip hotspot host print where !(authorized )
[
of all not authorized hosts.
 
Kobe14
just joined
Topic Author
Posts: 20
Joined: Tue Oct 14, 2014 5:15 am

Re: Drop inactive hotspot devices after x minute

Thu May 12, 2022 6:26 pm

I am not an expert in Scripting but with
[/ ip hotspot host print where authorized 

you get a list of all authorized and with
[ /ip hotspot host print where !(authorized )
[
of all not authorized hosts.
Thanks, a step to the right direction at least.
I forgot to mention, instead of dropping the illegal client, i'm gonna query for the number authorized client instead for a cleaner approach.
I'm gonna be using python API, so any idea the API equivalent for this CLI code?
[/ ip hotspot host print where authorized 
Also, i've tried
/ ip hotspot host print where authorized count-only  
but it doesn't work, what if i want to count it instead?

Who is online

Users browsing this forum: No registered users and 4 guests