network.interfaces[0].ssid = "null" Doesn't work
-
Hello, I am trying to create a script that will check if WiFi connection was established successfully and if negative turn on Access Point Mode, but network.interfaces[0].ssid = "null" Doesn't work, please let me know if I am doing something wrong.
This seems like the last step to make my implementation to work but please let me know if there is a simpler way to check for WiFi connection during start up and switch it to AP mode if no success.
; content of "0:/sys/Connect.g" if network.interfaces[0].ssid = "(unknown)" || network.interfaces[0].ssid = "null" M98 P"0:/sys/essential/leds/red.g" M552 S-1 G4 S1 M552 S0 G4 S1 M589 S"Name" P"Pass" I192.168.0.1 G4 S1 M552 S2 M291 S2 R"Connection was not established" P"WiFi module was automatically switched to Access Point Mode" echo "Not Connected" else echo "Was Connected"
in config.g I will include this line
echo >"0:/sys/runonce.g" "M98 P""0:/sys/Connect.g"""
it will create "runonce.g" that will run "Connect.g" after config.g
-
@Nazar Does this work?
null
is a value, not a string:if network.interfaces[0].ssid = "(unknown)" || network.interfaces[0].ssid = null
-
@chrishamm Thank you for your advice, it has worked.
An alternative way is also available by using the code below
if network.interfaces[0].actualIP = "0.0.0.0" || network.interfaces[0].actualIP = ""