Community discussions

MikroTik App
 
akkurad
just joined
Topic Author
Posts: 5
Joined: Sun Mar 17, 2024 8:15 pm

Reprogramming WPS button to execute scripts

Sun Mar 17, 2024 8:40 pm

Hello!

I was wondering if there was any way to program the WPS button to run a script in RouterOS 7.14. This topic was already briefly touched on around 7 years ago here: viewtopic.php?p=615842

I know that the mode and reset buttons can be set to run scripts.
However, I would prefer to use the WPS button for this purpose, as I don't see myself using WPS often enough to need a dedicated physical button. Currently, I even have WPS disabled, so this button is completely useless.
It also sits easily accessible (and illuminated!) right on top of my device (hap ax^3) when it is mounted to the wall, while the mode and reset buttons are at the bottom, making them harder to access.

I realize that this is kind of an unnecessary thing to worry about, but it just bugs me that my device has the perfect button I'm looking for, but I cannot use it!

Regarding the script I want it to execute, it would just be a simple script to toggle WIFI interfaces on and off (I already got that working).
 
infabo
Long time Member
Long time Member
Posts: 695
Joined: Thu Nov 12, 2020 12:07 pm

Re: Reprogramming WPS button to execute scripts  [SOLVED]

Sun Mar 17, 2024 9:42 pm

/system/routerboard/wps-button
 
User avatar
diamuxin
Member
Member
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Reprogramming WPS button to execute scripts

Sun Mar 17, 2024 11:59 pm

/system routerboard wps-button
set enabled=yes on-event=":if ([system leds settings get all-leds-off] = \"never\") do={\r\
    \n/system leds settings set all-leds-off=immediate \r\
    \n} else={\r\
    \n/system leds settings set all-leds-off=never \r\
    \n}"
 
akkurad
just joined
Topic Author
Posts: 5
Joined: Sun Mar 17, 2024 8:15 pm

Re: Reprogramming WPS button to execute scripts

Mon Mar 18, 2024 9:57 pm

/system/routerboard/wps-button
This works! Thank you. For some reason, I figured this wouldn't work because there is no official documentation on it, but I tested it with this
/system routerboard wps-button set enabled=yes on-event=":log \"WPS button pressed\""
and it behaved as expected.

I hope this will at least help people looking for a solution for this issue in the future by googling.

Who is online

Users browsing this forum: No registered users and 4 guests