Unify rules process call

Unify rules process call (#11572)
This commit is contained in:
Theo Arends 2021-04-04 12:04:36 +02:00
parent 6a167710bd
commit 1829df6d56
25 changed files with 55 additions and 75 deletions

View File

@ -623,7 +623,7 @@ void CmndStatus(void)
#endif #endif
if (payload) { if (payload) {
XdrvRulesProcess(); // Allow rule processing on single Status command only XdrvRulesProcess(0); // Allow rule processing on single Status command only
} }
ResponseClear(); ResponseClear();

View File

@ -250,7 +250,7 @@ void RotaryHandler(void) {
Encoder[index].abs_position[button_pressed] = Settings.param[P_ROTARY_MAX_STEP]; // SetOption43 - Rotary steps Encoder[index].abs_position[button_pressed] = Settings.param[P_ROTARY_MAX_STEP]; // SetOption43 - Rotary steps
} }
Response_P(PSTR("{\"Rotary%d\":{\"Pos1\":%d,\"Pos2\":%d}}"), index +1, Encoder[index].abs_position[0], Encoder[index].abs_position[1]); Response_P(PSTR("{\"Rotary%d\":{\"Pos1\":%d,\"Pos2\":%d}}"), index +1, Encoder[index].abs_position[0], Encoder[index].abs_position[1]);
XdrvRulesProcess(); XdrvRulesProcess(0);
#ifdef USE_LIGHT #ifdef USE_LIGHT
} }
#endif // USE_LIGHT #endif // USE_LIGHT

View File

@ -550,7 +550,7 @@ bool SendKey(uint32_t key, uint32_t device, uint32_t state)
result = !Settings.flag3.button_switch_force_local; // SetOption61 - Force local operation when button/switch topic is set result = !Settings.flag3.button_switch_force_local; // SetOption61 - Force local operation when button/switch topic is set
} else { } else {
Response_P(PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? PSTR("Switch") : PSTR("Button"), device, state); Response_P(PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? PSTR("Switch") : PSTR("Button"), device, state);
result = XdrvRulesProcess(); result = XdrvRulesProcess(0);
} }
#ifdef USE_PWM_DIMMER #ifdef USE_PWM_DIMMER
if (PWM_DIMMER != TasmotaGlobal.module_type || !result) { if (PWM_DIMMER != TasmotaGlobal.module_type || !result) {
@ -786,9 +786,7 @@ void MqttPublishTeleState(void)
DTVarsTeleperiod(); DTVarsTeleperiod();
#endif // USE_DT_VARS #endif // USE_DT_VARS
#if defined(USE_RULES) || defined(USE_SCRIPT) XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_SCRIPT
} }
void TempHumDewShow(bool json, bool pass_on, const char *types, float f_temperature, float f_humidity) void TempHumDewShow(bool json, bool pass_on, const char *types, float f_temperature, float f_humidity)
@ -945,9 +943,7 @@ void PerformEverySecond(void)
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); // CMND_SENSORRETAIN MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); // CMND_SENSORRETAIN
#if defined(USE_RULES) || defined(USE_SCRIPT) XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
XsnsCall(FUNC_AFTER_TELEPERIOD); XsnsCall(FUNC_AFTER_TELEPERIOD);

View File

@ -2898,7 +2898,7 @@ int WebSend(char *buffer)
extern uint8_t tasm_cmd_activ; extern uint8_t tasm_cmd_activ;
// recursive call must be possible in this case // recursive call must be possible in this case
tasm_cmd_activ=0; tasm_cmd_activ=0;
XdrvRulesProcess(); XdrvRulesProcess(0);
#endif // USE_SCRIPT #endif // USE_SCRIPT
#endif // USE_WEBSEND_RESPONSE #endif // USE_WEBSEND_RESPONSE
} }

View File

@ -424,7 +424,7 @@ void MqttPublishPrefixTopic_P(uint32_t prefix, const char* subtopic) {
void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic, bool retained) { void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic, bool retained) {
MqttPublishPrefixTopic_P(prefix, subtopic, retained); MqttPublishPrefixTopic_P(prefix, subtopic, retained);
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic) { void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic) {

View File

@ -286,7 +286,7 @@ void TimerEverySecond(void)
#if defined(USE_RULES) || defined(USE_SCRIPT) #if defined(USE_RULES) || defined(USE_SCRIPT)
if (POWER_BLINK == xtimer.power) { // Blink becomes Rule disregarding device and allowing use of Backlog commands if (POWER_BLINK == xtimer.power) { // Blink becomes Rule disregarding device and allowing use of Backlog commands
Response_P(PSTR("{\"Clock\":{\"Timer\":%d}}"), i +1); Response_P(PSTR("{\"Clock\":{\"Timer\":%d}}"), i +1);
XdrvRulesProcess(); XdrvRulesProcess(0);
} else } else
#endif // USE_RULES #endif // USE_RULES
if (TasmotaGlobal.devices_present) { ExecuteCommandPower(xtimer.device +1, xtimer.power, SRC_TIMER); } if (TasmotaGlobal.devices_present) { ExecuteCommandPower(xtimer.device +1, xtimer.power, SRC_TIMER); }

