Bugfix mqtt socket error (#6256)
parent
61909e873f
commit
5932446508
|
@ -394,8 +394,7 @@ class MQTT(object):
|
|||
self.progress = {}
|
||||
self.birth_message = birth_message
|
||||
self._mqttc = None
|
||||
self._subscribe_lock = asyncio.Lock(loop=hass.loop)
|
||||
self._publish_lock = asyncio.Lock(loop=hass.loop)
|
||||
self._paho_lock = asyncio.Lock(loop=hass.loop)
|
||||
|
||||
if protocol == PROTOCOL_31:
|
||||
proto = mqtt.MQTTv31
|
||||
|
@ -435,7 +434,7 @@ class MQTT(object):
|
|||
|
||||
This method must be run in the event loop and returns a coroutine.
|
||||
"""
|
||||
with (yield from self._publish_lock):
|
||||
with (yield from self._paho_lock):
|
||||
yield from self.hass.loop.run_in_executor(
|
||||
None, self._mqttc.publish, topic, payload, qos, retain)
|
||||
|
||||
|
@ -485,7 +484,7 @@ class MQTT(object):
|
|||
if topic in self.topics:
|
||||
return
|
||||
|
||||
with (yield from self._subscribe_lock):
|
||||
with (yield from self._paho_lock):
|
||||
result, mid = yield from self.hass.loop.run_in_executor(
|
||||
None, self._mqttc.subscribe, topic, qos)
|
||||
|
||||
|
|
Loading…
Reference in New Issue