diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index df9f78284..c64f83efa 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -5,6 +5,7 @@ * Fix OtaMagic when file path contains a dash (-) (#3563) * Fix EnergyReset3 (#2723) * Change command sleep from restart after change to not restart after change (#3554) + * Add all ruletimer values to command RuleTimer result message (#3571) * * 6.1.1.8 * Fix MQTT reconnection detection when using TasmotaMqtt library (#3558) diff --git a/sonoff/xdrv_10_rules.ino b/sonoff/xdrv_10_rules.ino index 176a2a1c5..acfba2db7 100644 --- a/sonoff/xdrv_10_rules.ino +++ b/sonoff/xdrv_10_rules.ino @@ -558,7 +558,11 @@ boolean RulesCommand() if (XdrvMailbox.data_len > 0) { rules_timer[index -1] = (XdrvMailbox.payload > 0) ? millis() + (1000 * XdrvMailbox.payload) : 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_LVALUE, command, index, (rules_timer[index -1]) ? (rules_timer[index -1] - millis()) / 1000 : 0); + mqtt_data[0] = '\0'; + for (byte i = 0; i < MAX_RULE_TIMERS; i++) { + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%c\"T%d\":%d"), mqtt_data, (i) ? ',' : '{', i +1, (rules_timer[i]) ? (rules_timer[i] - millis()) / 1000 : 0); + } + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); } else if (CMND_EVENT == command_code) { if (XdrvMailbox.data_len > 0) {