Hello dear,
for the next firmware version (MT3000 or other products) it’s possible add for the side switch/toggle the WiFi ON/OFF feature?
For now I see only VPN on/off for this switch.
THANK YOU!
Hello dear,
for the next firmware version (MT3000 or other products) it’s possible add for the side switch/toggle the WiFi ON/OFF feature?
For now I see only VPN on/off for this switch.
THANK YOU!
Here is a similar topic:
Here’s a ‘modernized’ version to account for dual radio devices.
root@GL-AXT1800:~# cat /etc/gl-switch.d/Wi-Fi.sh
#!/bin/sh
# 2023-07-25
# /etc/gl-switch.d/
# uci show wireless
# source: https://forum.gl-inet.com/t/feature-req-wifi-on-off-with-side-switch/2896/41
action=$1
if [ "$action" = "on" ]; then
uci set wireless.default_radio0.disabled='0'
uci set wireless.default_radio1.disabled='0'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "radios enabled"
fi
if [ "$action" = "off" ]; then
uci set wireless.default_radio0.disabled='1'
uci set wireless.default_radio1.disabled='1'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "radios disabled"
fi
exit 0
See the following for a primer on how to install scripts onto your device (if needed):
I have made adjustments to the script to consider the current status of both 2.4GHz (2g) and 5GHz (5g) WiFi connections.
For example, if I use only the 5g connection, the script ensures that toggling the WiFi on will enable only the 5GHz connection, not both.
Tested with the GL-MT3000 / Beryl AX.
You can customize the default settings to specify a different file or set the default status for both 2g and 5g WiFi connections.
#!/bin/sh
# Default Settings
# File to save the wifi default status
wifi_default_status_file="/etc/wifi_default_status"
# If the wifi default status file is not (yet) available then use these defaults
# 0 = enabled, 1 = disabled
wifi2g_default_disabled=0
wifi5g_default_disabled=0
action=$1
if [ "$action" = "off" ]; then
# Get the default status before disabling
wifi2g_default_disabled=$(uci get wireless.wifi2g.disabled)
wifi5g_default_disabled=$(uci get wireless.wifi5g.disabled)
# Save the default status to the wifi_default_status_file
echo "$wifi2g_default_disabled $wifi5g_default_disabled" > "$wifi_default_status_file"
# if wifi2g is enabled then disable it
if [ "$wifi2g_default_disabled" -eq 0 ]; then
uci set wireless.wifi2g.disabled='1'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "wifi2g disabled"
fi
# if wifi5g is enabled then disable it
if [ "$wifi5g_default_disabled" -eq 0 ]; then
uci set wireless.wifi5g.disabled='1'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "wifi5g disabled"
fi
fi
if [ "$action" = "on" ]; then
# Check if the wifi_default_status_file is available
if [ -f "$wifi_default_status_file" ]; then
# If the file is available read the default status from the file
read -r wifi2g_default_disabled wifi5g_default_disabled < "$wifi_default_status_file"
fi
# if wifi2g is enabled by default then enable it
if [ "$wifi2g_default_disabled" -eq 0 ]; then
uci set wireless.wifi2g.disabled='0'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "wifi2g enabled"
fi
# if wifi5g is enabled by default then enable it
if [ "$wifi5g_default_disabled" -eq 0 ]; then
uci set wireless.wifi5g.disabled='0'
uci commit wireless
wifi reload
logger -p notice -t wifi-toggle "wifi5g enabled"
fi
fi
sleep 5
Nice. I don’t see a reason for sleep 5
though. exit 0
should close out the script unless you’re eventually going to put in some error handling.