Don't overwrite the client variable within the same scope

This commit is contained in:
Fabio Manganiello 2020-08-27 16:59:35 +02:00
parent beceb39b0c
commit ca0c4e3089
1 changed files with 4 additions and 5 deletions

View File

@ -144,10 +144,9 @@ class MqttBackend(Backend):
def _initialize_listeners(self, listeners_conf):
import paho.mqtt.client as mqtt
# noinspection PyShadowingNames
def listener_thread(client, host, port):
client.connect(host, port)
client.loop_forever()
def listener_thread(client_, host, port):
client_.connect(host, port)
client_.loop_forever()
# noinspection PyShadowingNames,PyUnusedLocal
for i, listener in enumerate(listeners_conf):
@ -181,7 +180,7 @@ class MqttBackend(Backend):
client.tls_insecure_set(self.tls_insecure)
threading.Thread(target=listener_thread, kwargs={
'client': client, 'host': host, 'port': port}).start()
'client_': client, 'host': host, 'port': port}).start()
def on_exec_message(self):
def handler(_, __, msg):