Add all ruletimer values

Add all ruletimer values to command RuleTimer result message (#3571)
This commit is contained in:
Theo Arends 2018-08-24 18:22:04 +02:00
parent ae6fcd4d60
commit b34874ba45
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@
* Fix OtaMagic when file path contains a dash (-) (#3563) * Fix OtaMagic when file path contains a dash (-) (#3563)
* Fix EnergyReset3 (#2723) * Fix EnergyReset3 (#2723)
* Change command sleep from restart after change to not restart after change (#3554) * 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 * 6.1.1.8
* Fix MQTT reconnection detection when using TasmotaMqtt library (#3558) * Fix MQTT reconnection detection when using TasmotaMqtt library (#3558)

View File

@ -558,7 +558,11 @@ boolean RulesCommand()
if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.data_len > 0) {
rules_timer[index -1] = (XdrvMailbox.payload > 0) ? millis() + (1000 * XdrvMailbox.payload) : 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) { else if (CMND_EVENT == command_code) {
if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.data_len > 0) {