Flask-MQTT
Flask-MQTT copied to clipboard
Add example for TLS connection
I've managed to configure the TLS version to connect to the message broker provided by Amazon Web Services. Connectivity to AWS checks out fine with openssl command line test, however the test application only reports sending CONNECT.
How can I determine the packet payload based on the debug output of sample application? 16 Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b'simplewebapp'
Under the hood Flask-MQTT uses Paho-MQTT. Mqtt.client
gives you a reference to the paho client. You can use this to analyze your packet payload.
I can't get mine connected, if I set TLS on True it says [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
I can't get mine connected, if I set TLS on True it says [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
Same here
Edit: This did the trick for me (I'm using a HiveMQ Cloud MQTT Broker).
from flask_mqtt import Mqtt, ssl
app.config['MQTT_TLS_ENABLED'] = True
app.config['MQTT_TLS_VERSION'] = ssl.PROTOCOL_TLSv1_2 # <---- SEE HERE
see https://github.com/stlehmann/Flask-MQTT/pull/117/files#diff-ab6c33fcbdc57dd3f74676467ec075a309f7e8c8dc97a80150cf069e9034d18bR38