Skip to content

Add an aiomqtt based MQTT session module #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025

Conversation

allenporter
Copy link
Contributor

Add an aiomqtt based MQTT session module. This is based on #364 with some additional unit tests and support for retries.

The session is created by invoking create_mqtt_session. A caller may subscribe to a topic, and the session keeps track of which callbacks to invoke for each topic. The client is run as a background task that will run until shutdown. Once connected, the client will wait for messages to be received in a loop. If the connection is lost, the client will be re-created and reconnected. There is backoff to avoid spamming the broker with connection attempts. The client
will automatically re-establish any subscriptions when the connection is re-established.

It is very difficult to exercise the failure cases with aiomqtt, so these will need to be exercised manually. This does not contain any roborock specific information.

@allenporter
Copy link
Contributor Author

Looks like the tests fail when run from CI. Taking a look.

Copy link
Collaborator

@Lash-L Lash-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Amazing!

Copy link
Collaborator

@Lash-L Lash-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly looks great. Happy to merge this in and then make any needed adjustments with the roborock device when that is added. It's possible some flaws may pop up during implementation

@allenporter allenporter merged commit 5fe20ba into Python-roborock:main Apr 16, 2025
6 checks passed
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