View File

@ -1033,13 +1033,6 @@ void RulesSetPower(void)
Rules.new_power = XdrvMailbox.index; Rules.new_power = XdrvMailbox.index;
} }
void RulesTeleperiod(void)
{
Rules.teleperiod = true;
RulesProcess();
Rules.teleperiod = false;
}
#ifdef SUPPORT_MQTT_EVENT #ifdef SUPPORT_MQTT_EVENT
/********************************************************************************************/ /********************************************************************************************/
/* /*
@ -2347,7 +2340,9 @@ bool Xdrv10(uint8_t function)
result = DecodeCommand(kRulesCommands, RulesCommand); result = DecodeCommand(kRulesCommands, RulesCommand);
break; break;
case FUNC_RULES_PROCESS: case FUNC_RULES_PROCESS:
Rules.teleperiod = (XdrvMailbox.index); // Signal teleperiod event
result = RulesProcess(); result = RulesProcess();
Rules.teleperiod = false;
break; break;
case FUNC_SAVE_BEFORE_RESTART: case FUNC_SAVE_BEFORE_RESTART:
RulesSaveBeforeRestart(); RulesSaveBeforeRestart();

View File

@ -505,10 +505,6 @@ void ScriptEverySecond(void) {
} }
} }
void RulesTeleperiod(void) {
if (bitRead(Settings.rule_enabled, 0) && TasmotaGlobal.mqtt_data[0]) Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
}
void SetChanged(uint32_t index) { void SetChanged(uint32_t index) {
glob_script_mem.type[index].bits.changed = 1; glob_script_mem.type[index].bits.changed = 1;
#ifdef USE_HOMEKIT #ifdef USE_HOMEKIT
@ -7838,8 +7834,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)) {
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data); if (XdrvMailbox.index) { // Signal teleperiod event
result = glob_script_mem.event_handeled; if (TasmotaGlobal.mqtt_data[0]) {
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
}
} else {
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
result = glob_script_mem.event_handeled;
}
} }
break; break;
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER

View File

@ -1190,7 +1190,7 @@ void TuyaSerialInput(void)
} else { } else {
AddLog_P(LOG_LEVEL_DEBUG, TasmotaGlobal.mqtt_data); AddLog_P(LOG_LEVEL_DEBUG, TasmotaGlobal.mqtt_data);
} }
XdrvRulesProcess(); XdrvRulesProcess(0);
if (dpId != 0 && Settings.tuyamcu_topic) { // Publish a /STAT Topic ready to use for any home automation system if (dpId != 0 && Settings.tuyamcu_topic) { // Publish a /STAT Topic ready to use for any home automation system
if (!Tuya.SuspendTopic) { if (!Tuya.SuspendTopic) {

View File

@ -893,7 +893,7 @@ void HueLightsCommand(uint8_t device, uint32_t device_id, String &response) {
} else { } else {
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_DIMMER)); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_DIMMER));
} }
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
change = false; change = false;
} }

View File

@ -583,7 +583,7 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l
} else { } else {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
} }
XdrvRulesProcess(); // apply rules XdrvRulesProcess(0); // apply rules
} }
void Z_Devices::jsonPublishFlush(uint16_t shortaddr) { void Z_Devices::jsonPublishFlush(uint16_t shortaddr) {

View File

@ -786,7 +786,7 @@ int32_t Z_ReceiveSimpleDesc(int32_t res, const SBuffer &buf) {
} }
ResponseAppend_P(PSTR("]}}")); ResponseAppend_P(PSTR("]}}"));
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEEZCL_RECEIVED)); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEEZCL_RECEIVED));
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
// If tuya protocol, change the model information // If tuya protocol, change the model information

View File

@ -498,7 +498,7 @@ void ShutterUpdatePosition(void)
if (Shutter[i].direction != 0) { if (Shutter[i].direction != 0) {
if (!ShutterGlobal.start_reported) { if (!ShutterGlobal.start_reported) {
ShutterReportPosition(true, i); ShutterReportPosition(true, i);
XdrvRulesProcess(); XdrvRulesProcess(0);
ShutterGlobal.start_reported = 1; ShutterGlobal.start_reported = 1;
} }
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Time %d, cStop %d, cVelo %d, mVelo %d, aVelo %d, mRun %d, aPos %d, nStop %d, Trgt %d, mVelo %d, Dir %d"), AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Time %d, cStop %d, cVelo %d, mVelo %d, aVelo %d, mRun %d, aPos %d, nStop %d, Trgt %d, mVelo %d, Dir %d"),
@ -523,7 +523,7 @@ void ShutterUpdatePosition(void)
MqttPublish(stopic, Settings.flag.mqtt_power_retain); // CMND_POWERRETAIN MqttPublish(stopic, Settings.flag.mqtt_power_retain); // CMND_POWERRETAIN
ShutterReportPosition(true, i); ShutterReportPosition(true, i);
TasmotaGlobal.rules_flag.shutter_moved = 1; TasmotaGlobal.rules_flag.shutter_moved = 1;
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
} }
} }
@ -543,7 +543,7 @@ void ShutterAllowPreStartProcedure(uint8_t i)
uint32_t uptime_Local=0; uint32_t uptime_Local=0;
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]); AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. var%d <99>=<%s>, max10s?"),i+i, rules_vars[i]);
TasmotaGlobal.rules_flag.shutter_moving = 1; TasmotaGlobal.rules_flag.shutter_moving = 1;
XdrvRulesProcess(); XdrvRulesProcess(0);
uptime_Local = TasmotaGlobal.uptime; uptime_Local = TasmotaGlobal.uptime;
while (uptime_Local+10 > TasmotaGlobal.uptime && (String)rules_vars[i] == "99") { while (uptime_Local+10 > TasmotaGlobal.uptime && (String)rules_vars[i] == "99") {
loop(); loop();

View File

@ -795,7 +795,7 @@ bool Xdrv35(uint8_t function)
#ifdef USE_RULES #ifdef USE_RULES
sprintf(TasmotaGlobal.mqtt_data, PSTR("{\"Button%u\":{\"State\":3}}"), button_index + 1); sprintf(TasmotaGlobal.mqtt_data, PSTR("{\"Button%u\":{\"State\":3}}"), button_index + 1);
Rules.no_execute = true; Rules.no_execute = true;
if (!XdrvRulesProcess()) { if (!XdrvRulesProcess(0)) {
#endif // USE_RULES #endif // USE_RULES
PWMDimmerHandleButton(button_index, true); PWMDimmerHandleButton(button_index, true);
button_held[button_index] = true; button_held[button_index] = true;

View File

@ -906,7 +906,7 @@ miel_hvac_publish_settings(struct miel_hvac_softc *sc)
MqttPublishPrefixTopic_P(TELE, PSTR("HVACSettings")); MqttPublishPrefixTopic_P(TELE, PSTR("HVACSettings"));
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
static void static void
@ -948,7 +948,7 @@ miel_hvac_data_response(struct miel_hvac_softc *sc,
ToHex_P((uint8_t *)d, sizeof(*d), hex, sizeof(hex))); ToHex_P((uint8_t *)d, sizeof(*d), hex, sizeof(hex)));
MqttPublishPrefixTopic_P(TELE, PSTR("HVACData")); MqttPublishPrefixTopic_P(TELE, PSTR("HVACData"));
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
static void static void

View File

@ -1079,11 +1079,12 @@ void XsnsDriverState(void)
/*********************************************************************************************/ /*********************************************************************************************/
bool XdrvRulesProcess(void) bool XdrvRulesProcess(bool teleperiod) {
{ XdrvMailbox.index = teleperiod; // Signal teleperiod event
#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 rule_handled = XdrvCallDriver(10, FUNC_RULES_PROCESS); bool rule_handled = XdrvCallDriver(10, FUNC_RULES_PROCESS);
XdrvMailbox.index = teleperiod; // Signal teleperiod event
bool berry_handled = XdrvCallDriver(52, FUNC_RULES_PROCESS); bool berry_handled = XdrvCallDriver(52, FUNC_RULES_PROCESS);
return rule_handled || berry_handled; return rule_handled || berry_handled;
#else #else

View File

@ -291,7 +291,7 @@ void AdcEvery250ms(void) {
Adc[idx].last_value = new_value; Adc[idx].last_value = new_value;
uint16_t value = Adc[idx].last_value / ANALOG_PERCENT; uint16_t value = Adc[idx].last_value / ANALOG_PERCENT;
Response_P(PSTR("{\"ANALOG\":{\"A%ddiv10\":%d}}"), idx + offset, (value > 99) ? 100 : value); Response_P(PSTR("{\"ANALOG\":{\"A%ddiv10\":%d}}"), idx + offset, (value > 99) ? 100 : value);
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
} }
else if (ADC_JOY == Adc[idx].type) { else if (ADC_JOY == Adc[idx].type) {
@ -300,7 +300,7 @@ void AdcEvery250ms(void) {
Adc[idx].last_value = new_value; Adc[idx].last_value = new_value;
uint16_t value = new_value / Adc[idx].param1; uint16_t value = new_value / Adc[idx].param1;
Response_P(PSTR("{\"ANALOG\":{\"Joy%s\":%d}}"), adc_idx, value); Response_P(PSTR("{\"ANALOG\":{\"Joy%s\":%d}}"), adc_idx, value);
XdrvRulesProcess(); XdrvRulesProcess(0);
} else { } else {
Adc[idx].last_value = 0; Adc[idx].last_value = 0;
} }

View File

@ -232,7 +232,7 @@ void AdsEvery250ms(void)
} }
ResponseJsonEndEnd(); ResponseJsonEndEnd();
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
} }

