From 47ff77550a82cad95179fdf9476b4c309892ba36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemens=20B=C3=B6swirth?= Date: Mon, 6 Jan 2025 17:34:24 +0000 Subject: [PATCH] chore: remove use of BinaryPayloadBuilder --- custom_components/idm_heatpump/idm_heatpump.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/custom_components/idm_heatpump/idm_heatpump.py b/custom_components/idm_heatpump/idm_heatpump.py index 34f9f50..5324096 100644 --- a/custom_components/idm_heatpump/idm_heatpump.py +++ b/custom_components/idm_heatpump/idm_heatpump.py @@ -6,9 +6,7 @@ from typing import TypeVar from pymodbus.client import AsyncModbusTcpClient -from pymodbus.constants import Endian from pymodbus.exceptions import ConnectionException, ModbusException -from pymodbus.payload import BinaryPayloadBuilder from pymodbus.pdu.register_message import ReadInputRegistersResponse from .const import NAME_POWER_USAGE @@ -306,13 +304,7 @@ async def async_write_value(self, address: BaseSensorAddress[_T], value: _T): await self.client.connect() LOGGER.debug("connected") - builder = BinaryPayloadBuilder( - byteorder=Endian.BIG, - wordorder=Endian.LITTLE, - ) - - address.encode(builder, value) - registers = builder.to_registers() + registers = address.encode(value) assert len(registers) == address.size response = await self.client.write_registers(