RUTX50: How can i configure the digital Output to switch on when WIFI is ready?

Hello,
i have a device that needs to connect to the RUTX50 WIFI. Both the RUTX and the device are switched on simultaneously, but the Router takes longer to start its WIFI then the device for startup. When the WIFI is not ready, the device opens its own hotspot and does not try connect to the RUTX anymore.
Now i want to switch on the device with the Output of the RUTX, but i could not find a way to switch on the output when the WIFI is up.
Maybe somebody here can help me?
Thank you and best regards,
Hubert

Hello,

The following example was made on RUTX11, but the general procedure should apply to RUTX50 as well.

This can be achieved hotplug system, which allows to execute scripts when network interfaces go up or down, in this case that would be WiFi interfaces.

  • Log into the router via SSH;
  • Execute the following command to create a script file and open it with a text editor:
    • vi /etc/wifi_mon.sh
  • Press letter ‘i’ to enable editing and enter the following content:
#!/bin/sh

while true; do
    if iw dev wlan0-1 info > /dev/null 2>&1; then
        ubus call ioman.gpio.dout1 update '{"value":"1"}'
        logger "WiFi is up, triggered output"
        break  # Exit the loop once the interface is up
    fi
    sleep 1  # Check every second
done
  • Once done, press ‘Esc’, write ‘:wq’ and press ‘Enter’ to quit editing, save the file, and exit the editor.

    • It will set digital output value to on, when 2.4GHz WiFI interface goes up. For 5GHz WiFI, use wlan0-2.
  • Execute the following command to make the script executable:

    • chmod +x /etc/wifi_mon.sh
  • Modify /etc/rc.local file with the command:

  • Reboot your router. The output will be triggered once the WiFI comes up.

  • The logs should also generate something similar:

    • user.notice root: WiFi is up, triggered output

Best regards,

2 Likes

Hello @HGilch,

Apologies for the delayed response.

Could you please confirm whether your issue has been resolved, or if you still require assistance?

Best regards,

Dear Marija,
thank you for your answer. Actually, i found an easier solution for our problem. If i set the output permanantly to on, it will switch on after the startup of the router is completed and just a few seconds before WIFI is on. The advantage is that it does not involve creating a script etc.
Thank you and best regards,
Hubert

Dear Sigismundus,
thank you for your an help, and please excuse my late answer. I did not have the device at the time and then found a different solution.
Thanks again and best regards,
Hubert

Hello,

Thank you for confirming that the issue has been resolved, and we appreciate you sharing your solution here.

Please feel free to reach out on the forum if you have any further questions or require additional assistance.

Best regards,

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.