View File

@ -343,9 +343,7 @@ void UBXTriggerTele(void)
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
} }

View File

@ -736,7 +736,7 @@ void MINRFbeaconCounter(void) {
RulesProcessEvent(stemp); RulesProcessEvent(stemp);
*/ */
Response_P(PSTR("{%s:{\"Beacon\":%u}}"), D_CMND_NRF, MINRF.beacon.time); Response_P(PSTR("{%s:{\"Beacon\":%u}}"), D_CMND_NRF, MINRF.beacon.time);
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
} }
@ -1166,9 +1166,7 @@ void MINRFtriggerTele(void){
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
} }

View File

@ -1466,7 +1466,7 @@ void HM10StatusInfo() {
RulesProcessEvent(stemp); RulesProcessEvent(stemp);
*/ */
Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_HM10, MIBLEsensors.size()); Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_HM10, MIBLEsensors.size());
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
/** /**
@ -1493,7 +1493,7 @@ void HM10EverySecond(bool restart){
_activeBeacons++; _activeBeacons++;
_beacon.time++; _beacon.time++;
Response_P(PSTR("{\"Beacon%u\":{\"Time\":%u}}"), _idx, _beacon.time); Response_P(PSTR("{\"Beacon%u\":{\"Time\":%u}}"), _idx, _beacon.time);
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
if(_activeBeacons==0) HM10.mode.activeBeacon = 0; if(_activeBeacons==0) HM10.mode.activeBeacon = 0;
@ -1568,9 +1568,7 @@ void HM10triggerTele(void){
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
} }

View File

@ -749,9 +749,7 @@ void MI32triggerTele(void){
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
} }
@ -762,7 +760,7 @@ void MI32triggerTele(void){
void MI32StatusInfo() { void MI32StatusInfo() {
MI32.mode.shallShowStatusInfo = 0; MI32.mode.shallShowStatusInfo = 0;
Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_MI32, MIBLEsensors.size()); Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_MI32, MIBLEsensors.size());
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
/*********************************************************************************************\ /*********************************************************************************************\
@ -1731,7 +1729,7 @@ void MI32EverySecond(bool restart){
_activeBeacons++; _activeBeacons++;
_beacon.time++; _beacon.time++;
Response_P(PSTR("{\"Beacon%u\":{\"Time\":%u}}"), _idx, _beacon.time); Response_P(PSTR("{\"Beacon%u\":{\"Time\":%u}}"), _idx, _beacon.time);
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
if(_activeBeacons==0) MI32.mode.activeBeacon = 0; if(_activeBeacons==0) MI32.mode.activeBeacon = 0;

View File

@ -1490,7 +1490,7 @@ void MI32triggerTele(void){
void MI32StatusInfo() { void MI32StatusInfo() {
MI32.mode.shallShowStatusInfo = 0; MI32.mode.shallShowStatusInfo = 0;
Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_MI32, MIBLEsensors.size()); Response_P(PSTR("{\"%s\":{\"found\":%u}}"), D_CMND_MI32, MIBLEsensors.size());
XdrvRulesProcess(); XdrvRulesProcess(0);
} }
/*********************************************************************************************\ /*********************************************************************************************\
@ -2704,9 +2704,7 @@ void MI32ShowSomeSensors(){
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data); //AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
#ifdef USE_HOME_ASSISTANT #ifdef USE_HOME_ASSISTANT
if(hass_mode==2){ if(hass_mode==2){
@ -3095,9 +3093,7 @@ void MI32ShowTriggeredSensors(){
} }
AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, TasmotaGlobal.mqtt_data); AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, TasmotaGlobal.mqtt_data);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} else { // else don't and clear } else { // else don't and clear
ResponseClear(); ResponseClear();

View File

@ -277,9 +277,7 @@ void WindMeterTriggerTele(void)
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { if (MqttShowSensor()) {
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
#ifdef USE_RULES XdrvRulesProcess(1); // Allow rule based HA messages
RulesTeleperiod(); // Allow rule based HA messages
#endif // USE_RULES
} }
} }