diff --git a/Mqtt2ThingBoardGateWay.py b/Mqtt2ThingBoardGateWay.py index aa96944..b51d958 100644 --- a/Mqtt2ThingBoardGateWay.py +++ b/Mqtt2ThingBoardGateWay.py @@ -25,8 +25,8 @@ class Mqtt2ThingBoard: #Sent message to MQTT ThingsBoard Gateway def publishTelemetryMsg(self,msg): - if self.tb_client.is_connected == False: - self.tb_client.connect(self.host_name,self.tb_port) + if not self.tb_client.is_connected: + ret2 = self.tb_client.connect(self.host_name,self.tb_port) self.tb_client.publish("v1/gateway/telemetry",msg,0,True) @@ -60,7 +60,10 @@ class Mqtt2ThingBoard: #set up the system: login to MQTT + get all needed data from the BSH def __init__(self): self.publishDebugMsg("Connecting to MQTT Server") - self.mqtt_client.connect(self.host_name,self.host_port) + ret1 = self.mqtt_client.connect(self.host_name,self.host_port) + + self.publishDebugMsg("Connecting to ThingsBoard Mqtt Gateway") + ret2 = self.tb_client.connect(self.host_name,self.tb_port) self.publishDebugMsg("Setting up the Environment...")