mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Report MQTT connect issues
This commit is contained in:
parent
5d71d5560e
commit
ce47b58a8b
@ -209,6 +209,17 @@ class MQTT(object): # pragma: no cover
|
|||||||
|
|
||||||
def _mqtt_on_connect(self, mqttc, obj, flags, result_code):
|
def _mqtt_on_connect(self, mqttc, obj, flags, result_code):
|
||||||
""" On connect, resubscribe to all topics we were subscribed to. """
|
""" On connect, resubscribe to all topics we were subscribed to. """
|
||||||
|
if result_code != 0:
|
||||||
|
_LOGGER.error('Unable to connect to the MQTT broker: %s', {
|
||||||
|
1: 'Incorrect protocol version',
|
||||||
|
2: 'Invalid client identifier',
|
||||||
|
3: 'Server unavailable',
|
||||||
|
4: 'Bad username or password',
|
||||||
|
5: 'Not authorised'
|
||||||
|
}.get(result_code))
|
||||||
|
self._mqttc.disconnect()
|
||||||
|
return
|
||||||
|
|
||||||
old_topics = self.topics
|
old_topics = self.topics
|
||||||
self._progress = {}
|
self._progress = {}
|
||||||
self.topics = {}
|
self.topics = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user