Signed 8 bit values fails to write to modbus correctly
Closed this issue · 1 comments
elupus commented
When writing s8 values to modbus pumps. We end up calling write_coils and write_registers with 8 bits of data. These registers are always 16 bits long, and AsyncModbus prefixes the data with 0000, to extend it to 16 bit. This leads to invalid values for negative numbers.
We must encode all writes to a minimum of 16 bits for coils and holding registers.
Reference: home-assistant/core#101774
elupus commented
We have ended up doing the encoding/decoding in modbus somewhat funky since we go via the encoder/decoder needed for the nibegw style data. I'm thinking we should have separate coil coders for modbus and nibegw.