Skip to content

Commit

Permalink
Merge pull request #246 from sparks-baird/hivemq
Browse files Browse the repository at this point in the history
add more useful error message for hivemq fail
  • Loading branch information
sgbaird committed Aug 16, 2024
2 parents 348abd4 + 87a9645 commit 5bc496c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/public_mqtt_sdl_demo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,13 @@ def callback(topic, msg, retain=None, dup=None):
print(get_traceback(e))
print("Retrying client.connect() in 2 seconds...")
sleep(2.0)
client.connect()
try:
client.connect()
except OSError as e:
print(get_traceback(e))
print(
"Failed to connect on second attempt. Ensure you have the correct 'hivemq-com-chain.der' file *specific* to your HiveMQ Cloud broker instance (now required as of June 2024). The default file works for the self-driving-lab-demo, but for your own instance, generate and upload the correct CA file to your microcontroller. Your certificate can be generated via https://colab.research.google.com/github/sparks-baird/self-driving-lab-demo/blob/main/notebooks/7.2.1-hivemq-openssl-certificate.ipynb. See also https://github.com/sparks-baird/self-driving-lab-demo/issues/245"
) # noqa: E501

client.set_callback(callback)
client.subscribe(prefix + "GPIO/#")
Expand Down

0 comments on commit 5bc496c

Please sign in to comment.