Detecting clients connected to AP, should isconnected() from WLAN tell me this? #10688
Unanswered
willlahr
asked this question in
RP2040 / Pico
Replies: 2 comments
-
Even in station mode |
Beta Was this translation helpful? Give feedback.
0 replies
-
A code snippet that can give you a hint async def handle_wifi_clientes(nic, current_clients: list) -> list:
clients = nic.status('stations')
if clients != current_clients:
util.nic_wifi.clients = []
if len(clients) == 0:
log("[WIFI] No stations connected")
else:
log(f"[WIFI] {len(clients)} stations connected")
for idx, mac in enumerate(clients, start=1):
for m in mac:
smac = f"{m[0]:02x}:{m[1]:02x}:{m[2]:02x}:{m[3]:02x}:{m[4]:02x}:{m[5]:02x}"
log(f"[WIFI] Station `{idx}` connected: {smac}")
util.nic_wifi.clients.append(smac)
return clients |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a Pi Pico W set up as an access point.
It says here https://docs.micropython.org/en/latest/library/network.WLAN.html "In AP mode returns True when a station is connected."
I'm reading this to say that when the AP is advertising but no devices have joined the wireless network it created the function should return False, and when (e.g.) I connect to it with my laptop it should return True
What I'm actually seeing is it return True in all cases. Has anyone else seen this behaviour? Could it be a bug - I couldn't find it mentioned in issues
Beta Was this translation helpful? Give feedback.
All reactions