From 3cb2c7c49757b6ec865c6a7662be61ec839ae105 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 20 Sep 2022 23:12:54 +0200 Subject: [PATCH 01/14] Add SetOption147 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/include/tasmota_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 16a29c6ae..3135b1995 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -180,7 +180,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption146 .. SetOption177 uint32_t use_esp32_temperature : 1; // bit 0 (v12.1.1.1) - SetOption146 - (ESP32) Show ESP32 internal temperature sensor - uint32_t spare01 : 1; // bit 1 + uint32_t mqtt_sserialreceived : 1; // bit 1 (v12.x.x.x) - SetOption147 - (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. uint32_t spare02 : 1; // bit 2 uint32_t spare03 : 1; // bit 3 uint32_t spare04 : 1; // bit 4 From 8455a3fd3c3fb769f25a8ebe842abba39ecc34cc Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Tue, 20 Sep 2022 23:38:59 +0200 Subject: [PATCH 02/14] Add SetOption147 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino index a1d8279a6..391dd952d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino @@ -167,7 +167,11 @@ void SerialBridgeInput(void) { } ResponseJsonEnd(); - MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); + if (Settings->flag6.mqtt_sserialreceived) { // SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. + MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); + } else { + XdrvRulesProcess(0); + } serial_bridge_in_byte_counter = 0; } } From a79ab7275c209d272597c73b3c8a88291afe42d3 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 09:25:23 +0200 Subject: [PATCH 03/14] Add SetOption147 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/tasmota_support/settings.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 36dc971e7..6b2e9e376 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -992,6 +992,7 @@ void SettingsDefaultSet2(void) { flag5.mqtt_status_retain |= MQTT_STATUS_RETAIN; flag5.mqtt_switches |= MQTT_SWITCHES; flag5.mqtt_persistent |= ~MQTT_CLEAN_SESSION; + flag6.mqtt_sserialreceived |= MQTT_SSERIALRECEIVED; // flag.mqtt_serial |= 0; flag.device_index_enable |= MQTT_POWER_FORMAT; flag3.time_append_timezone |= MQTT_APPEND_TIMEZONE; From a6d4fe1e46eb6a8253e9f150fe0aac30d25b6313 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 09:27:19 +0200 Subject: [PATCH 04/14] Add SetOption157 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/include/tasmota_globals.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 0baa84dd7..3075e6715 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -283,6 +283,9 @@ String EthernetMacAddress(void); #ifndef MQTT_CLEAN_SESSION #define MQTT_CLEAN_SESSION 1 // 0 = No clean session, 1 = Clean session (default) #endif +#ifndef MQTT_SSERIALRECEIVED +#define MQTT_SSERIALRECEIVED 1 // 0 = Disable sserialreceived mqtt messages, 1 = Enable sserialreceived mqtt messages (default) +#endif #ifndef MQTT_LWT_OFFLINE #define MQTT_LWT_OFFLINE "Offline" // MQTT LWT offline topic message #endif From 5d3ae21159063583d52092a067235f35c80f3586 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 09:34:22 +0200 Subject: [PATCH 05/14] Add SetOption147 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/tasmota_support/settings.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 6b2e9e376..1f9fa6831 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -838,6 +838,7 @@ void SettingsDefaultSet2(void) { SOBitfield3 flag3 = { 0 }; SOBitfield4 flag4 = { 0 }; SOBitfield5 flag5 = { 0 }; + SOBitfield5 flag6 = { 0 }; SysMBitfield1 flag2 = { 0 }; SysMBitfield2 mbflag2 = { 0 }; From a4bf3b3ff08eb5cb97a21017e74ccc967ed7dd65 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 09:35:40 +0200 Subject: [PATCH 06/14] Add SetOption147 Add SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. If it is disabled, tasmota will not publish an MQTT message every time a SSerialReceived event fires. Use rules to control how and when publish these messages. --- tasmota/tasmota_support/settings.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 1f9fa6831..3c3e43592 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -838,7 +838,7 @@ void SettingsDefaultSet2(void) { SOBitfield3 flag3 = { 0 }; SOBitfield4 flag4 = { 0 }; SOBitfield5 flag5 = { 0 }; - SOBitfield5 flag6 = { 0 }; + SOBitfield6 flag6 = { 0 }; SysMBitfield1 flag2 = { 0 }; SysMBitfield2 mbflag2 = { 0 }; From cd2656b8ad4b80082f796be88e6799f91748dbb9 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 21:39:45 +0200 Subject: [PATCH 07/14] Setoption147 Setoption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/include/tasmota_globals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 3075e6715..e0ff3de01 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -283,8 +283,8 @@ String EthernetMacAddress(void); #ifndef MQTT_CLEAN_SESSION #define MQTT_CLEAN_SESSION 1 // 0 = No clean session, 1 = Clean session (default) #endif -#ifndef MQTT_SSERIALRECEIVED -#define MQTT_SSERIALRECEIVED 1 // 0 = Disable sserialreceived mqtt messages, 1 = Enable sserialreceived mqtt messages (default) +#ifndef MQTT_DISABLE_SSERIALRECEIVED +#define MQTT_DISABLE_SSERIALRECEIVED 0 // 1 = Disable sserialreceived mqtt messages, 0 = Enable sserialreceived mqtt messages (default) #endif #ifndef MQTT_LWT_OFFLINE #define MQTT_LWT_OFFLINE "Offline" // MQTT LWT offline topic message From d9e32d8b068c3b61dedb937ff3c883924353466b Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 21:41:10 +0200 Subject: [PATCH 08/14] Setoption147 Setoption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/include/tasmota_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 3135b1995..49bf2dc87 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -180,7 +180,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption146 .. SetOption177 uint32_t use_esp32_temperature : 1; // bit 0 (v12.1.1.1) - SetOption146 - (ESP32) Show ESP32 internal temperature sensor - uint32_t mqtt_sserialreceived : 1; // bit 1 (v12.x.x.x) - SetOption147 - (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. + uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.x.x.x) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead. uint32_t spare02 : 1; // bit 2 uint32_t spare03 : 1; // bit 3 uint32_t spare04 : 1; // bit 4 From f17e3440ac41b373db99742f61680b2a0e7c3b63 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 21:42:53 +0200 Subject: [PATCH 09/14] Setoption147 Setoption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/tasmota_support/settings.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 3c3e43592..5e961afc9 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -993,7 +993,7 @@ void SettingsDefaultSet2(void) { flag5.mqtt_status_retain |= MQTT_STATUS_RETAIN; flag5.mqtt_switches |= MQTT_SWITCHES; flag5.mqtt_persistent |= ~MQTT_CLEAN_SESSION; - flag6.mqtt_sserialreceived |= MQTT_SSERIALRECEIVED; + flag6.mqtt_disable_sserialrec |= MQTT_DISABLE_SSERIALRECEIVED; // flag.mqtt_serial |= 0; flag.device_index_enable |= MQTT_POWER_FORMAT; flag3.time_append_timezone |= MQTT_APPEND_TIMEZONE; From af2a2076e3e37eb8a933b861cb80080026a5ba88 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Wed, 21 Sep 2022 21:44:17 +0200 Subject: [PATCH 10/14] SetOption147 Setoption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino index 391dd952d..952cde978 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino @@ -167,11 +167,11 @@ void SerialBridgeInput(void) { } ResponseJsonEnd(); - if (Settings->flag6.mqtt_sserialreceived) { // SetOption147 (MQTT) Enable publish SSerialReceived MQTT messages. If disabled, use event rules instead. - MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); + if (Settings->flag6.mqtt_disable_sserialrec ) { // SetOption147 If it is activated, Tasmota will not publish SSerialReceived MQTT messages, but it will proccess event trigger rules + XdrvRulesProcess(0); } else { - XdrvRulesProcess(0); - } + MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); + } serial_bridge_in_byte_counter = 0; } } From 83b3343a34233097de9e8ef4a8043e0aa8be3d7c Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Thu, 22 Sep 2022 20:57:02 +0200 Subject: [PATCH 11/14] Add SetOption147 SetOption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/tasmota_support/settings.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 5e961afc9..649c3d301 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -1256,6 +1256,7 @@ void SettingsDefaultSet2(void) { Settings->flag3 = flag3; Settings->flag4 = flag4; Settings->flag5 = flag5; + Settings->flag6 = flag6; } void SettingsDefaultSet3(void) { From cda2e2f80c2d9e71320427140a1eed2b77a7439a Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Thu, 22 Sep 2022 20:59:48 +0200 Subject: [PATCH 12/14] Add SetOption147 SetOption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/include/tasmota_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 49bf2dc87..193a0669f 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -180,7 +180,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption146 .. SetOption177 uint32_t use_esp32_temperature : 1; // bit 0 (v12.1.1.1) - SetOption146 - (ESP32) Show ESP32 internal temperature sensor - uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.x.x.x) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead. + uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.1.1.1) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead. uint32_t spare02 : 1; // bit 2 uint32_t spare03 : 1; // bit 3 uint32_t spare04 : 1; // bit 4 From f9bfca4a47a5faf813382891d0732f05c4a5ed56 Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Thu, 22 Sep 2022 21:05:36 +0200 Subject: [PATCH 13/14] Add SetOption147 SetOption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/my_user_config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 0ed5e2789..fea059869 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -428,6 +428,7 @@ #define MQTT_TELE_RETAIN 0 // Tele messages may send retain flag (0 = off, 1 = on) #define MQTT_CLEAN_SESSION 1 // Mqtt clean session connection (0 = No clean session, 1 = Clean session (default)) +#define MQTT_DISABLE_SSERIALRECEIVED 0 // 1 = Disable sserialreceived mqtt messages, 0 = Enable sserialreceived mqtt messages (default) // -- MQTT - Domoticz ----------------------------- #define USE_DOMOTICZ // Enable Domoticz (+6k code, +0.3k mem) From 0333e9e4522205c7305e70529a5954023b28017b Mon Sep 17 00:00:00 2001 From: ortegafernando Date: Thu, 22 Sep 2022 22:27:44 +0200 Subject: [PATCH 14/14] Add SetOption147 SetOption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead. If it is activated, tasmota will not publish a MQTT message every time a SSerialReceived event fires. Use rules to control "what, how and when" publish these messages. --- tasmota/include/tasmota_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 193a0669f..1d258ae23 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -180,7 +180,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption146 .. SetOption177 uint32_t use_esp32_temperature : 1; // bit 0 (v12.1.1.1) - SetOption146 - (ESP32) Show ESP32 internal temperature sensor - uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.1.1.1) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead. + uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.1.1.2) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead. uint32_t spare02 : 1; // bit 2 uint32_t spare03 : 1; // bit 3 uint32_t spare04 : 1; // bit 4