Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport: stop service if mqtt connection cannot be established #45

Merged
merged 2 commits into from
Jun 20, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python_transport/wirepas_gateway/protocol/mqtt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from time import sleep

from paho.mqtt import client as mqtt
from paho.mqtt.client import connack_string


class MQTTWrapper(Thread):
Expand Down Expand Up @@ -69,7 +70,8 @@ def __init__(self, logger, username, password, host, port, secure_auth=True, ca_

def _on_connect(self, client, userdata, flags, rc):
if rc != 0:
self.logger.error("MQTT cannot connect {}".format(rc))
self.logger.error("MQTT cannot connect: {}".format(connack_string(rc)))
self.running = False
return

if self.on_connect_cb is not None:
Expand Down