Merge pull request #16612 from ortegafernando/development

Setoption147 (MQTT) Disable publish SSerialReceived MQTT messages. If disabled, you must use event trigger rules instead.
This commit is contained in:
Theo Arends 2022-09-24 15:22:02 +02:00 committed by GitHub
commit 0d124ee1cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 2 deletions

View File

@ -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_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
#endif

View File

@ -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_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

View File

@ -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)

View File

@ -838,6 +838,7 @@ void SettingsDefaultSet2(void) {
SOBitfield3 flag3 = { 0 };
SOBitfield4 flag4 = { 0 };
SOBitfield5 flag5 = { 0 };
SOBitfield6 flag6 = { 0 };
SysMBitfield1 flag2 = { 0 };
SysMBitfield2 mbflag2 = { 0 };
@ -992,6 +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_disable_sserialrec |= MQTT_DISABLE_SSERIALRECEIVED;
// flag.mqtt_serial |= 0;
flag.device_index_enable |= MQTT_POWER_FORMAT;
flag3.time_append_timezone |= MQTT_APPEND_TIMEZONE;
@ -1254,6 +1256,7 @@ void SettingsDefaultSet2(void) {
Settings->flag3 = flag3;
Settings->flag4 = flag4;
Settings->flag5 = flag5;
Settings->flag6 = flag6;
}
void SettingsDefaultSet3(void) {

View File

@ -167,7 +167,11 @@ void SerialBridgeInput(void) {
}
ResponseJsonEnd();
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 {
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED));
}
serial_bridge_in_byte_counter = 0;
}
}