@novikovav69 MQTTClient.connect is a method, you need to call it.You are missing the parentheses after client.connect.
QUERY · ISSUE
can't await mqtt.simple publish method
Hi
I'm using umqtt.simple and there is problem when i await mqtt.publish in my code !
'NoneType' object isn't iterable
Is there any way to solve this issue ?
Or use other lib like https://github.com/peterhinch/micropython-mqtt/blob/master/mqtt_as ?
CANDIDATE · ISSUE
a problem with the publication
Hello!
I have a problem with the publication.
I do:
from umqtt.simple import MQTTClient
client = MQTTClient(client_id="ESP8266", server="192.168.100.10", port=1883)
client.connect
client.publish("in", "sHOW")
I receive:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "umqtt/simple.py", line 123, in publish
AttributeError: 'NoneType' object has no attribute 'write'
2 comments
Many thanks! Forgive me my carelessness.
The umqtt.simple module is sync.You'd better use peterhinch's uasync mqtt lib.
While you only need subscribe to some topic.
my solution is :
@2niuhe thanks, but using umqtt_async have its own problem : https://forum.micropython.org/viewtopic.php?f=15&t=7144
thanks for your solution but i had problem in publish part not others .