I'm new to ESP8266 and Micropython, but I got an MQTT client from Github that does not work because 1.8.7 seems to be missing the library. I tried loading an older binary (1.8.4) and I can 'import umqtt'. With 1.8.7, it says 'no module named umqtt'.
Did the library change names, or was mqtt dropped?
mqtt missing from 1.8.7?
Re: mqtt missing from 1.8.7?
Hello,
As far as I know there are now two mqtt libraries :
umqtt.simple
and umqtt.robust
you should chose the one you want to use.
For example for simple :
for more informations :
As far as I know there are now two mqtt libraries :
umqtt.simple
and umqtt.robust
you should chose the one you want to use.
For example for simple :
Code: Select all
from umqtt.simple import MQTTClient
# Test reception e.g. with:
# mosquitto_sub -t foo_topic
def main(server="localhost"):
c = MQTTClient("umqtt_client", server)
c.connect()
c.publish(b"foo_topic", b"hello")
c.disconnect()
if __name__ == "__main__":
main()
Re: mqtt missing from 1.8.7?
I re-flashed the 1.8.7 binary and now I can import umqtt from REPL, so not sure what happened earlier. I've been flashing with the windows tool (NODEMCU) and not esptool, if that makes any difference. In any case, thanks!