From 0fac3ccebc25e24ba3661f4799752248034e97e4 Mon Sep 17 00:00:00 2001 From: nikito7 <45373783+nikito7@users.noreply.github.com> Date: Mon, 17 May 2021 13:12:17 +0100 Subject: [PATCH] Change Modbus error message to bytes (#50725) --- homeassistant/components/modbus/sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/modbus/sensor.py b/homeassistant/components/modbus/sensor.py index b30aaa3c3d9..614925b79a6 100644 --- a/homeassistant/components/modbus/sensor.py +++ b/homeassistant/components/modbus/sensor.py @@ -142,11 +142,13 @@ async def async_setup_platform( _LOGGER.error("Error in sensor %s structure: %s", entry[CONF_NAME], err) continue - if entry[CONF_COUNT] * 2 != size: + bytecount = entry[CONF_COUNT] * 2 + if bytecount != size: _LOGGER.error( - "Structure size (%d bytes) mismatch registers count (%d words)", + "Structure request %d bytes, but %d registers have a size of %d bytes", size, entry[CONF_COUNT], + bytecount, ) continue