• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

network.interfaces[0].ssid = "null" Doesn't work

Scheduled Pinned Locked Moved
Gcode meta commands
2
3
138
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Nazar
    last edited by Nazar 27 Jul 2023, 12:04

    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

    undefined 1 Reply Last reply 27 Jul 2023, 13:27 Reply Quote 0
    • undefined
      chrishamm administrators @Nazar
      last edited by 27 Jul 2023, 13:27

      @Nazar Does this work? null is a value, not a string:

      if network.interfaces[0].ssid = "(unknown)" || network.interfaces[0].ssid = null

      Duet software engineer

      undefined 1 Reply Last reply 27 Jul 2023, 14:38 Reply Quote 0
      • undefined
        Nazar @chrishamm
        last edited by 27 Jul 2023, 14:38

        @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 = ""
        
        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA