Page 1 of 1

wifi and internet connection

Posted: Mon May 10, 2021 7:10 pm
by sscro
hello there! useless to say I'm pretty new to MicroPython: my questions speak for themselves...
I set a ESP8266 D1 pro to scan and test functionality of few wifi AP's in the building.
I need to test both wifi connection and internet availability in separate way .
Basically the system works except the following:

Code: Select all

oldtime = utime.ticks_ms()
        station.connect(SSID, PW)        
            while not station.isconnected():
                lapse = utime.ticks_diff(utime.ticks_ms(), oldtime)/1000
                if lapse > 20:
                    raise Exception("niente WiFi")  
            if station.isconnected():
                msg1="wifi connesso"
        except Exception as e: 
            msg1="niente wifi"
if I disconnect the internet cable from the AP while its wifi is active, the sta_if routine says that wifi is not available; on the other hand, sta_if.scan() shows the wifi ssid.
I'm sure I'm wrong somewhere but: where?

Re: wifi and internet connection

Posted: Wed May 12, 2021 2:25 pm
by sscro
ok, I sorted it out by testing few different Access Point.
When disconnected from the main router, few of them release an IP to connect to while other don't.
So, only in the first case ESP8266 is able to establish a wifi connection.
thanks anyway to those 28 braves that kindly read my post! :D