Asyncio IO version of uMqtt.Simple #17119
Replies: 4 comments 2 replies
-
I think yours is a better version of this micropython/micropython-lib#722.
You can run unit tests in MicroPython too, see e.g. |
Beta Was this translation helpful? Give feedback.
-
On past experience I think it is unlikely that the maintainers will accept a new MQTT version in micropython-lib - a revised MQTT library has been discussed a number of times. If you see a role for a reduced version of mqtt_as I suggest you publish it independently. I would recommend documenting the features it offers which the official library does not, and also listing features of The biggest of the latter is the removal of WiFi control. While this enables the code to be ported to Unix, it does remove the original purpose of While I appreciate it is a work in progress I can see a number of issues with the code. Ones that jump out at me are:
|
Beta Was this translation helpful? Give feedback.
-
I am happy to close this off with a summary in case it helps anyone else who comes along. If anyone comes across this I will assume you are interested in cooperative multitasking via asyncio and interacting with an MQTT broker.
For that last point, I probably will still tinker with different options as I gain a better understanding of my use case. |
Beta Was this translation helpful? Give feedback.
-
@garynthompson You might be interested in this short doc. tl;dr It outlines a way forward with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I've recently refactored the Simple MQTTClient to be asynchronous, is this something worth sharing?
I started off with the synchronous version on a thread, discovered thread limitations, then used Peter Hinch's version which worked great for a while but as I was optimising my project to work more offline I realised that micropython-mqtt is better suited where MQTT is central to the project as opposed to where MQTT is opportunistic. As I am working cross platform I want to also trial using the same library on Linux devices as my MQTT Client requirements are very simple.
If this sounds like it is worth sharing, I am happy to prepare a PR back to micropython-lib over the next few months once I have studied contributor guidelines, confirmed standard error workflows and added some documentation. My own projects are aimed to be Micropython and CPython compatible, which means I could unit test in CPython but I haven't seen any implementation patterns in the existing micropython-lib repo so am happy to get advice on this.
Edit: Draft Gist: https://gist.github.com/garynthompson/b62ddf958fec860c547587bfdcca4157#file-a_mqtt_simple-py
Kind regards,
Gary.
Beta Was this translation helpful? Give feedback.
All reactions