adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT
Frequent errors in .loop calls with CircuitPython 8
- Dominant language
- Python
- Stars
- 81
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
No problems with CircuitPython 7, but with 8 I get frequent errors in .loop calls, about 1 error for 5->10 0calls, done once a second.
This is my code:
```
def mqtt_connect():
try:
print("Connecting to mqtt server ...")
# mqtt_client.connect()
mqtt_client.reconnect()
print('Connected :)')
mqtt_subscribes()
except Exception as e:
print("mqtt connect error")
print(e)
```
... in loop ...
```
...
time.sleep(1.0)
try:
mqtt_client.loop()
except (ValueError, RuntimeError) as e:
print("Failed to get data, retrying\n", e)
wifi.reset()
mqtt_client.reconnect()
continue
except OSError as e:
print('mqtt OSError')
print(e.errno)
print(e)
print('reconnecting ...')
mqtt_connect()
except Exception as e:
print('mqtt other error')
print(e)
print('reconnecting ...')
mqtt_connect()
```
This is the error:
New message on topic sensor/Outside Temperature: 76.8
Temp Out: 76.8
mqtt other error
Connecting to mqtt server ...
Connected to mqtt server
Connected :)
Subscribed to ha/heartbeatM with QOS level 0
Subscribed to sensor/Outside Temperature with QOS level 0
I also tried wifi.reset() but got: 'module' object has no attribute 'reset'
The resulting error structure 'e' is empty. Any suggestions?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported failure in the CircuitPython 8 environment, focusing on mqtt_client.loop() and the surrounding reconnect and exception-handling paths shown in the issue. Compare the behavior with CircuitPython 7 and determine whether the empty exception and wifi.reset() error are part of the same problem; done means identifying a reproducible cause and a verified resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100