It seems that you've found that out, but not mentioned it here: "I think I have found part of the reason for the problem - the AP I have been using ..."The post on here was mainly in case anyone in future read the thread and wondered what the conclusion was.
To verify that it's not MicroPython, I ran your code on a Pico W called from Damien's test client. It's been running flawlessly with wait times approaching an hour:
Code:
send request<html><body>1609459552</body></html>sleep 2send request<html><body>1609459554</body></html>sleep 3send request<html><body>1609459558</body></html> ...sleep 711send request<html><body>1609461693</body></html>sleep 1066send request<html><body>1609462759</body></html>sleep 1599send request<html><body>1609465539</body></html>sleep 2398send request<html><body>1609467937</body></html>sleep 3597send request<html><body>1609472079</body></html>MicroPython can't fix problems caused by an unreliable router. My router has no special activity timeout set, but it has lots of other clients connecting. Thus Damien's suggestion is a good one: "Also, maybe try on a more noisy/busy AP, because it could be that the additional traffic is keeping the Pico W awake, and in your tests with a dedicated AP there is no additional traffic and that's why you see the issue."
If you must run this on a dedicated AP, maybe use/modify something like µPing to ping the gateway every couple of minutes to keep the connection alive
Statistics: Posted by scruss — Sat Sep 21, 2024 10:58 pm