Skip to content

Commit 70f5ef1

Browse files
committed
add unsubscribe_topics
1 parent a65a767 commit 70f5ef1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

inelsmqtt/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ def unsubscribe_listeners(self) -> None:
206206
"""Unsubscribe listeners."""
207207
self.__listeners.clear()
208208

209+
async def unsubscribe_topics(self) -> None:
210+
"""Unsubscribe from all MQTT topics."""
211+
for topic in list(self._substates.keys()):
212+
await self.unsubscribe(topic)
213+
209214
def __notify_listeners(self, stripped_topic: str, is_connected_message: bool) -> None:
210215
"""Notify listeners for a specific topic."""
211216
if len(self.__listeners[stripped_topic]) > 0:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "elkoep-aio-mqtt"
7-
version = "0.1.0.beta.1"
7+
version = "0.1.0.beta.2"
88
description = "Python library for iNELS mqtt protocol"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -74,7 +74,7 @@ line-length = 120
7474
# Define the number of spaces used for indentation, aligning with Black's style.
7575
indent-width = 4
7676

77-
# The minimum Python version to target, e.g., when considering automatic code upgrades,
77+
# The minimum Python version to target, e.g., when considering automatic code upgrades,
7878
# like rewriting type annotations
7979
target-version = "py310"
8080

@@ -87,7 +87,7 @@ target-version = "py310"
8787
# Activate Security Rules (S) to replace bandit
8888
# Enable the isort rules (I) to replace isort
8989
# flake8-bugbear (B)
90-
select = ["F", "E4", "E7", "E9", "W", "S", "I", "B"]
90+
select = ["F", "E4", "E7", "E9", "W", "S", "I", "B"]
9191
ignore = ["F841"] # List any rules to be ignored, currently empty.
9292

9393
# Allow auto-fixing of all enabled rules when using the `--fix` option.

0 commit comments

Comments
 (0)