All topics
On this page

You use a custom template when the Modbus device is not in the library, or when you always want to read the same registers. The template belongs to your organisation and is available on every gateway. If you do not want to enter the registers yourself, ModbusCloud creates a missing template free of charge as soon as the register data is available. How to request it is described in Modbus device is not in the library.

What you need

  • The role Owner, Admin or Technician in your organisation. With Read only you can see Templates, but the portal does not save any change.
  • The register map from the manual of the Modbus device, with the address, function code and data type of each value. How to read it is covered in the course lesson How to read a Modbus datasheet, step by step.

Create a template

After these steps, Templates contains an empty template with brand, model and protocol. You can also reach Create template through the Custom template tile in the Add Modbus device window.

  1. Open Templates

    Open Templates in the menu.

  2. Start creating

    Click Create template. The Create template window opens.

  3. Enter the name

    If you want a name other than brand and model, enter one in Name. If the field stays empty, the template is named after the brand and model.

  4. Enter the brand

    In Brand, enter the manufacturer. The field is required.

  5. Enter the model

    In Model, enter the type as it appears on the rating plate. This field is also required.

  6. Choose the protocol

    In Protocol, choose Modbus RTU for RS485 or Modbus TCP for the network. Modbus TCP is selected by default. When you add a Modbus device, the portal takes over this protocol.

  7. Enter the category

    If you also want to find the template by type when adding a device, enter a type in Category, such as Energy meter.

  8. Add the template

    Click Add. The portal shows Template created and the template appears in the list with 0 registers.

  9. Open the template

    Click the eye at the end of the row, labelled Bekijken / bewerken (view / edit). The page of the template opens.

Add registers

After these steps, the template stores the registers that the gateway will read.

  1. Open the window

    Click Add register.

  2. Enter the address

    In Address, enter the register address, counted from 0. If the manual gives addresses such as 40001, convert them with Enter a register address from the manual.

  3. Choose the function

    In Function code, choose the function from the manual, usually Read holding registers (3) or Read input registers (4). Read holding registers (3) is selected by default.

  4. Enter the name

    In Name, enter the name of the value, such as Voltage L1. The field is required.

  5. Enter the unit

    In Unit, enter the unit, such as V or kWh.

  6. Choose the data type

    In Data type, choose the type from the manual. The gateway reads only int16, uint16, int32, uint32 and float32.

  7. Choose the byte order

    If the type is int32, uint32 or float32, choose the order from the manual in Byte order. If the manual gives none, or the type is int16 or uint16, leave ABCD (1,2,3,4) selected.

  8. Enter the scale

    If the manual gives a factor for the raw value, enter it in Scale (multiply). Otherwise leave 1.

  9. Put the register in the list

    Click Add. The register appears in the list, sorted by function code and address. Repeat these steps for each register.

  10. Save the template

    When all registers are in the list, click Save at the top right. Only then does the portal store the registers and show Template saved.

The window also shows Byte order for int16 and uint16. With BADC (2,1,4,3) or DCBA (4,3,2,1), the gateway reads the two bytes the other way round there. The page of the Modbus device does not show this choice. If a value is wrong later, check the byte order and the scale as described in Set the byte order and scale factor.

Template page with Template details, the register list and the Export, Import and Save buttons

Make a register writable

A register that you want to control from the portal, such as a setpoint, gets a write function in the template. In Function code, choose Set single holding register (6) or Set multiple holding registers (16). A Modbus device with this template gets that register as a holding register. The gateway reads it with function code 3 and the portal may write to it. The portal always writes a 32-bit value with function code 16.

With Minimum and Maximum you limit the value that the portal writes. The portal rejects a value outside these limits. Writing works only when control is switched on for the gateway, as described in Control registers from the portal.

Choose the template for a Modbus device

After these steps, the Modbus device has its own copy of the registers from the template. If you reached Templates through the Custom template tile, open the gateway again.

  1. Open the gateway

    Open the gateway to which the Modbus device is connected.

  2. Start adding

    On the Overview tab, click Add Modbus device.

  3. Choose the library

    Choose Library. Your own templates are at the top under Your templates, followed by the number of registers.

  4. Choose the template

    Choose your template. If the list is long, search by name, brand, model or category. The Configure Modbus device window opens with the name and protocol from the template.

  5. Enter the address and connection

    Enter the address and connection as described in Set the address and connection of a Modbus device.

  6. Add the Modbus device

    Click Add. The portal shows how many registers the Modbus device received.

The portal does not take over a register without a name or with an address outside 0 to 65535 when adding. The other registers do come along.

Change a template later

A change to a template applies only to Modbus devices that you add afterwards. Modbus devices that already use the template keep their own registers. You change those on the page of the Modbus device, as described in Set up registers.

  1. Open the template

    In Templates, click the eye next to the template (Bekijken / bewerken).

  2. Open the register

    Click the pencil next to the register (Edit register).

  3. Adjust the fields

    Change the fields that need to change.

  4. Confirm the change

    In the window, click Save. The window closes and the list shows the change.

  5. Save the template

    Click Save at the top right. Only then does the portal store the change.

You delete a register with the bin next to the register (Delete). The portal asks for no confirmation, but it also stores that change only after Save. You change brand, model and protocol under Template details. The brand is called Manufacturer there.

Export and import a template

A JSON file stores a template outside the portal. You can use it to take a template to another organisation that you are a member of, or to import a register list from ModbusCloud Diagnostics.

On the page of the template, click Export. The browser downloads a JSON file with the details and all registers of the template.

You import a JSON file as follows.

  1. Open the template

    Open the template in which you want to import the registers. For a new template, create an empty one first.

  2. Start the import

    Click Import.

  3. Choose the file

    Choose the JSON file. The portal shows how many registers it imported. If the file is not valid JSON, the portal shows Invalid JSON file.

  4. Save the template

    Click Save. Only then does the portal store the imported registers.

The file is a JSON object with the details of the template and a list registers. protocol contains rtu or tcp. This example has two registers.

{
  "name": "Voorbeeld EM-100",
  "brand": "Voorbeeld",
  "model": "EM-100",
  "protocol": "rtu",
  "category": "Energiemeter",
  "registers": [
    { "address": 0, "fc": 4, "name": "Spanning L1", "unit": "V", "scale": 1, "data_type": "float32", "byte_order": "ABCD" },
    { "address": 12, "fc": 4, "name": "Vermogen L1", "unit": "W", "scale": 1, "data_type": "float32", "byte_order": "ABCD" }
  ]
}

The table shows what each field of a register means.

FieldMeaningValues
addressRegister address, counted from 00-65535
fcFunction code3 or 4 to read, 6 or 16 for a writable holding register
nameName of the valueRequired
unitUnitFor example V, kWh or °C
data_typeData typeint16, uint16, int32, uint32, float32
byte_orderByte orderABCD, CDAB, BADC, DCBA
scaleFactor for the raw valueFor example 0.1
min_value, max_valueLimits for writingMay be omitted
accessMake writableread_write for a writable holding register, may be omitted

ModbusCloud Diagnostics creates a file with the same structure when you export a device type as ModbusCloud gateway JSON. How that works is described in Log and export with Diagnostics. After Import and before Save, check the Protocol and the data type of each register.

Updated on 7 October 2026

Still stuck?

Email or call us. Include the serial number of the gateway, so we can take a look straight away.

Go to support