UIFlow places WiFi connection code in the wrong place



  • I'm trying to make a robust wifi connection flow for unattended use. To do this I need to put the wifi connect commands inside a conditional so that I can test/handle/etc.

    Here's a simple example to demonstrate the issue

    A simple flow with the wifi connect widget in the correct place (inside a conditional):
    grab1

    ...and here is the resulting python code. Note WiFi.doConnect has moved to the top of the python code block instead of inside the else statement:
    grab2

    If I move the doConnect to the correct place the code works as I expect and there are no errors.

    I have tried this with doConnect and AutoConnect with the same result.



  • Hi @Slartibartfast

    I am seeing the same. I guess it's a bug.

    Interestingly, when I replace the Connect to Wi-Fi ... block with an Execute code: wifiCfg.doConnect('myAP', 'myPW') block the block stays within the else statement.

    Thanks
    Felix



  • @felmue Interesting. I had not tried that. Good workaround until this gets fixed for realz.

    Thanks!



  • Hi
    it seems wifi block handling not completely finished at UIFlow .
    also i need wifi.RSSI level
    0_1608525709701_m5 wifi1.JPG
    0_1608525767154_m5 wifi2.JPG



  • @slartibartfast Hate to bump an old topic but this is a problem for me still. The "Original Network Function" blocks place the calls to the wlan class correctly but they don't actually work. This is UIFlow 1.9.6 now. It makes it impossible to use the program except in the coverage area of the SSID hard coded into the program.

    For a workaround, you can manually relocate the call to doConnect inside the loop or function where you want it. You can save that, and when you upload the program to the device it seems to send the modified python.