[MQTT] Bugfix: Import wasn't initiated and handled correctly

This commit is contained in:
Ton Huisman
2026-01-21 14:27:46 +01:00
committed by TD-er
parent 47275a6264
commit aa86a92d93
2 changed files with 6 additions and 10 deletions
+4 -3
View File
@@ -1013,9 +1013,10 @@ bool PluginCall(uint8_t Function, struct EventStruct *event, String& str)
case PLUGIN_GET_UOM_GROUPS:
#endif // if FEATURE_TASKVALUE_UNIT_OF_MEASURE
// PLUGIN_MQTT_xxx functions are directly called from the scheduler.
// case PLUGIN_MQTT_CONNECTION_STATE:
// case PLUGIN_MQTT_IMPORT:
#if FEATURE_MQTT
case PLUGIN_MQTT_CONNECTION_STATE:
case PLUGIN_MQTT_IMPORT:
#endif // if FEATURE_MQTT
{
START_TIMER;
const deviceIndex_t DeviceIndex = getDeviceIndex_from_TaskIndex(event->TaskIndex);
+2 -7
View File
@@ -273,10 +273,6 @@ void scheduleNextMQTTdelayQueue() {
}
void schedule_all_MQTTimport_tasks() {
controllerIndex_t ControllerIndex = firstEnabledMQTT_ControllerIndex();
if (!validControllerIndex(ControllerIndex)) { return; }
constexpr pluginID_t PLUGIN_MQTT_IMPORT(PLUGIN_ID_MQTT_IMPORT);
deviceIndex_t DeviceIndex = getDeviceIndex(PLUGIN_MQTT_IMPORT); // Check if P037_MQTTimport is present in the build
@@ -358,9 +354,6 @@ void updateMQTTclient_connected() {
addLogMove(LOG_LEVEL_ERROR, connectionError);
}
MQTTclient_must_send_LWT_connected = false;
} else {
// Now schedule all tasks using the MQTT controller.
schedule_all_MQTTimport_tasks();
}
if (Settings.UseRules) {
if (MQTTclient_connected) {
@@ -369,6 +362,8 @@ void updateMQTTclient_connected() {
eventQueue.add(F("MQTT#Disconnected"));
}
}
// Now schedule all tasks using the MQTT Import plugin.
schedule_all_MQTTimport_tasks();
}
if (!MQTTclient_connected) {
// As suggested here: https://github.com/letscontrolit/ESPEasy/issues/1356