Skip to content

Instantly share code, notes, and snippets.

@sebastian13
Last active December 17, 2021 11:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sebastian13/5655efab2b51f0f3572352acbb640c48 to your computer and use it in GitHub Desktop.
Save sebastian13/5655efab2b51f0f3572352acbb640c48 to your computer and use it in GitHub Desktop.
Script to enable & disable wifi on a Mikrotik cAP Access Point managed by a CAPsMAN using the Mode Button
:log info message=("mode button was pressed");
:local i
:if ([/int wir cap get enabled] = true) do={
/interface wireless cap set enabled=no;
:global SlackMessage "Mode button was presssed. CAP is now disabled.";
:if ( [/int wir get 0 disabled ] = false ) do={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
}
} else={
/interface wireless cap set enabled=yes
:global SlackMessage "Mode button was presssed. CAP is now enabled.";
}
/system script run message2slack
:log info message=("mode button was pressed");
:local i
:if ([/int wir cap get enabled] = true) do={
/interface wireless cap set enabled=no;
:if ( [/int wir get 0 disabled ] = false ) do={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
}
} else={
/interface wireless cap set enabled=yes
}
:if ([/int wir cap get enabled] = true) do={
/interface wireless cap set enabled=no;
:if ( [/int wir get 0 disabled ] = false ) do={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
}
}
:if ( [/int wir cap get enabled ] = false ) do={
/interface wireless cap set enabled=yes
}
@luisqp66
Copy link

Thanks for the code. But how you actually use it ?
I have a hex S router with cAP lite and would like to use mode bouton to turn on and off the wifi.
I would appreciate any help on how to implement this. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment