peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
549 stars 116 forks source link

How does one install this? I don't see it listed in Thonny package list? #85

Closed Jibun-no-Kage closed 1 year ago

Jibun-no-Kage commented 1 year ago

How does one install this? I don't see it listed in Thonny package list?

peterhinch commented 1 year ago

Please see the docs. You just have to copy the two required files to your device's filesystem.

Jibun-no-Kage commented 1 year ago

When I copied config.py and mqtt_as.py to the Pico, then I overwrite the firmware image, and Thonny throws up a dialog asking for Micropython to be installed again. Then I realized I need to get them into the actual Pico file system. I used Thonny file view to do this, so now I can import them as expected.

Seems odd that Thonny package management can see the your package? Say like it does for umqtt simple/robust[2] packages?

A sentence or two in the documentation on how or warn that copy of files to the actual Pico file system would be appreciated. As a new user, your documentation, specific to Pico W, left me completely lost. There is a big difference between just copying over the firmware image to a Pico versus accessing the Pico local file system. Just making that point would be a big help to new users.

The above said, looking forward to working with your MQTT implementation!

peterhinch commented 1 year ago

I don't use Thonny but it sounds like it can only see packages in the official library. mqtt_as is not an official library.

Re the docs, section 2.2 explicitly says for platforms other than ESP8266:

On other platforms simply copy the Python source to the filesystem (items 1 and 2 above as a minimum).

If, to a new user, it is unclear how to do this, it is the Pico or Thonny that needs additional documentation.

Jibun-no-Kage commented 1 year ago

I agree in part with you suggestion about the documentation, but I also see the logic in that if you added a sentence or two warning a new user, that would be of great benefit. A suggestion. Maybe, this discourse, will serve to help others.

That aside, thanks for responding, always appreciated when solutions are actively supported!

In a couple of days, I should have my MQTT design working. I have a couple of design questions already, best practice type of thing, but until I spend some real time with your implementation, I suspect the best practice questions I have may be answered. I am integrating the MQTT subscriptions and publishing to Node Red, using Pico W.

I have done a lot of MQTT with (straight) Python3, so dealing with MicroPython resource limits maybe surprising at times. When I first worked on ESP with MicroPython, did not use Thonny, was using C with the Adruino IDE, then later MicroPython and PyCraft, that was interesting!