Commanding Modbus Devices

We'll explain how to command Modbus devices in a few steps


The BACE IoT Platform allows you to command modbus devices through writable modbus registers. This capability allows control over several device functions such as starting a motor pump, adjusting its speed, or updating a solar inverter's schedule. Refer to the Modbus device manual for understanding the appropriate registers to write to and the correct values to achieve the desired action.

Before writing to modbus registers via the BACE IoT Platform, please ensure:

  1. The Modbus device is onboarded onto the BACE Gateway and actively sending measurements.

  2. You have the requisite datatype for writing to the corresponding modbus device and registers.

If you have not onboarded your Modbus device yet, please visit How To Onboard Modbus Devices on how to do so.

Once your device is properly set up, you must obtain the corresponding datatype for your device. As also explained in Accessing Data, there are multiple ways to retrieve all measurements and their groups. Below is an example API request to fetch all datatypes and their latest values using id_physical_device endpoint

Get all datatypes and their latest data of a gateway


Returns all the latest measurements collected by the gateway

Query Parameters

Writing to a Single Register

To write to a Modbus device, use the ModbusWrite endpoint. This process requires you to provide the datatype number and the desired value in the payload.

Using modbus-write Endpoint

The modbus-write endpoint is your interaction point to command a device. The payload must include the datatypenumber and the desired value for execution.

Write to a Modbus Register


modbus-write endpoint is used for writing to modbus register(s)

Path Parameters

Request Body

    "status": 200,
    "payload": {
        "result": "success"

Here is an example payload for writing to a single modbus register.

    "datatype": 2100,
    "value": 15

Writing to Multiple Registers

The endpoint can execute a write action for multiple registers simultaneously. This process requires providing all datatypes and their corresponding values within the same payload as an array. Below is an example payload to set schedule for a solar inverter:

    "datatype": 2100,
    "value": 13
    "datatype": 2101,
    "value": 20
    "datatype": 2102,
    "value": 21

Last updated