Page 1 of 1
hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 9:35 am
by freemannnn
anyone notice that newer haps have this "mode" button? could not find any info anywhere.
what is does? maybe wps? cap?
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 10:01 am
by normis
You can configure the button in RouterOS to do anything you want. It can launch scripts.
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 12:49 pm
by sid5632
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.
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 12:56 pm
by normis
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
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 4:00 pm
by sid5632
/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).
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 4:13 pm
by sid5632
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>
Re: hap lite classic "mode" button?
Posted: Fri Nov 10, 2017 4:15 pm
by normis
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.
Re: hap lite classic "mode" button?
Posted: Mon Dec 04, 2017 10:58 am
by paralichko1
Hi,
i have upgraded my HapLite to 6.41rc56, and again this test scenario doesn't work:
Br
Gabriel
Re: hap lite classic "mode" button?
Posted: Thu Feb 08, 2018 12:42 pm
by wurstel
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
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>
Re: hap lite classic "mode" button?
Posted: Thu Feb 08, 2018 12:55 pm
by wurstel
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
hi
i try but doesn't work. I try too with other script but still no work.
i use current version 6.41.1
Re: hap lite classic "mode" button?
Posted: Sun Apr 29, 2018 1:01 pm
by nickac
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;
}
Re: hap lite classic "mode" button?
Posted: Sun Apr 29, 2018 1:10 pm
by nickac
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;
}
Re: hap lite classic "mode" button?
Posted: Sat Apr 13, 2019 10:49 pm
by ForPost
Hi!
Can you help me with the same script but for disable/enable only one of the wireless interfaces? ex. wlan2
Thanks a lot.
Re: hap lite classic "mode" button?
Posted: Sun Jun 16, 2019 12:30 pm
by Jotne
Can you help me with the same script but for disable/enable only one of the wireless interfaces? ex. wlan2
This should do:
:if ([/interface get wlan2 disabled ]=false) do={
/interface wireless disable wlan2} else={
/interface wireless enable wlan2}
Re: hap lite classic "mode" button?
Posted: Sun Jun 16, 2019 12:43 pm
by Jotne
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
Mode-Button.jpg
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?
Re: hap lite classic "mode" button?
Posted: Tue Jun 18, 2019 11:55 am
by eworm
Script shows up in red, is that correct?
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.
Re: hap lite classic "mode" button?
Posted: Tue Jun 18, 2019 2:47 pm
by Jotne
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.
Re: hap lite classic "mode" button?
Posted: Tue Jun 18, 2019 4:03 pm
by eles
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
Re: hap lite classic "mode" button?
Posted: Tue Jun 18, 2019 4:51 pm
by eworm
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?
Re: hap lite classic "mode" button?
Posted: Sun Jul 12, 2020 8:03 pm
by yresquirol
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 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:R ... et_buttons
Re: hap lite classic "mode" button?
Posted: Sat Sep 25, 2021 4:08 pm
by Triforce
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 ...[/quote]
Thank you very much!
It is working perfectly!