feat(mqtt): add unsubscribe() method to MQTTClient
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,13 @@ class MQTTClient:
|
|||||||
self.client.subscribe(topic, qos=1)
|
self.client.subscribe(topic, qos=1)
|
||||||
logger.debug(f"[{self.agent_id}] Abonné à {topic}")
|
logger.debug(f"[{self.agent_id}] Abonné à {topic}")
|
||||||
|
|
||||||
|
def unsubscribe(self, topic: str):
|
||||||
|
"""Se désabonner d'un topic."""
|
||||||
|
with self._lock:
|
||||||
|
self._subscriptions.pop(topic, None)
|
||||||
|
self.client.unsubscribe(topic)
|
||||||
|
logger.debug(f"[{self.agent_id}] Désabonné de {topic}")
|
||||||
|
|
||||||
def subscribe_inbox(self, callback: Callable):
|
def subscribe_inbox(self, callback: Callable):
|
||||||
"""S'abonner à sa propre inbox."""
|
"""S'abonner à sa propre inbox."""
|
||||||
self.subscribe(self.topic_inbox(), callback)
|
self.subscribe(self.topic_inbox(), callback)
|
||||||
|
|||||||
Reference in New Issue
Block a user