From c93d6676b99ca067140ea030d572ef81e2441ae2 Mon Sep 17 00:00:00 2001 From: Fulvio Spelta Date: Fri, 16 Feb 2024 15:06:11 +0100 Subject: [PATCH] Fix SetOption158 publish/suppress ModbusReceived MQTT messages (#20733) Fixed a bug that let some mqtt messages be published anyway --- tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index bc3f78bbf..f3031997b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -551,7 +551,11 @@ void ModbusBridgeHandle(void) ResponseJsonEnd(); if (errorcode == ModbusBridgeError::noerror) - MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_MODBUS_RECEIVED)); + 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 {