i would like to automatically switch off the wifi after a certain time at night if no user is connected anymore.
I inserted the following code (which btw I found in this forum) in the “on event” field of a schedule task but it’s not working:
I also tried with “authenticated-clients” and “registered-clients” but no one is doing the job. I guess I have an error in the code , so I would be very thankful if someone who is familiar with the script language could give a look!
(btw: the task to switch on the wifi in the morning is working fine which the following line: /interface wireless enable wlan1)
I even tried with =1 (while I was the only connected) but no reaction
strangely (as it worked before!) this morning even the activation of the wifi did not work… morning for testing purpose then I set the interval to 1 minute and it worked. for my activation once a day I set the time to 09:00 and the interval to 00:00:00 as it is the 24 hours interval right?)
Regarding the other code line there is something fundamentally wrong or at least strange!
It’s only doing it’s job if I put a ! in front of the =0, so !=0 (or whatever other number), for example:
if ( [(/interface wireless registration-table print as-value count-only)] !=0 ) do={/interface wireless disable wlan1} else={}
this disables the wifi whenever I’m connected or not!
if ( [(/interface wireless registration-table print as-value count-only)] !=1 ) do={/interface wireless disable wlan1} else={}
so with value 1 while I’m connected alone on the wifi it should not disable right? but it does so…
did you make tests on your own? maybe a bug in the software somehow?
=0 : mean false or wireless registration table is empty
both are same
other solutions
<=0 : mean less or equal zero
!=0 : mean any number except zero
!=1 : mean any number except one