generate_client_code
Generates a client code template for a Modbus recipe in Python, Node.js, C#, or Go, including precondition checks, write sequence, confirmation reads, and keep-alive.
Instructions
Generate a client program template for a recipe, using the libraries of the website examples: Python pymodbus (ModbusTcpClient), Node.js modbus-serial, C# NModbus, Go goburrow/modbus. The template checks the preconditions, performs the write sequence with the documented function codes, reads the confirmation registers and runs the keep-alive. Conditional steps are behind flags that default to off. The code writes to a live inverter when run: review it first. This server only returns text and never connects to a device.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | Inverter IP address to put in the template. | 192.168.1.100 |
| unit_id | No | Modbus unit identifier (default 1). | |
| language | Yes | Target language. | |
| recipe_id | Yes | Recipe id from list_recipes, e.g. 'native.active_power_setpoint'. | |
| transport | No | Only Modbus TCP (port 502) is generated. | tcp |