I'm trying the same code (that works on a ESP32) on a Pico clone with ethernet but I get no luck with using SSL, without SSL it works (but only if using qos=0 in publish otherwise (using 1) I'll get a OSError: [Errno 22] EINVAL from the publish function).
Both qos=1 and ssl works on the ESP32 but I would like why and what I can do to get it to work. On the Wiznet it just halts on line 72 in umqttsimple.py. It imports the ussl but get stucks after that, no errors thrown it just stops there
Code: Select all
if self.ssl:
import ussl
self.sock = ussl.wrap_socket(self.sock, **self.ssl_params)
I connect like this (also tried without certificates ssl={} but no difference and the certs are correct and working on the ESP32 and the user/pass are not the ones I use )
Code: Select all
with open("homeautomation.key.der", 'rb') as f:
key = f.read()
with open("homeautomation.crt.der", 'rb') as f:
cert = f.read()
ssl_params = dict()
ssl_params["cert"] = cert
ssl_params["key"] = key
client = MQTTClient(client_id, mqtt_server, port=8883, user='power', password='1p0w3R6', keepalive=30, ssl=True, ssl_params=ssl_params)
client.connect()
print('Connected to %s MQTT broker' % (mqtt_server))