Some requested additions

* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614)
 * Add Individual HSBColorX commands (#3430, #3615)
 * Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607)
This commit is contained in:
Theo Arends 2018-08-28 10:26:33 +02:00
parent e4006757b1
commit f8666c0410
3 changed files with 20 additions and 3 deletions

View File

@ -3,6 +3,9 @@
* Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608)
* Fix handling use of default names when using names starting with shortcut character (#3392, #3600)
* Fix Sonoff Bridge data reception when using Portisch EFM8 firmware and in data buffer length (#3605)
* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614)
* Add Individual HSBColorX commands (#3430, #3615)
* Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607)
*
* 6.1.1.11 20180826
* Change scheduler phase 1/3 - Fixed when sleep is enabled: Uptime, Delay, PulseTime and TelePeriod (#3581)

View File

@ -2528,6 +2528,12 @@ void setup()
save_data_counter = Settings.save_data;
sleep = Settings.sleep;
if ((resetInfo.reason == REASON_WDT_RST) || (resetInfo.reason == REASON_EXCEPTION_RST) || (resetInfo.reason == REASON_SOFT_WDT_RST)) {
for (byte i = 0; i < MAX_RULE_SETS; i++) {
if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); }
}
}
Settings.bootcount++;
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount);
AddLog(LOG_LEVEL_DEBUG);

View File

@ -486,7 +486,7 @@ boolean RulesCommand()
}
else if ((CMND_RULE == command_code) && (index > 0) && (index <= MAX_RULE_SETS)) {
if ((XdrvMailbox.data_len > 0) && (XdrvMailbox.data_len < sizeof(Settings.rules[index -1]))) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 6)) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 10)) {
switch (XdrvMailbox.payload) {
case 0: // Off
case 1: // On
@ -502,6 +502,13 @@ boolean RulesCommand()
case 6: // Toggle
bitWrite(Settings.rule_once, index -1, bitRead(Settings.rule_once, index -1) ^1);
break;
case 8: // Off
case 9: // On
bitWrite(Settings.rule_stop, index -1, XdrvMailbox.payload &1);
break;
case 10: // Toggle
bitWrite(Settings.rule_stop, index -1, bitRead(Settings.rule_stop, index -1) ^1);
break;
}
} else {
int offset = 0;
@ -519,8 +526,9 @@ boolean RulesCommand()
}
rules_triggers[index -1] = 0; // Reset once flag
}
snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%s\",\"Once\":\"%s\",\"Free\":%d,\"Rules\":\"%s\"}"),
command, index, GetStateText(bitRead(Settings.rule_enabled, index -1)), GetStateText(bitRead(Settings.rule_once, index -1)), sizeof(Settings.rules[index -1]) - strlen(Settings.rules[index -1]) -1, Settings.rules[index -1]);
snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%s\",\"Once\":\"%s\",\"StopOnError\":\"%s\",\"Free\":%d,\"Rules\":\"%s\"}"),
command, index, GetStateText(bitRead(Settings.rule_enabled, index -1)), GetStateText(bitRead(Settings.rule_once, index -1)),
GetStateText(bitRead(Settings.rule_stop, index -1)), sizeof(Settings.rules[index -1]) - strlen(Settings.rules[index -1]) -1, Settings.rules[index -1]);
}
else if ((CMND_RULETIMER == command_code) && (index > 0) && (index <= MAX_RULE_TIMERS)) {
if (XdrvMailbox.data_len > 0) {