Hello everybody,
I'm learning how to connect to a local MQTT server but I'm receiving the following error:
code.py output:
Connecting to WiFi...
Connected!
Attempting to connect to 192.168.1.8
Traceback (most recent call last):
File "code.py", line 85, in <module>
File "adafruit_minimqtt/adafruit_minimqtt.py", line 441, in connect
File "adafruit_minimqtt/adafruit_minimqtt.py", line 275, in _get_connect_socket
RuntimeError: Repeated socket failures
Code done running.
Version:
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Metro M4 Airlift Lite with samd51j19
Lines 85 & 86:
print("Attempting to connect to %s" % client.broker)
client.connect()
Some other MQTT lines in case are needed:
# Initialize MQTT interface with the esp interface
MQTT.set_socket(socket, esp)
# Set up a MiniMQTT Client
client = MQTT.MQTT(
broker=secrets["broker"], username=secrets["user"], password=secrets["pass"]
)
But it happens exactly the same when I try on of the examples. I'm running a M4 Express Airlift Lite. The local MQTT server is working and has no authentication.
Below the imported libraries and the basic SPI setup:
# Write your code here :-)
import board
import busio
import time
# Display Libraries:
import displayio
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font
from adafruit_st7735r import ST7735R
# WiFi and MQTT
import neopixel
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp32spi
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
import adafruit_minimqtt.adafruit_minimqtt as MQTT
# SPI Display & WiFi setup
spi = board.SPI()
tft_cs = board.D5
tft_dc = board.D6
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
I do have a SPI color screen attached to the SPI bus and a multi sensor attached to I2C using the SCL and SDA ports on the M4. It is actually being able to connect to WiFi so I suspect is not something I did wrong with the SPI Bus.
Any guidance is greatly appreciated!
Thanks in advance!
PP
MiniMqtt error message.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
Please be positive and constructive with your questions and comments.