Building a script to switch between SSIDs, troubleshooting

Thank you for your help, I do really appreciate it. but it turns out it wasn’t the script that was the problem. I made a mistake following this guide; and wrote down toggle_wifi as equaling “ON” in both states… the upside of that is that my script does work, and I am not in fact crazy. For anyone following along this is the final (working) script.

toggle_wifi(){                                                                                                              
        local action=$1                                                                                                     
        logger -p notice -t action-variable-readout "$action"                                                               
        if [ "$action" = "ON" ]; then                                                                                       
                uci set wireless.default_radio0.ssid='SSID1'                                                               
                uci set wireless.default_radio0.hidden='1'                                                                  
                uci set wireless.default_radio1.ssid='SSID1'                                                               
                uci set wireless.default_radio1.hidden='1'                                                                  
                uci commit wireless                                                                                         
                wifi reload                                                                                                 
                logger -p notice -t wifi-toggle "SSID1"                                                                    
                                                                                                                            
        else                                                                                  
                uci set wireless.default_radio0.ssid='SSID2'                                                               
                uci set wireless.default_radio0.hidden='0'                                                                  
                uci set wireless.default_radio1.ssid='SSID2'                                                               
                uci set wireless.default_radio1.hidden='0'                                                                  
                uci commit wireless                                                                                         
                wifi reload                                                                                                 
                logger -p notice -t wifi-toggle "SSID2"                                                                    
        fi                                                                                                                  
}

and if you’re interesting in additional parameters for your ssid’s just type “uci show” in ssh and it will show you everything you can change. Marking as solved :pray:

2 Likes