write_typed()#

ModbusRTUTransport.write_typed(
register_type: Literal['holding', 'input', 'coil', 'discrete'],
address: int,
value: int | float | bool,
data_type: Literal['uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'float32', 'float64', 'bool'],
*,
unit_id: int,
byte_swap: bool = False,
word_swap: bool = False,
long_swap: bool = False,
) → None#

Encode value as data_type and write it to address, dispatching by register_type.

Coils are single-bit, so data_type must be "bool" and value must be a bool (no numeric coercion).