Fix SetOption158 publish/suppress ModbusReceived MQTT messages (#20733)

Fixed a bug that let some mqtt messages be published anyway
This commit is contained in:
Fulvio Spelta 2024-02-16 15:06:11 +01:00 committed by GitHub
parent 6732db8803
commit c93d6676b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -551,8 +551,12 @@ void ModbusBridgeHandle(void)
ResponseJsonEnd();
if (errorcode == ModbusBridgeError::noerror)
if (Settings->flag6.mqtt_disable_modbus ) { // SetOption158 If it is activated, Tasmota will not publish ModbusReceived MQTT messages, but it will proccess event trigger rules
XdrvRulesProcess(0);
} else {
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_MODBUS_RECEIVED));
}
}
else if ((modbusBridge.buffer[1] == 15) || (modbusBridge.buffer[1] == 16)) // Write Multiple Registers
{
Response_P(PSTR("{\"" D_JSON_MODBUS_RECEIVED "\":{"));