adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

Using adafruit_minimqtt with default networking

Open
#219 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
81
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I am trying to use adafruit_minimqtt with the default circuitpython socket implementation, like this:

```
pool = socketpool.SocketPool(wifi.radio)
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False

mqtt_client = MQTT.MQTT(
broker="192.168.1.2",
port=8883,
username="abcdefgh",
password="abcdefgh",
socket_pool=pool,
ssl_context=ssl_context,
is_ssl=True
)
```

On connect, my MQTT broker sees this:
```
1716384906: New connection from 172.28.0.1:49242 on port 8883.
1716384906: OpenSSL Error[0]: error:14037412:SSL routines:ACCEPT_SR_KEY_EXCH:sslv3 alert bad certificate
1716384906: OpenSSL Error[1]: error:140370E5:SSL routines:ACCEPT_SR_KEY_EXCH:ssl handshake failure
```

I'm not quite sure why. It works okay with a version of umqtt that I modified to work with socketpool. For what I'm doing here I really don't want it checking the certificate chain (I'm not sure how to disable that) but even so, the error message above looks like something else, like it's trying to use certificate (rather than username/password) client authentication.

Am I missing some constructor parameters?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the MiniMQTT constructor and its handling of `socket_pool`, `ssl_context`, and `is_ssl`, then compare that path with the reported working `umqtt` setup. Done means explaining or resolving why this connection fails TLS negotiation when using CircuitPython's default socket implementation; the issue does not name a file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.