Fix MicroPython 1.23 compatibility issues #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
This PR fixes issues using the example code with MicroPython 1.23+. There was a breaking change made in the ssl/tls implementation (see micropython/micropython-lib#793)
To keep this example working with older versions, a MicroPython version check was added. This allows selection of a compatible umqtt.simple MQTTClient implementation. I tested this on 1.21 and 1.24-preview.
The ssl module in MicroPython 1.23+ now has the ability to accept both a file path or raw data, so the file reads were removed (in the new connect method) to simplify the example.
This also addresses Issue #2 by documenting and including endpoint validation, and how to get the CA cert needed.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.