Only subscribe when MQTT client is connected. (#34557)
This commit is contained in:
1 parent
d6ab36bf8e
commit
4448eb94a1
2 files changed
+15
-1
No files matched your search
@@ -872,7 +872,9 @@ class MQTT:
|
||||
subscription = Subscription(topic, msg_callback, qos, encoding)
|
||||
self.subscriptions.append(subscription)
|
||||
|
||||
await self._async_perform_subscription(topic, qos)
|
||||
# Only subscribe if currently connected.
|
||||
if self.connected:
|
||||
await self._async_perform_subscription(topic, qos)
|
||||
|
||||
@callback
|
||||
def async_remove() -> None:
|
||||
|
||||
Reference in new issue
Block a user