0

using MAGTAG and circuitpython from adafruit, trying to connect to an SSID our IT department has set up with a PSK. It keeps getting stuck in my "Connecting to "my_network_name". This does not happen when i set this up using my hotspot on my phone with a password. So i'm assuming it's 100% a fault on my side and not on the network. My code is as follows:

**# Current Code:**
Get wifi details and more from a secrets.py file
try:
    from Secrets import Secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise
    
print("ESP32-S2 WebClient Test")
 
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])
 
print("Available WiFi networks:")

for network in wifi.radio.start_scanning_networks():
    print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
            network.rssi, network.channel))
wifi.radio.stop_scanning_networks() 
print("Connecting to %s"%Secrets["ssid"])
wifi.radio.connect(Secrets["ssid"], Secrets["PSK"])
print("Connected to %s!"%Secrets["ssid"])
print("My IP address is", wifi.radio.ipv4_address) 
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000)) 
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())

Result:

Setting up sensors Setting up display Loading fonts Loading bitmaps ESP32-S2 WebClient Test My MAC addr: [*******] Available WiFi networks: * RSSI: -69 Channel: 6 * RSSI: -69 Channel: 6 my_network_name RSSI: -69 Channel: 6 * RSSI: -80 Channel: 1 * RSSI: -73 Channel: 11 Connecting to my_network_name

Secrets = {
 'ssid' : 'my_network_name',
 # 'AuthMode': '',
 # 'password' : '',
  'PSK': 'PSK_given_by_IT',
 'timezone' : "America/New_York", # http://worldtimeapi.org/timezones
 }

Am i doing something wrong in my secrets file? or my code file? or both?

extrA
  • 1
  • 2

0 Answers0