Skip to content

fix: pass an explicit TLS version to the MQTT client - #1078

Merged
allenporter merged 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/mqtt-tls-version
Nov 23, 2026
Merged

allenporter merged 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/mqtt-tls-version

Conversation

@hCoureau

Copy link
Copy Markdown
Contributor

Problem

Paho MQTT 2.1.0 reads ssl.PROTOCOL_TLSv1_2 when no TLS version is passed. On a Python build without that constant, the Roborock MQTT session fails during client setup.

Changes

Pass ssl.PROTOCOL_TLS_CLIENT explicitly. The existing certificate verification setting is preserved.

Testing

  • The regression test checks the TLS parameters passed to the MQTT client with certificate verification enabled and disabled. I also reproduced the Paho 2.1.0 setup failure by removing ssl.PROTOCOL_TLSv1_2 in a local test process. With the explicit version, Paho created the TLS context with the expected certificate and hostname settings. This exercised client setup without connecting to a broker.
  • 2,682 tests passed on each of Python 3.11 and 3.14 against upstream 321c6d5. The default suite excludes the 11 real-broker tests.
  • Pre-commit, commitlint, and source and wheel builds passed.

paho-mqtt 2.1.0 reads ssl.PROTOCOL_TLSv1_2 when no TLS version is
given. On a Python whose ssl module does not define that constant, the
MQTT session failed to start with "module 'ssl' has no attribute
'PROTOCOL_TLSv1_2'". Pass ssl.PROTOCOL_TLS_CLIENT, which paho selected
anyway, so certificate and hostname checks are unchanged.
@allenporter
allenporter merged commit 6188f86 into Python-roborock:main Nov 23, 2026
9 checks passed
@hCoureau
hCoureau deleted the submit/fix/mqtt-tls-version branch November 23, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants