From 69fe18f1efd647b05686618ed3e1cc288ea3218e Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:21:04 +1300 Subject: [PATCH] Fix small index compare bug in modbus --- esphome/components/modbus/modbus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/modbus/modbus.cpp b/esphome/components/modbus/modbus.cpp index 4d75675d0f..897a2895ed 100644 --- a/esphome/components/modbus/modbus.cpp +++ b/esphome/components/modbus/modbus.cpp @@ -47,7 +47,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) { uint8_t function_code = raw[1]; // Byte 2: Size (with modbus rtu function code 4/3) // See also https://en.wikipedia.org/wiki/Modbus - if (at == 2) + if (at <= 2) return true; uint8_t data_len = raw[2];