-
Notifications
You must be signed in to change notification settings - Fork 51
circuitphyton 5.x and version 3.1.0 #40
New issue
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
Comments
@bangell What code.py are you running - could you copy and paste it below? |
@brentru, i am using the example minimqtt_adafruitio_wifi.py Adafruit MiniMQTT Pub/Sub ExampleWritten by Tony DiCola for Adafruit IndustriesModified by Brent Rubell for Adafruit Industriesimport time import adafruit_minimqtt as MQTT WiFiGet wifi details and more from a secrets.py filetry: If you are using a board with pre-defined ESP32 Pins:esp32_cs = DigitalInOut(board.ESP_CS) If you have an externally connected ESP32:esp32_cs = DigitalInOut(board.D9)esp32_ready = DigitalInOut(board.D10)esp32_reset = DigitalInOut(board.D5)spi = busio.SPI(board.SCK, board.MOSI, board.MISO) status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)Uncomment below for an externally defined RGB LEDimport adafruit_rgbledfrom adafruit_esp32spi import PWMOutRED_LED = PWMOut.PWMOut(esp, 26)GREEN_LED = PWMOut.PWMOut(esp, 27)BLUE_LED = PWMOut.PWMOut(esp, 25)status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) FeedsSetup a feed named 'photocell' for publishing to a feedphotocell_feed = secrets["aio_username"] + "/feeds/photocell"photocell_feed = "/feeds/photocell" Setup a feed named 'onoff' for subscribing to changes#onoff_feed = secrets["aio_username"] + "/feeds/onoff" CodeDefine callback methods which are called when events occurpylint: disable=unused-argument, redefined-outer-namedef connected(client, userdata, flags, rc): def disconnected(client, userdata, rc): def message(client, topic, message): Connect to WiFiprint("Connecting to WiFi...") Initialize MQTT interface with the esp interfaceMQTT.set_socket(socket, esp) Set up a MiniMQTT Clientmqtt_client = MQTT.MQTT( Setup the callback methods abovemqtt_client.on_connect = connected Connect the client to the MQTT broker.print("Connecting to Adafruit IO...") photocell_val = 0
|
Looks like the code was refactored into a subfolder which will change the imports currently being used in the examples:
and also guides? Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit PyPortal with samd51j20
>>> import adafruit_minimqtt as MQTT
>>> dir(MQTT)
['__class__', '__file__', '__name__', '__path__']
>>> related: |
@caternuson I'm going to update examples to import correctly and check against existing learn guides today. |
Fixed in #41, released in https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/releases/tag/3.1.1 |
I am getting an issue when i update my minimqtt library that i haven't had in the past. the .mpy file gives this error
AttributeError: 'module' object has no attribute 'set_socket'
import adafruit_minimqtt as MQTT
MQTT.set_socket(socket, esp) <-----
if i grab the .py file from GitHub, it works as it should. Do I need to do anything using .mpy file?
The text was updated successfully, but these errors were encountered: