UMQTT - Can it support multiple publish statements?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Posts: 1
Joined: Mon Nov 07, 2016 10:16 am

UMQTT - Can it support multiple publish statements?

Post by haybarry » Mon Nov 07, 2016 10:37 am

Hi clever people,

I have a ESP-01 (with 32m serial rom) connected to a DHT-11. I am trying to publish to separate streams for Temperature and Humidity.

I can publish to one stream, and have a gauge on a RPi with Node RED to display my data. But if I add an extra publish statement to a second stream, my code crashes with

WebREPL daemon started on ws://
Started webrepl in normal mode
Traceback (most recent call last):
File "", line 4, in <module>

MicroPython v1.8.5-10-g0e69e6b on 2016-10-17; ESP module with ESP8266.

Using Micropython 1.8.5, and UMQTT.Simple

Last bit of code is

if cycle > 5:
cycle = 0
c.publish(b'Ghouse/Temp', str(Temp_Now))
c.publish(b'Ghouse/Humid', str(Humid_Now))
get_temp = False

I can comment out either publish statement and the code will work, but not both.

Have I run into a limitation, or just doing something dumb.

Thanks for your collective wisdom



Posts: 10
Joined: Tue Nov 08, 2016 12:33 pm

Re: UMQTT - Can it support multiple publish statements?

Post by jonaslorander » Thu Nov 17, 2016 8:43 pm


I'm sending three values using three different publishes after each other.
And I had the same problem, so I tried adding a short sleep before sending the next publish:

mqttc.publish(TOPIC_DS1_T, "%3.2f" % ds1_t)
mqttc.publish(TOPIC_DHT1_T, "%3.2f" % dht1_t)
mqttc.publish(TOPIC_DHT1_H, "%3.2f" % dht1_h)

And this works!


Post Reply