Modbus Write
This function block sends values to a Modbus server using a provided Modbus client. Use it to write coils or holding registers from your scenario graph.
π₯ Inputs
Enable This boolean input controls whether writing is performed. If not provided or False, the block will not attempt to write.
Modbus Client This input expects a client object produced by the Modbus Connect block. Provide a valid client to enable communication.
Data Generic data to write. Accepts a single value or a list (for writing multiple coils/registers).
π€ Outputs
This function block produces no outputs.
πΉοΈ Controls
Address Enter the Modbus register/coils address to write to. Use integer values that match your device map.
Data Type Choose between Coil and Holding Register to select which Modbus resource type will be written.
π― Features
Supports writing single values or lists to multiple addresses when the device supports it.
Lets you choose the target resource type with a simple dropdown:
CoilorHolding Register.Respects the
Enableinput so writing can be controlled from logic or user inputs.Reports errors to the log if writing fails so you can diagnose connection or configuration problems.
βοΈ Running mechanism
When the block runs:
If the
Enableinput is False or missing, no write is attempted.If no client is provided at
Modbus Client, the block will not perform any write.When enabled with a valid client, the block sends the supplied
Datato the address entered inAddressusing the selectedData Type.Errors (connection problems, invalid address, unsupported data) are reported to the log so you can act accordingly.
π Usage instructions
Add a
Modbus Connectblock and connect itsModbus Clientoutput to this block'sModbus Clientinput.Set
Addressto the register or coil address you want to write.Select
Data TypeasCoilfor boolean/coils orHolding Registerfor numeric registers.Feed your data into the
Datainput (single value or list).Use a
Logic Inputor other control to toggleEnablewhen you want the write to occur.
π‘ Tips and Tricks
Use
Modbus Connectto produce a reliable client and confirm the connection withModbus Readbefore trying to write.Drive the
Enableinput from aLogic Inputor a conditional block (for exampleEquals/Greater) so writes occur only under desired conditions.Prepare write values using
Number Inputor by assembling data with blocks likeString MergeorData Write Global/Data Write Localwhen you need to stage values.If you need to save or export values you write, combine this block with
CSV ExportorREST API - Postto keep external logs or send notifications.
π οΈ Troubleshooting
No write happening: check that the
Enableinput is True and that a validModbus Clientis connected.Invalid address errors: ensure
Addressis an integer within the device address map and matches the chosenData Type.Unexpected data format: for
Coiluse boolean or list of booleans; forHolding Registeruse numbers or a list of numbers.Write failures: verify connectivity with
Modbus Readand confirm the server accepts writes to the target address. Check log messages for details.
Last updated