Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

MQTT Stops publishing and subscribing after 5 minutes #147

Open

Description

@TanCans

Hello everyone,

i am using the mqtt library to publish some telemetry data to an IoT platform with a pycom microcontroller. But mqtt stops publishing data exact after five minutes even though it is still connected to wlan.

I am sharing the piece of code that calls mqtt client and the library

Connecting wlan:

wlan.connect('my wlan', auth=(None,'my password'), timeout= 50000) #even though i changed this timeout it didnt solve my problem

My credentials (for iot platform)

server = 'my server'
port = 1883
id = 'my id'
pw = ‘acces token’
topic_publish = 'v1/devices/me/telemetry'
dict={}

Creating a client:

Client = MQTTClient(id, server, port, pw, pw)
time.sleep(2)
client.connect()

Publishing in the loop:

While 1
encoded=ujson.dumps(dict)
client.publish(topic_publish, encoded)
time.sleep(1)

Thank you all in advance!

Activity

  1. nznobody commented on Nov 25, 2021

    @nznobody

    Not sure if at all related, but I have occasionally noticed potential memory leaks in the MQTT library or use of it resulting in OSError with out-of-memory.

    Whilst not pretty, periodically (e.g. on a thread or async) running gc.collect() did the trick...

  2. nznobody commented on Feb 1, 2022

    @nznobody

    I've since moved to a new (asyncio) implementation since this MQTT library leaves a lot to be desired. It can be found here: https://github.com/nznobody/micropython-umqtt.uasyncio2. This is derived from micropython-umqtt.simple2/robust2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions