From f58f3c2d31807c291e99c3e64124cc74e389a357 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 25 Oct 2018 14:16:46 +0200 Subject: [PATCH] Fix rule mqtt#connected trigger Fix rule mqtt#connected trigger when mqtt is disabled (#4149) --- sonoff/_changelog.ino | 1 + sonoff/xdrv_02_mqtt.ino | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 21ceff6b5..8c2cff551 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,7 @@ /* 6.2.1.19 20181023 * Fix header file execution order by renaming user_config.h to my_user_config.h * Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147) + * Fix rule mqtt#connected trigger when mqtt is disabled (#4149) * * 6.2.1.18 20181019 * Add more API callbacks and document API.md diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino index 89cddbd6c..bb1a86e13 100644 --- a/sonoff/xdrv_02_mqtt.ino +++ b/sonoff/xdrv_02_mqtt.ino @@ -398,8 +398,11 @@ void MqttConnected() XdrvCall(FUNC_MQTT_INIT); } mqtt_initial_connection_state = 0; - rules_flag.mqtt_connected = 1; + global_state.mqtt_down = 0; + if (Settings.flag.mqtt_enabled) { + rules_flag.mqtt_connected = 1; + } } #ifdef USE_MQTT_TLS