peterhinch / micropython-mqtt

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

can't import name MQTTClient #102

Closed fbritop closed 1 year ago

fbritop commented 1 year ago

I have downloaded this library today. I have an M5Stack Core2 (Based on ESP32). I cannot find out but the M5 device gives me an error that el import cannot be completed. There is not much info besides that, as there is no console for the M5 firmware throught Visual Studio Code.

I have tried other libs (MQTT) with success, but I was looking for your solution in order to mantain a stable connection. Has this lib been tested on any of the M5 devices?

Thanks

from m5stack import * from m5stack_ui import * from uiflow import * from ble.ble_central import BLECentral from ble import ble_uart import wifiCfg from easyIO import * import urequests import nvs import json import network import machine from machine import TouchPad, Pin import esp32 import espnow import time import binascii import lvgl as lv from mqtt_as import MQTTClient, config import uasyncio as asyncio

peterhinch commented 1 year ago

I'm not aware of anyone using the module with M5Stack, but it has been used with numerous ESP32 devices. If you copy the file mqtt_as.py to the device's filesystem you should be able to issue at the REPL

>>> from mqtt_as import MQTTClient
fbritop commented 1 year ago

Acording to M5Stack, the provide only MicroPython v1.12, so I think async cannot be implemented. THanks

peterhinch commented 1 year ago

Oh dear, that's ancient. There is firmware available here for M5 Stack Atom. If this is your board why not upgrade?

fbritop commented 1 year ago

Because of al the drivers for the M5Stack peripherials, I need to stick to that. Also for the control of the LCD of their device

peterhinch commented 1 year ago

Oh dear. In this case I don't think there's anything I can do, so closing this.