MQTT Error BR_ERR_BAD_VERSION on Shelly 1PM with Tasmota

450 Views Asked by At

I try to connect a Shelly 1 PM smart power relay to a managed MQTT broker.

The firmware on the device is a custom-built Tasmota 8.3.1 from the dev branch with USE_MQTT_TLS enabled. The port is set correctly to 8883 for TLS and the broker service is running at mqtt.bosch-iot-hub.com

When the device boots up, I can see the log messages on the serial port as follows:

23:03:03 MQT: Connect failed to mqtt.bosch-iot-hub.com:8883, rc 4. Retry in 10 sec
23:03:14 MQT: Attempting connection...
23:03:14 MQT: TLS connection error: 0

Return Code 4 is, according to the Tasmota documentation (https://tasmota.github.io/docs/TLS/), the code for BR_ERR_BAD_VERSION

And this error constant seems to be from BearSSL and means "Incoming record version does not match the expected version." (according to http://sources.freebsd.org/HEAD/src/contrib/bearssl/tools/errors.c)

Using an online TLS testing tool and checking mqtt.bosch-iot-hub, it supports only TLS 1.2 (1.3, 1.1 and 1.0 being disabled as well as SSLv2 and SSLv3). BearSSL website states that it supports TLS 1.2

I tried setting the log level of Tasmota in my_user_config.h , but it does not log any more verbose or detailed information.

#define SERIAL_LOG_LEVEL       LOG_LEVEL_DEBUG_MORE    // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)

What is the error message supposed to mean? Is it a TLS incompatibility of the BearSSL stack or on the service side? How can I enable verbose logging on Tasmota to see detailed TLS handshake information? Anything else I am missing?

1

There are 1 best solutions below

0
On

I appreciate after 6 months the question may have been a little expired, however the error code is not the TLS one as you describe, but rather the return code for the MQTT connection, as described in

https://tasmota.github.io/docs/MQTT/#return-codes-rc

which means your error code corresponds to 4 MQTT_CONNECT_BAD_CREDENTIALS the username/password were rejected