Sorry to resurrect an ancient thread, but after upgrading my AR300M16 (Shadow) to (beta) firmware 4.3.6 it looks like the way the switch is handled has changed and is now far better and more flexible. A quick forum seach didn’t find a reference to this so thought it worth posting…
Each selectable switch function is now an individual script within the /etc/gl-switch.d/ directory. Adding a new script to the directory will add it to the dropdown list of functions in the
SYSTEM → Toggle Button Settings
menu item. Look at the supplied openvpn.sh and wireguard.sh scripts for the basic calling conventions. So my very simplistic /etc/gl-switch.d/WiFi.sh script to activate / deactivate the primary WiFi AP via the switch is:
#!/bin/sh
action=$1
if [ "$action" = "on" ];then
uci set wireless.default_radio0.disabled='0'
uci commit wireless
wifi reload
fi
if [ "$action" = "off" ];then
uci set wireless.default_radio0.disabled='1'
uci commit wireless
wifi reload
fi
sleep 5
Easily amended to include the Guest SSID etc. List the installed WiFi interface names using
uci show wireless
The state will remain across reboots and is reflected on the Wireless UI panel, although won’t take account of changes made with the system down.
Much better and more straightforward than the old approach and easy to add further selectable switch functions.
V4.3.6 / OpenWrt 22.03.4 just squeezed onto the AR300M16 and working well so far!