Hey all,
I won a cAP AC at our NZ MUM yesterday, and instantly knew what I wanted to do with it. At home I have a guest network, which currently I need to manually enable and disable when I have friends over (I run it unsecured). I’ve been wanting to hook up an Arduino or something with a switch to enable/disable it, but then the cAP with its big button fits the bill perfectly!
Firstly, put this code into your terminal to get the button to lookup the correct script:
/system routerboard mode-button
set enabled=yes on-event=guest-wifi
Now here’s the main script (feel free to remove the log lines if you don’t need them):
:local gueststate [/interface wireless get [find name="guest"] disabled];
:if (gueststate = yes) do={
:log info "enabled"
/interface wireless set [find name="guest"] disabled=no
/system leds set [find leds="user-led"] type=on
} else={
:log info "disabled"
/interface wireless set [find name="guest"] disabled=yes
/system leds set [find leds="user-led"] type=off
}
Make sure you call the script “guest-wifi”. You’ll also need to name your wireless interface “guest” (or edit the above code).
It also turns the LED on and off with the interface, which is pretty cool. Although it doesn’t do this if you manually enable/disable the interface without the script.
In the future I want to get the LED to respond to the actual state of the interface, and then my next step is I want to use it to enable/disable the guest WiFi on my existing/remote wireless router (helpful if you have your main AP in a different room and you just want to use the cAP as a control button - overkill, I know). Anyway, these are for another day.
Enjoy!