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