We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 ?
'NoneType' object isn't iterable
The text was updated successfully, but these errors were encountered:
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 :
import uasyncio from umqtt.simple import MQTTClient loop = uasyncio.get_event_loop() async def my_callback(topic,msg): await uasyncio.sleep(1) def sub_callback(topic, msg): global loop loop.create_task(my_callback(topic,msg)) async def my_main(): c = MQTTClient("umqtt_client", server) c.set_callback(sub_callback) c.connect() c.subscribe(b'foo_con') pass loop.creat_task(my_main()) loop.run_forever()
Sorry, something went wrong.
@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 .
No branches or pull requests
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 ?
The text was updated successfully, but these errors were encountered: