Add support for Modbus Function Code 0x06 (Write Single Register) in write operations #3315
Unanswered
mortenx
asked this question in
Component enhancements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
Modbus Controller
Link to component documentation on our website
https://esphome.io/components/modbus_controller/
Describe the enhancement
I’d like to request support for Modbus Function Code 0x06 (Write Single Register) in ESPHome’s modbus_controller integration, specifically for write operations.
Currently, ESPHome uses Function Code 0x10 (Write Multiple Registers) by default when writing to holding registers, even when only a single 16-bit value is being sent. While this works for many devices, some Modbus-compatible sensors and transmitters — such as the RS-LDO-N01-2 dissolved oxygen transmitter — only accept Function Code 0x06 for writing to specific configuration or calibration registers.
I’m aware that ESPHome supports
custom_command
for sensors, which allows specifying the full Modbus packet including the function code. However, this feature is limited to read operations and cannot be used for writing. This means there’s currently no way to send a properly formatted 0x06 write command from ESPHome.It would be incredibly helpful if ESPHome allowed specifying the function code for write operations — either via a config option (e.g.
function_code: 0x06
) or by introducing acustom_command
equivalent for write actions. This would make Modbus support more flexible and compatible with industrial devices that strictly enforce protocol-level behavior.Use cases
In my case, I need to trigger a calibration command by writing a single value (e.g. 0x0001) to register 0x1010. The device explicitly supports 0x06 and rejects 0x10, resulting in CRC errors and no response. Since ESPHome doesn’t currently allow choosing the function code for write operations, I’m unable to perform this action directly.
Anything else?
RS-LDO-N01-2
Beta Was this translation helpful? Give feedback.
All reactions