Closed
Description
Troubleshooting this with Tyeth and Justin in Discord. Using Justin's latest on his branch at https://github.com/justmobilize/Adafruit_CircuitPython_MiniMQTT/tree/no-retry-on-unauthorized.
I have a PyPortal Titano with latest Nina Firmware and running absolute latest CircuitPython: Adafruit CircuitPython 9.1.0-beta.2-6-ge0f745c14c on 2024-05-18; Adafruit PyPortal Titano with samd51j20
I have a program that listens for messages and then downloads an image when a message is received, however it never is able to connect, it fails on the line mqtt_client.loop(35)
and I have MQTT set up as:
mqtt_client = MQTT.MQTT(
broker=getenv("broker"),
username=getenv("ADAFRUIT_AIO_USERNAME"),
password=getenv("ADAFRUIT_AIO_KEY"),
port=1883,
socket_timeout=30,
recv_timeout=35,
socket_pool=pool,
ssl_context=ssl_context,
is_ssl=False,
)
# Setup the callback methods above
mqtt_client.on_connect = connected
mqtt_client.on_disconnect = disconnected
mqtt_client.on_message = message
# Connect the client to the MQTT broker.
mqtt_client.logger = logger
mqtt_client.connect()
while True:
# Poll the message queue
try:
mqtt_client.loop(35)
except RuntimeError or ConnectionError:
time.sleep(10)
mqtt_client.connect()
mqtt_client.loop()
# Send a new message
time.sleep(5)
and the error is:
4761.377: DEBUG - Attempting to connect to MQTT broker (attempt #0)
4761.379: DEBUG - Attempting to establish MQTT connection...
4761.447: DEBUG - Sending CONNECT to broker...
4761.449: DEBUG - Fixed Header: bytearray(b'\x10>')
4761.453: DEBUG - Variable Header: bytearray(b'\x00\x04MQTT\x04\xc2\x00<')
4761.598: DEBUG - Receiving CONNACK packet from broker
4765.758: DEBUG - Got message type: 0x20 pkt: 0x20
Subscribing to prcutler/feeds/albumart
4765.764: DEBUG - Sending SUBSCRIBE to broker...
4765.768: DEBUG - Fixed Header: bytearray(b'\x82\x1c')
4765.789: DEBUG - Variable Header: b'\x00\x01'
4765.809: DEBUG - SUBSCRIBING to topic prcutler/feeds/albumart with QoS 0
4765.813: DEBUG - payload: b'\x00\x17prcutler/feeds/albumart\x00'
4765.908: DEBUG - Got message type: 0x90 pkt: 0x90
4765.920: DEBUG - Resetting reconnect backoff
4765.922: DEBUG - waiting for messages for 35 seconds
Traceback (most recent call last):
File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 993, in _wait_for_msg
File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 1083, in _sock_exact_recv
File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 183, in recv_into
timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "code.py", line 240, in <module>
File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 968, in loop
File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 998, in _wait_for_msg
TypeError: function takes 3 positional arguments but 2 were given
Metadata
Metadata
Assignees
Labels
No labels