Within that time the WIFI connection is there but the mqtt library of Peter Hinch reconnects after that time.
I have a coroutine running that publishes a log message every 10 minutes and checks if really 10 minutes went past since the last execution and logs the difference. After the outage of 1h 10 minutes I get a log that 4311 seconds have past since the last execution, which is ~1h 10 minutes. That shows that something is completely blocking the microcontroller for that period without anything being executed during that time.
I'm using
- uasynico V2.0 (but that problem existed before too).
- MQTT-library of Peter Hinch
(- I2C with HTU21D (using I2C), publishing every 10 minutes), occurs even on devices without it
- gc.collect() every 10 minutes
- a few mqtt subscriptions
Maybe someone has an idea of what could be causing this kind of blocking. I would appreciate it.
I can't find the problem as basically everything is normal python.
Here are the coroutines running (except the ones from the mqtt library):
RAM:
Code: Select all
async def __gc(interval):
while True:
gc.collect()
log.info(gc.mem_free(), local_only=True)
await asyncio.sleep(interval)
async def __ram(topic, interval, interval_gc=10):
asyncio.get_event_loop().create_task(__gc(interval_gc))
await asyncio.sleep(12)
while True:
gc.collect()
await mqtt.publish(topic, gc.mem_free())
await asyncio.sleep(interval)