mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix possibility that have multible topic subscribe mqtt (#6372)
This commit is contained in:
parent
3e70154695
commit
55f8ec8866
@ -482,17 +482,17 @@ class MQTT(object):
|
||||
if not isinstance(topic, str):
|
||||
raise HomeAssistantError("topic need to be a string!")
|
||||
|
||||
if topic in self.topics:
|
||||
return
|
||||
|
||||
with (yield from self._paho_lock):
|
||||
if topic in self.topics:
|
||||
return
|
||||
|
||||
result, mid = yield from self.hass.loop.run_in_executor(
|
||||
None, self._mqttc.subscribe, topic, qos)
|
||||
yield from asyncio.sleep(0, loop=self.hass.loop)
|
||||
|
||||
_raise_on_error(result)
|
||||
self.progress[mid] = topic
|
||||
self.topics[topic] = None
|
||||
_raise_on_error(result)
|
||||
self.progress[mid] = topic
|
||||
self.topics[topic] = None
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_unsubscribe(self, topic):
|
||||
|
Loading…
x
Reference in New Issue
Block a user