Node-red-contrib-serial-modbus serial out - writing to a coil

I am trying to use the node-red-contrib-serial-modbus package to write to a modbus coil which has register value 1.
image
I have not found any documentation around what the payload should look like for the messages sent to the serial-out node, but what ever I try I just get "ERR_INVALID_OPT_VALUE" error.


Here is the doco from EPEVER (the modbus device is a solar controller):
image

Does anyone know what the payload shape should be to send an on or off command to a modbus coil?

I worked this out! The Modbus-Serial Out expects a javascript Buffer created from an array of two integers. This is because the modbus registers in the EPEVER Solar Controller are 16bit, so need two bytes to represent them.


I was not familar with the nodejs "Buffer" before today.

1 Like

Glad you got it working!

As another option, you could install node-red-contrib-modbus and try that out. I don't know about the nodes you're using, but I haven't found anything yet contrib-modbus can't handle. Not saying there isn't something. I just haven't found it. It may save the need to use a buffer object though which may make using your MODBUS setup easier. You're call.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.