mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Fix teleperiod rule handling regression
Fix teleperiod rule handling regression from v9.3.1.2 (#11851)
This commit is contained in:
parent
147440fd99
commit
674509a56e
@ -8,9 +8,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Command ``Wifi 0/1`` for ESP8266 to turn wifi Off and On. When wifi is Off it is always returned On after a restart except for a wake-up from deepsleep (#11839)
|
- Command ``Wifi 0/1`` for ESP8266 to turn wifi Off and On. When wifi is Off it is always returned On after a restart except for a wake-up from deepsleep (#11839)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Command ``Power`` should not reset pulsetime (#11805)
|
|
||||||
- Zigbee refactored storage for device configuration and device last known data (#11838)
|
- Zigbee refactored storage for device configuration and device last known data (#11838)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Command ``Power`` should not reset pulsetime (#11805)
|
||||||
|
- Teleperiod rule handling regression from v9.3.1.2 (#11851)
|
||||||
|
|
||||||
## [Released]
|
## [Released]
|
||||||
|
|
||||||
## [9.4.0] 20210422
|
## [9.4.0] 20210422
|
||||||
|
@ -83,10 +83,11 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Command ``Power`` should not reset pulsetime [#11805](https://github.com/arendst/Tasmota/issues/11805)
|
|
||||||
- Zigbee refactored storage for device configuration and device last known data [#11838](https://github.com/arendst/Tasmota/issues/11838)
|
- Zigbee refactored storage for device configuration and device last known data [#11838](https://github.com/arendst/Tasmota/issues/11838)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Command ``Power`` should not reset pulsetime [#11805](https://github.com/arendst/Tasmota/issues/11805)
|
||||||
|
- Teleperiod rule handling regression from v9.3.1.2 [#11851](https://github.com/arendst/Tasmota/issues/11851)
|
||||||
|
|
||||||
### Noted
|
### Noted
|
||||||
- ESP32 single core **tasmota32solo1.bin** binary can only be uploaded using the GUI as OTA upload will trigger the watchdog timer
|
- ESP32 single core **tasmota32solo1.bin** binary can only be uploaded using the GUI as OTA upload will trigger the watchdog timer
|
@ -311,7 +311,7 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_MODULE_INIT, FU
|
|||||||
FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA,
|
FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA,
|
||||||
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY,
|
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY,
|
||||||
FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET,
|
FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET,
|
||||||
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
|
FUNC_RULES_PROCESS, FUNC_TELEPERIOD_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
|
||||||
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_CONSOLE_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON,
|
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_CONSOLE_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON,
|
||||||
FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
|
FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
|
||||||
FUNC_DEVICE_GROUP_ITEM };
|
FUNC_DEVICE_GROUP_ITEM };
|
||||||
|
@ -140,7 +140,6 @@ struct {
|
|||||||
int16_t save_data_counter; // Counter and flag for config save to Flash
|
int16_t save_data_counter; // Counter and flag for config save to Flash
|
||||||
RulesBitfield rules_flag; // Rule state flags (16 bits)
|
RulesBitfield rules_flag; // Rule state flags (16 bits)
|
||||||
|
|
||||||
bool rule_teleperiod; // Process rule based on teleperiod data using prefix TELE-
|
|
||||||
bool serial_local; // Handle serial locally
|
bool serial_local; // Handle serial locally
|
||||||
bool fallback_topic_flag; // Use Topic or FallbackTopic
|
bool fallback_topic_flag; // Use Topic or FallbackTopic
|
||||||
bool backlog_nodelay; // Execute all backlog commands with no delay
|
bool backlog_nodelay; // Execute all backlog commands with no delay
|
||||||
|
@ -174,6 +174,7 @@ struct RULES {
|
|||||||
uint16_t last_minute = 60;
|
uint16_t last_minute = 60;
|
||||||
uint16_t vars_event = 0; // Bitmask supporting MAX_RULE_VARS bits
|
uint16_t vars_event = 0; // Bitmask supporting MAX_RULE_VARS bits
|
||||||
uint16_t mems_event = 0; // Bitmask supporting MAX_RULE_MEMS bits
|
uint16_t mems_event = 0; // Bitmask supporting MAX_RULE_MEMS bits
|
||||||
|
bool teleperiod = false;
|
||||||
bool busy = false;
|
bool busy = false;
|
||||||
bool no_execute = false; // Don't actually execute rule commands
|
bool no_execute = false; // Don't actually execute rule commands
|
||||||
|
|
||||||
@ -420,7 +421,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||||||
|
|
||||||
// Step1: Analyse rule
|
// Step1: Analyse rule
|
||||||
String rule_expr = rule; // "TELE-INA219#CURRENT>0.100"
|
String rule_expr = rule; // "TELE-INA219#CURRENT>0.100"
|
||||||
if (TasmotaGlobal.rule_teleperiod) {
|
if (Rules.teleperiod) {
|
||||||
int ppos = rule_expr.indexOf(F("TELE-")); // "TELE-INA219#CURRENT>0.100" or "INA219#CURRENT>0.100"
|
int ppos = rule_expr.indexOf(F("TELE-")); // "TELE-INA219#CURRENT>0.100" or "INA219#CURRENT>0.100"
|
||||||
if (ppos == -1) { return false; } // No pre-amble in rule
|
if (ppos == -1) { return false; } // No pre-amble in rule
|
||||||
rule_expr = rule.substring(5); // "INA219#CURRENT>0.100" or "SYSTEM#BOOT"
|
rule_expr = rule.substring(5); // "INA219#CURRENT>0.100" or "SYSTEM#BOOT"
|
||||||
@ -433,7 +434,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all
|
|||||||
// rule_param = "0.100" or "%VAR1%"
|
// rule_param = "0.100" or "%VAR1%"
|
||||||
|
|
||||||
#ifdef DEBUG_RULES
|
#ifdef DEBUG_RULES
|
||||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM1: expr %s, name %s, param %s"), rule_expr.c_str(), rule_name.c_str(), rule_param.c_str());
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("RUL-RM1: Teleperiod %d, Expr %s, Name %s, Param %s"), Rules.teleperiod, rule_expr.c_str(), rule_name.c_str(), rule_param.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char rule_svalue[80] = { 0 };
|
char rule_svalue[80] = { 0 };
|
||||||
@ -852,7 +853,7 @@ void RulesInit(void)
|
|||||||
bitWrite(Settings.rule_once, i, 0);
|
bitWrite(Settings.rule_once, i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TasmotaGlobal.rule_teleperiod = false;
|
Rules.teleperiod = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RulesEvery50ms(void)
|
void RulesEvery50ms(void)
|
||||||
@ -2339,6 +2340,11 @@ bool Xdrv10(uint8_t function)
|
|||||||
case FUNC_RULES_PROCESS:
|
case FUNC_RULES_PROCESS:
|
||||||
result = RulesProcess();
|
result = RulesProcess();
|
||||||
break;
|
break;
|
||||||
|
case FUNC_TELEPERIOD_RULES_PROCESS:
|
||||||
|
Rules.teleperiod = true;
|
||||||
|
result = RulesProcess();
|
||||||
|
Rules.teleperiod = false;
|
||||||
|
break;
|
||||||
case FUNC_SAVE_BEFORE_RESTART:
|
case FUNC_SAVE_BEFORE_RESTART:
|
||||||
RulesSaveBeforeRestart();
|
RulesSaveBeforeRestart();
|
||||||
break;
|
break;
|
||||||
|
@ -7886,13 +7886,14 @@ bool Xdrv10(uint8_t function)
|
|||||||
break;
|
break;
|
||||||
case FUNC_RULES_PROCESS:
|
case FUNC_RULES_PROCESS:
|
||||||
if (bitRead(Settings.rule_enabled, 0)) {
|
if (bitRead(Settings.rule_enabled, 0)) {
|
||||||
if (TasmotaGlobal.rule_teleperiod) { // Signal teleperiod event
|
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
|
||||||
if (TasmotaGlobal.mqtt_data[0]) {
|
result = glob_script_mem.event_handeled;
|
||||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
|
}
|
||||||
}
|
break;
|
||||||
} else {
|
case FUNC_TELEPERIOD_RULES_PROCESS:
|
||||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
|
if (bitRead(Settings.rule_enabled, 0)) {
|
||||||
result = glob_script_mem.event_handeled;
|
if (TasmotaGlobal.mqtt_data[0]) {
|
||||||
|
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1080,14 +1080,12 @@ void XsnsDriverState(void)
|
|||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
bool XdrvRulesProcess(bool teleperiod) {
|
bool XdrvRulesProcess(bool teleperiod) {
|
||||||
TasmotaGlobal.rule_teleperiod = teleperiod; // Signal teleperiod event
|
bool rule_handled = XdrvCallDriver(10, (teleperiod) ? FUNC_TELEPERIOD_RULES_PROCESS : FUNC_RULES_PROCESS);
|
||||||
bool rule_handled = XdrvCallDriver(10, FUNC_RULES_PROCESS);
|
|
||||||
#ifdef USE_BERRY
|
#ifdef USE_BERRY
|
||||||
// events are passed to both Rules engine AND Berry engine
|
// events are passed to both Rules engine AND Berry engine
|
||||||
bool berry_handled = XdrvCallDriver(52, FUNC_RULES_PROCESS);
|
bool berry_handled = XdrvCallDriver(52, FUNC_RULES_PROCESS);
|
||||||
rule_handled |= berry_handled;
|
rule_handled |= berry_handled;
|
||||||
#endif
|
#endif
|
||||||
TasmotaGlobal.rule_teleperiod = false;
|
|
||||||
return rule_handled;
|
return rule_handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user