Skip to content

Commit

Permalink
chore: remove use of BinaryPayloadBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
kodebach committed Jan 6, 2025
1 parent bca4159 commit 47ff775
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions custom_components/idm_heatpump/idm_heatpump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 47ff775

Please sign in to comment.