~martijnbraam/Flask-MultiMQTT

3f1afe908ba67732f2cb65643258e181e0e9d846 — Martijn Braam 2 months ago c1b8685
Improve the error message on connection
1 files changed, 9 insertions(+), 1 deletions(-)

M flask_multimqtt/__init__.py
M flask_multimqtt/__init__.py => flask_multimqtt/__init__.py +9 -1
@@ 316,7 316,15 @@ class MultiMQTT:
                        _logger.error(e)

        else:
            _logger.error(f"failed to connect to {self.host}: {rc}")
            _rc = {
                0: 'success',
                1: 'requested MQTT protocol is not supported',
                2: 'client-id refused',
                3: 'server unavailable',
                4: 'username or password incorrect',
                5: 'not authorized',
            }
            _logger.error(f"failed to connect to {self.host}: {_rc[rc]} ({rc})")

        for handler in self._handle_connect:
            handler()