anyone notice that newer haps have this “mode” button? could not find any info anywhere.
what is does? maybe wps? cap?
You can configure the button in RouterOS to do anything you want. It can launch scripts.
How?
And what does it do by default? Anything or nothing?
Saying something can be done, but without at least giving a start as to how, is not very helpful.
It does nothing by default.
/system script add name=test-script source={:log info message=("1234567890");}
/system routerboard mode-button set on-event=test-script
/system routerboard mode-button set enabled=yes
Thanks, but is this documented anywhere?
There is nothing about this button on the piece of paper that comes in the box with the hardware.
There is no mention of the “routerboard” sub-page under System on the Wiki.
I tried searching for “mode-button” and drew a blank there as well.
Winbox doesn’t give access to this either.
It’s no wonder people struggle is it?
This is the most frustrating thing about your products/software - missing or incomplete information/documentation.
I could give you several examples of things missing from the Wiki (well I could if I’d bothered to make notes - as it was I just grumbled to myself and gave up).
And even more annoying, I tried adding your example code to test. The log told me the config. had been modified, but pressing the button doesn’t generate the expected log line.
In addition, nothing is reported back when you try and query the config. you have just set:
[admin@...] /system routerboard mode-button> pr
[admin@...] /system routerboard mode-button> exp
# nov/10/2017 14:08:52 by RouterOS 6.41rc52
# software id = xxxx-xxxx
#
# model = RouterBOARD 941-2nD
# serial number = xxxxxxxxxxxx
[admin@...] /system routerboard mode-button>
The model with the button hasn’t been even announced yet, you have received an early stock unit, so the feature is not documented yet.
You can either choose to ignore it for now (since you didn’t even know the unit will have such a button, when you ordered it), or upgrade to the latest RouterOS v6.41RC release when it comes out, and experiment with it until manual is updated.
Hi,
i have upgraded my HapLite to 6.41rc56, and again this test scenario doesn’t work:
Br
Gabriel
doesn’t work too.
how can i find command for doinf other tests?
i would like to use it for power on/off wlan card.
Thanks
hi
i try but doesn’t work. I try too with other script but still no work.
i use current version 6.41.1
The mode-button works for me. Example with script, which set all wlan off or on (depending of past state wlan1)
/system routerboard mode-button
set enabled=yes on-event=wlan_on_off
# script
/system script
add name=wlan_on_off owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":local i\r\
\n:if ( [/int wir get 0 disabled ] = true ) do={\r\
\n :foreach i in= [ /int wir find ] do={ :int wir enable \$i };\r\
\n } else={\r\
\n :foreach i in= [ /int wir find ] do={ :int wir disable \$i };\r\
\n :int wir disable \$i;\r\
\n}\r\
\n"
or script manually:
:local i
:if ( [/int wir get 0 disabled ] = true ) do={
:foreach i in= [ /int wir find ] do={ :int wir enable $i };
} else={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
:int wir disable $i;
}
Hi, the mode-button works for me. I have script for disable/enable all wlan (depending of previous state wlan1)
/system routerboard mode-button
set enabled=yes on-event=wlan_on_off
# script
/system script
add name=wlan_on_off owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":local i\r\
\n:if ( [/int wir get 0 disabled ] = true ) do={\r\
\n :foreach i in= [ /int wir find ] do={ :int wir enable \$i };\r\
\n } else={\r\
\n :foreach i in= [ /int wir find ] do={ :int wir disable \$i };\r\
\n :int wir disable \$i;\r\
\n}\r\
\n"
or script manually
:local i
:if ( [/int wir get 0 disabled ] = true ) do={
:foreach i in= [ /int wir find ] do={ :int wir enable $i };
} else={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
:int wir disable $i;
}
Hi!
Can you help me with the same script but for disable/enable only one of the wireless interfaces? ex. wlan2
Thanks a lot.
This should do:
:if ([/interface get wlan2 disabled ]=false) do={
/interface wireless disable wlan2} else={
/interface wireless enable wlan2}
PS I can not get the mode button to work on hAP Lite.
OS = 6.44.3 RB941-2nd
Tested various script and also this:
/system script add name=test-script source={:log info message=("1234567890");}
/system routerboard mode-button set on-event=test-script
/system routerboard mode-button set enabled=yes
No script is run (counter at 0), nothing in the logs.
Script shows up in red, is that correct?
PS Why can I not se this in Winbox/Web?
The content of this field is displayed with syntax highlighting. Things become colored if you use something like:
/system routerboard mode-button set on-event="/system script run test-script;" enabled=yes
As a fallback RouterOS tries to run a script with given name. It’s the same for the scheduler… Just giving a script name makes on-event appear in red.
That explain some. Having this in gui would help.
Bu still button does not do anything on my hap lite.
[admin@MikroTik] > /system script print
Flags: I - invalid
0 name="test-script" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
dont-require-permissions=no run-count=0 source=:log info message=("1234567890");
[admin@MikroTik] > /system routerboard mode-button set on-event="/system script run test-script;" enabled=yes
[admin@MikroTik] > /system routerboard mode-button print
enabled: yes
on-event: /system script run test-script;
[admin@MikroTik] > :log info message=("1234567890")
Running script manual works fine. 1234567890 shows up in the log, but not when using the button.
I don’t think you need to do
/system routerboard mode-button set on-event=/system script run your-script
In my case it worked just giving the script name directly to the on-event= like so
/system routerboard mode-button set on-event=your-script
Yes, that’s enough for things to work. The above was my example to explain why things are shown red and how to work around.
Mikrotik, how about showing valid script names in a different color than red?
Hi normis.
On the wiki, the “reset-button” functionality is documented and I quote: “Reset button additional functionality is supported by all MikroTik devices running RouterOS”. I have tried to make use of this functionality taking the examples shown and it has not worked for me, I have tried different RouterBOARDS and versions of routerOS. In all attempts when I restart the RouterBOARD, that configuration disappears, as if I had never modified anything.
Can you make a clarification in this regard?
https://wiki.mikrotik.com/wiki/Manual:RouterBOARD_settings#Mode_and_Reset_buttons