From 5f08aef5f72cf6e249a39a169a4270c61896bd21 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 13 Oct 2019 22:16:13 +0200 Subject: [PATCH] Fix Rules were not triggered with IR unknown protocol or in sonoff-it (#6629) --- sonoff/_changelog.ino | 1 + sonoff/xdrv_05_irremote.ino | 6 +++--- sonoff/xdrv_05_irremote_full.ino | 12 +----------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 5cecae288..68ccc93dd 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -2,6 +2,7 @@ * 6.6.0.18 20191010 * Add command DimmerRange in Light module to support 2 byte dimming ranges from Tuya * Add Zigbee additional commands and sending messages to control devices (#6095) + * Fix Rules were not triggered with IR unknown protocol or in sonoff-it (#6629) * * 6.6.0.17 20191009 * Add command SetOption34 0..255 to set backlog delay. Default value is 200 (mSeconds) (#6562) diff --git a/sonoff/xdrv_05_irremote.ino b/sonoff/xdrv_05_irremote.ino index 30b2f532f..4dd71f24f 100644 --- a/sonoff/xdrv_05_irremote.ino +++ b/sonoff/xdrv_05_irremote.ino @@ -174,13 +174,13 @@ void IrReceiveCheck(void) ResponseJsonEndEnd(); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_IRRECEIVED)); - if (iridx) { - XdrvRulesProcess(); + XdrvRulesProcess(); #ifdef USE_DOMOTICZ + if (iridx) { unsigned long value = results.value | (iridx << 28); // [Protocol:4, Data:28] DomoticzSensor(DZ_COUNT, value); // Send data as Domoticz Counter value -#endif // USE_DOMOTICZ } +#endif // USE_DOMOTICZ } irrecv->resume(); diff --git a/sonoff/xdrv_05_irremote_full.ino b/sonoff/xdrv_05_irremote_full.ino index 2bfa7a6c4..d78921b54 100644 --- a/sonoff/xdrv_05_irremote_full.ino +++ b/sonoff/xdrv_05_irremote_full.ino @@ -198,15 +198,11 @@ String sendIRJsonState(const struct decode_results &results) { void IrReceiveCheck(void) { - char sirtype[14]; // Max is AIWA_RC_T501 - int8_t iridx = 0; - decode_results results; if (irrecv->decode(&results)) { uint32_t now = millis(); - // if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) { if (!irsend_active && (now - ir_lasttime > IR_TIME_AVOID_DUPLICATE)) { ir_lasttime = now; @@ -236,13 +232,7 @@ void IrReceiveCheck(void) ResponseJsonEndEnd(); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_IRRECEIVED)); - if (iridx) { - XdrvRulesProcess(); -#ifdef USE_DOMOTICZ - unsigned long value = results.value | (iridx << 28); // [Protocol:4, Data:28] - DomoticzSensor(DZ_COUNT, value); // Send data as Domoticz Counter value -#endif // USE_DOMOTICZ - } + XdrvRulesProcess(); } irrecv->resume();