From c0ed62dc7a6da45d18cc72e99d7c53eb7a914f4f Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 19 Dec 2024 12:24:46 +0100 Subject: [PATCH] modbus: don't show not found errors in first minute --- src/modbus.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modbus.cpp b/src/modbus.cpp index 0c0432a15..5ed595590 100644 --- a/src/modbus.cpp +++ b/src/modbus.cpp @@ -310,8 +310,11 @@ ModbusMessage Modbus::handleRead(const ModbusMessage & request) { } } if (error_code) { - LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code); + if (uuid::get_uptime_sec() > 60 || error_code < -2) { // suppress not found messages for the first minute + LOG_ERROR("Unable to read raw device value %s for tag=%d - error_code = %d", modbusInfo->short_name, (int)tag, error_code); + } response.setError(request.getServerID(), request.getFunctionCode(), SERVER_DEVICE_FAILURE); + return response; } response.add(request.getServerID());