diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c432e8a9..98971bf44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - Support for RC-switch decoding of 64-bit received data - Berry `tasmota.defer()` (#22976) - Support for Lithuanian language translations by zzdovydas (#22971) +- `MqttTLS` field in `Status 6` to indicate if the MQTT connection is encrypted ### Breaking Changed diff --git a/tasmota/include/i18n.h b/tasmota/include/i18n.h index 40a095967..bc1d8a058 100644 --- a/tasmota/include/i18n.h +++ b/tasmota/include/i18n.h @@ -131,6 +131,7 @@ #define D_JSON_MODEL "Model" #define D_JSON_MOISTURE "Moisture" #define D_JSON_MQTT_COUNT "MqttCount" +#define D_JSON_MQTT_TLS "MqttTLS" #define D_JSON_NULL "null" #define D_JSON_NO "No" #define D_JSON_NOISE "Noise" diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index 1506611ca..8cd9361d5 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -1033,10 +1033,14 @@ void CmndStatus(void) } if (((0 == payload) || (6 == payload)) && Settings->flag.mqtt_enabled) { // SetOption3 - Enable MQTT + uint32_t mqtt_tls = 0; +#ifdef USE_MQTT_TLS + mqtt_tls = MqttTLSEnabled() ? 1 : 0; +#endif // USE_MQTT_TLS Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS6_MQTT "\":{\"" D_CMND_MQTTHOST "\":\"%s\",\"" D_CMND_MQTTPORT "\":%d,\"" D_CMND_MQTTCLIENT D_JSON_MASK "\":\"%s\",\"" - D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d,\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d,\"SOCKET_TIMEOUT\":%d}}"), + D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d,\"" D_JSON_MQTT_TLS "\":%d\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d,\"SOCKET_TIMEOUT\":%d}}"), SettingsText(SET_MQTT_HOST), Settings->mqtt_port, EscapeJSONString(SettingsText(SET_MQTT_CLIENT)).c_str(), - TasmotaGlobal.mqtt_client, EscapeJSONString(SettingsText(SET_MQTT_USER)).c_str(), MqttConnectCount(), MQTT_MAX_PACKET_SIZE, Settings->mqtt_keepalive, Settings->mqtt_socket_timeout); + TasmotaGlobal.mqtt_client, EscapeJSONString(SettingsText(SET_MQTT_USER)).c_str(), MqttConnectCount(), mqtt_tls, MQTT_MAX_PACKET_SIZE, Settings->mqtt_keepalive, Settings->mqtt_socket_timeout); CmndStatusResponse(6); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino b/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino index 3d2d998e8..97ec2a6ee 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_02_9_mqtt.ino @@ -978,6 +978,10 @@ uint16_t MqttConnectCount(void) { return Mqtt.connect_count; } +bool MqttTLSEnabled(void) { + return Mqtt.mqtt_tls; +} + void MqttDisconnected(int state) { /* // Possible values for state - PubSubClient.h