Community discussions

MikroTik App
 
freemannnn
Forum Veteran
Forum Veteran
Topic Author
Posts: 700
Joined: Sun Oct 13, 2013 7:29 pm

hap lite classic "mode" button?

Fri Nov 10, 2017 9:35 am

anyone notice that newer haps have this "mode" button? could not find any info anywhere.
what is does? maybe wps? cap?
You do not have the required permissions to view the files attached to this post.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 10:01 am

You can configure the button in RouterOS to do anything you want. It can launch scripts.
 
sid5632
Long time Member
Long time Member
Posts: 553
Joined: Fri Feb 17, 2017 6:05 pm

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 12:49 pm

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.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 12:56 pm

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
 
sid5632
Long time Member
Long time Member
Posts: 553
Joined: Fri Feb 17, 2017 6:05 pm

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 4:00 pm

/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).
 
sid5632
Long time Member
Long time Member
Posts: 553
Joined: Fri Feb 17, 2017 6:05 pm

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 4:13 pm

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> 
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: hap lite classic "mode" button?

Fri Nov 10, 2017 4:15 pm

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.
 
paralichko1
just joined
Posts: 1
Joined: Mon Dec 04, 2017 10:56 am

Re: hap lite classic "mode" button?

Mon Dec 04, 2017 10:58 am

Hi,
i have upgraded my HapLite to 6.41rc56, and again this test scenario doesn't work:

Br
Gabriel
 
wurstel
just joined
Posts: 23
Joined: Thu Apr 13, 2017 7:04 pm

Re: hap lite classic "mode" button?

Thu Feb 08, 2018 12:42 pm

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> 
 
wurstel
just joined
Posts: 23
Joined: Thu Apr 13, 2017 7:04 pm

Re: hap lite classic "mode" button?

Thu Feb 08, 2018 12:55 pm

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
 
nickac
just joined
Posts: 2
Joined: Sun Apr 29, 2018 12:56 pm

Re: hap lite classic "mode" button?

Sun Apr 29, 2018 1:01 pm

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;
}
 
nickac
just joined
Posts: 2
Joined: Sun Apr 29, 2018 12:56 pm

Re: hap lite classic "mode" button?

Sun Apr 29, 2018 1:10 pm

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;
}
 
ForPost
just joined
Posts: 2
Joined: Thu Oct 18, 2018 10:21 pm

Re: hap lite classic "mode" button?

Sat Apr 13, 2019 10:49 pm

Hi!
Can you help me with the same script but for disable/enable only one of the wireless interfaces? ex. wlan2
Thanks a lot.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: hap lite classic "mode" button?

Sun Jun 16, 2019 12:30 pm

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}
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: hap lite classic "mode" button?

Sun Jun 16, 2019 12:43 pm

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?
You do not have the required permissions to view the files attached to this post.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: hap lite classic "mode" button?

Tue Jun 18, 2019 11:55 am

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.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: hap lite classic "mode" button?

Tue Jun 18, 2019 2:47 pm

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.
 
eles
just joined
Posts: 14
Joined: Tue Jun 18, 2013 6:20 pm

Re: hap lite classic "mode" button?

Tue Jun 18, 2019 4:03 pm

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
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: hap lite classic "mode" button?

Tue Jun 18, 2019 4:51 pm

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. :wink:

Mikrotik, how about showing valid script names in a different color than red?
 
User avatar
yresquirol
just joined
Posts: 8
Joined: Sun Oct 21, 2018 8:15 pm
Location: Cuba

Re: hap lite classic "mode" button?

Sun Jul 12, 2020 8:03 pm

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
 
Triforce
just joined
Posts: 2
Joined: Wed Sep 22, 2021 9:47 pm

Re: hap lite classic "mode" button?

Sat Sep 25, 2021 4:08 pm

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!

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], friend2809, Laxity, loloski, mkx, qatar2022 and 72 guests