-
Notifications
You must be signed in to change notification settings - Fork 50
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
MMQTTException Error Handling #163
Comments
As Danh pointed out I'm missing an import for the error handler. It should be from adafruit_minimqtt.adafruit_minimqtt import MMQTTException
|
@DJDevon3 Agreed that it looks like a double import as adafruit_io.py already imports MMQTTException. Does the inclusion of |
@brentru this issue was part of #7907 I was beta testing on a specific board. I'm no longer testing but from what I can remember yes it helped but the error handling still stopped the script even though I was catching the correct one. I can't explain it other than that, it doesn't behave as I would normally expect with a |
Hello, I'm having a similar MMQTTException error to what's described above. I was referred to this open issue by the Adafruit Forum. I've been trying multiple "try..except" statments all of which result in a fatal error and require a power reset on the microcontroller. I recently tried:
with no success Here are my specifics: Hardware setup: Adafruit ESP32-S2 Feather with a few I2C sensors CircuitPython version: the latest version 8.0.5 Library version: circuitpython-bundle-8.x-mpy-20230328 The code: https://gist.github.com/extrasleepy/875dbc9ff177301e50a94c7d4aeec01f Time duration before the problem appears: |
Circuit Python 8.0.5 stable release
Line 118 is the io.loop() line
MMQTTException not behaving as expected. Does not fail gracefully and continue. The script stops with an MMQTTException error. Possible I'm doing it wrong.
Danh suggested rolling it into RuntimeError.
I think MMQTTException is just not a subclass of ValueError or RuntimeError. So you want to catch more classes of exceptions than what you have now, or we should make MMQTTException be a subclass of RuntimeError.
Expected Behavior:
Fail like adafruit_requests library, ignore the error, continue the script after x amount of time, and continue polling the broker server (AdafruitIO)
How to replicate:
Run script, pull wifi or connectivity, will force the broker no response error or some other type of error which will cause the entire script to crash/stop running.
With my adafruit_requests related projects this does not happen, the script will error but will reconnect and continue eventually, forever. This is the preferred expected behavior for an always online IoT device.
There is no retry or reconnect because of this one. Connectivity loss seems to be the trigger to get the error handling to fail reliably. Since I have constant wifi issues this one is pretty easy for me to replicate.
The text was updated successfully, but these errors were encountered: