What does unitid and address in modbus node mean?

I have a qn I am trying to use write modbus to a modbus relay to on and off I can't get it to work. It has a defalt address of 0xFF (255) when I have a unitid other that 0 I get a error like
image
image

But when I put unitid of 0 the out put is this
image

So I would like to ask what do unitid and address mean to the modbus node

This is my flow

[{"id":"bc242f2150ad2d9e","type":"function","z":"5166dd2a7e38940b","name":"open","func":"msg.payload={ \"value\": Buffer.from([0xFF,  \"0x05\",  0x00,  0x01,0xFF, 0x00, 0x99, 0xe4]) ,            \n              'fc': 16, \n              'unitid': 255, \n              'address': 0 , \n              'quantity': 8 };                   \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":150,"y":100,"wires":[["1402d00f97dd21b6","22a9c32181f56c47"]]},{"id":"f47f15618e6fabae","type":"inject","z":"5166dd2a7e38940b","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":40,"wires":[["bc242f2150ad2d9e"]]},{"id":"1402d00f97dd21b6","type":"modbus-flex-write","z":"5166dd2a7e38940b","name":"","showStatusActivities":true,"showErrors":true,"server":"64e234ec8ad4b896","emptyMsgOnFail":true,"keepMsgProperties":true,"x":210,"y":220,"wires":[["247db663721c8432","7c35516b0b4c471b"],["bd76ad027244bf4b","24630d69f1cd5be9"]]},{"id":"22a9c32181f56c47","type":"debug","z":"5166dd2a7e38940b","name":"Relay output 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":340,"y":120,"wires":[]},{"id":"247db663721c8432","type":"debug","z":"5166dd2a7e38940b","name":"Relay output 12e","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":200,"wires":[]},{"id":"7c35516b0b4c471b","type":"modbus-response","z":"5166dd2a7e38940b","name":"123e","registerShowMax":20,"x":430,"y":200,"wires":[]},{"id":"bd76ad027244bf4b","type":"debug","z":"5166dd2a7e38940b","name":"Relay output 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":240,"wires":[]},{"id":"24630d69f1cd5be9","type":"modbus-response","z":"5166dd2a7e38940b","name":"dsf","registerShowMax":20,"x":430,"y":240,"wires":[]},{"id":"64e234ec8ad4b896","type":"modbus-client","name":"RS485-1","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":1,"commandDelay":200,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}]

Hello ..

the unitid is the id of the modbus slave device
( as mentioned in the help file of the node that is in the range 0..255 tcp | 0..247 serial )
I see you have the communication as Serial rs485 so the address cannot exceed 247

Can your modbus relay device be configured to address id 1 ?
Whats strange is that you get a reply when you request with id 0 ? .. so it must be 0 :wink:
Any way to double check ? Can you share any documentation for the device ?

the address is the address of the modbus register from which you want to start reading or writing

i see you use FC16 (Function code 16) which is used to set Multiple Analog Output Registers
is your device controlled using a decimal value to a register that the relay device then translates to on/off ?
im asking because setting Multiple Coils is FC15
we need to check the documentation of the device


Article about Modbus

Thanks for replying I will check it tomorrow. Sorry if my qns seem dumb or it is another basic question as I don't really know modbus I looked at your link and I think I understand my code abit better thanks.

This is the document I recived but it is in chinese
2ch_relay_modbus_cmd.pdf (3.1 MB)
And this is a google link if you dont want to download the document

i believe i have found an english version of the docs of the device
http://www.chinalctech.com/m/view.php?aid=455

Try FC15 .. this should turn both relays on


msg.payload = { value: [1,1], 'fc': 15, 'unitid': 255, 'address': 0, 'quantity': 2 }

return msg

The array value : [1,1] is to set both to ON. try different compinations also [0,1] etc