Contents

1. File structure

required must be present optional can be omitted
FieldTypeDescription
id string required

Unique driver identifier. Uppercase, no spaces.

Example: "HTR220RCE"

enabled boolean required

Whether this driver is active. Set false to disable without deleting the file.

version string optional

Driver version string.

Example: "1"

info object optional

Human-readable device metadata. Used in the dashboard UI.

connection object required

Transport settings (serial or TCP). Topology entries can override individual fields.

commands array required

One or more measurement commands the device supports.

2. info

FieldTypeDescription
displayName string required

Full human-readable name shown in the UI.

"Shinko VIBRA HTR-220CE"

model string required

Model number. Also used for image resolution.

"HTR-220CE"

manufacturer string required

Manufacturer name.

serie string optional

Product series name.

"VIBRA"

type string required

Device category. Used for placeholder image selection.

Known values: thermometer · scales · barometer · thermphygrometer · thermohygrometer with barometer · multichannel thermometer · comparator

3. connection

FieldTypeValuesDescription
protocol string
  • STRING
  • STRING_BINARY
  • BINARY
  • MODBUS_RTU
  • MODBUS_TCP

Communication protocol. See Protocol types.

timeout integer milliseconds

Maximum time to wait for a response. Default: 1000. Applies to both serial and TCP.

Serial fields — used by STRING · STRING_BINARY · BINARY · MODBUS_RTU
baud integer 1200 2400 4800 9600

Baud rate. Must match the device's hardware setting. Default: 9600.

parity integer 0 = none
1 = even

Parity check mode. Default: 0.

stopBit integer 1 = 1 bit
2 = 2 bits
15 = 1.5 bits

Number of stop bits. Default: 1.

TCP fields — used by MODBUS_TCP
host string IP or hostname

IP address or hostname of the Modbus TCP gateway or device.

Example: "192.168.1.100"

tcp_port integer 1–65535

TCP port. Default: 502 (standard Modbus TCP port).

unit_id integer 1–247

Modbus unit identifier (slave address) placed in the MBAP header. Default: 1. Set to 255 for gateways that ignore it.

4. commands

FieldTypeDescription
parameter string required

Measurement or action identifier. Uppercase, used in the API URL.

Examples: TEMPERATURE · WEIGHT · TARE · ZERO

type string required

Endpoint classification.

  • read — for numeric measurement values (e.g. Temperature).
  • command — for service actions (e.g. Tare, Calibrate).
unit string required

Physical unit returned in the API response.

CELSIUS · g · % · hPa

write object optional

Command to send before reading. Omit for broadcast devices that push data automatically.

read object required

Defines how to parse the device's response.

 Multiple commands with the same write.cmd are batched — one serial request reads all their values simultaneously.

5. write

FieldTypeDescription
cmd string optional

The command bytes to transmit.

  • STRING / STRING_BINARY: ASCII string with escape sequences. "d\r" "SI\r\n"
  • BINARY / MODBUS_RTU: Hex-encoded bytes (no spaces). "010300010001D5CA"
dtr string optional

DTR line state before transmission.

"SET_DTR" · "CLEAR_DTR"

rts string optional

RTS line state before transmission.

"SET_RTS" · "CLEAR_RTS"

brk string optional

Break signal handling.

"IGNORE"

6. read

FieldTypeDescription
parser string required

How to extract the value. See Parser types.

  • Regex string — for STRING protocols
  • "BE" — Big-Endian binary integer
  • "BE_DECIMAL" — ASCII decimal in binary frame
  • "MODBUS_RTU" — Modbus RTU frame
  • "MODBUS_TCP" — Modbus TCP (strips MBAP header)
validator string optional

Regex applied to the full response. If it does not match, status is set to UNSTABLE.

Example: "S" — scales are stable only when response contains the letter S.

offset integer optional

Byte offset where the value starts in the response. Used with BE and BE_DECIMAL.

length integer optional

Number of bytes to read for the value. Used with BE and BE_DECIMAL.

2 → uint16 · 4 → uint32

head string optional

Expected HEX bytes at the start of the response. Used for validation / framing.

"1002" · "02"

tail string optional

Expected HEX bytes at the end of the response.

"1004" · "03"

bufsize integer optional

Number of bytes to read from the port. Default: 64.

Set to the exact expected response length for efficiency. Example: Modbus 6-register reply = 7.

factor float optional

Multiplier applied to the raw integer value. Default: 1.0. Ignored when expression is set.

0.01 → divide by 100 (e.g. raw 250025.00 °C)

expression string optional

Arithmetic expression evaluated after parsing. value is bound to the raw parsed number. Takes precedence over factor when both are present.

"value * 1.8 + 32" → Celsius to Fahrenheit · "value * 0.001" · "value / 10 + 5"

7. Protocol types

STRING

ASCII text over RS-232. Device sends and receives printable strings. Parser is a regex that extracts a number from the response.

STRING_BINARY

Similar to STRING but the response may contain non-printable binary bytes. Parser is still a regex.

BINARY

Raw binary protocol. write.cmd is a hex string. Response is parsed with BE, BE_DECIMAL, or MODBUS_RTU.

MODBUS_RTU

Modbus RTU over RS-485 or RS-232. write.cmd contains the full Modbus request frame as hex.

MODBUS_TCP

Modbus over Ethernet (TCP/IP). Same PDU as RTU but wrapped in a 7-byte MBAP header — no CRC, no serial port. Requires host and optionally tcp_port / unit_id in the connection block.

8. Parser types

Regex (STRING / STRING_BINARY)

Any valid regex. The last number found in the match is used as the value.

parser: "[+-]?\\d+\\.\\d+" response: "+ 25.300 g S" → 25.3

BE

Reads length bytes at offset as a Big-Endian unsigned integer, then scales by factor or expression.

offset:6, length:2, factor:0.01 bytes [09 C4] = 2500 × 0.01 = 25.00

BE_DECIMAL

Reads length bytes at offset as an ASCII decimal string, then scales by factor or expression.

offset:0, length:6, factor:0.01 bytes "101325" × 0.01 = 1013.25

MODBUS_RTU

Parses a standard Modbus RTU read-holding-registers reply: [addr][func][len][data…][crc]. Data starts at byte 3. Scales by factor or expression.

01 03 02 09 C4 xx xx → 2500 × factor

MODBUS_TCP

Strips the 7-byte MBAP header then parses the PDU: [func][len][data…]. Data starts at byte 2 of the PDU. Exception responses (func | 0x80) return null.

MBAP(7) + 03 02 09 C4 → 2500 × factor

9. Full example

STRING protocol — LT300 thermometer

// drivers/LT300.json
{
  "id":      "LT300",
  "enabled": true,
  "version": "1",
  "info": {
    "displayName":  "TermexLab LT300",
    "model":        "LT300",
    "manufacturer": "TermexLab",
    "type":         "thermometer"
  },
  "connection": {
    "protocol": "STRING",
    "baud":     4800,
    "parity":   0,
    "stopBit":  1,
    "timeout":  1000
  },
  "commands": [
    {
      "parameter": "TEMPERATURE",
      "unit":      "CELSIUS",
      "type":      "read",
      "write": { "cmd": "d\r" },   // send ASCII "d" + CR
      "read": {
        "parser": "[+-]?([0-9]*[.])?[0-9]+"  // extract last number
      }
    }
  ]
  }

BINARY (Modbus RTU) — IVA-6B2 thermohygrometer

// drivers/IVA6B2.json — two parameters, one request each
{
  "id": "IVA6B2", "enabled": true,
  "connection": { "protocol": "BINARY", "baud": 9600, "parity": 0, "stopBit": 1, "timeout": 1000 },
  "commands": [
    {
      "parameter": "TEMPERATURE", "unit": "CELSIUS", "type": "read",
      "write": { "cmd": "010300010001D5CA" },  // Read register 0x0001
      "read":  { "parser": "MODBUS_RTU", "bufsize": 7, "factor": 0.01 }
    },
    {
      "parameter": "RELATIVE_HUMIDITY", "unit": "%", "type": "read",
      "write": { "cmd": "010300000001840A" },  // Read register 0x0000
      "read":  { "parser": "MODBUS_RTU", "bufsize": 7, "factor": 0.01 }
    }
  ]
}

MODBUS_TCP — Generic Ethernet device

// drivers/GENERIC_MODBUS_TCP.json — Modbus TCP, single read-holding-register
{
  "id": "GENERIC_MODBUS_TCP", "enabled": true,
  "connection": {
    "protocol": "MODBUS_TCP",
    "host": "192.168.1.100",
    "tcp_port": 502,
    "unit_id": 1,
    "timeout": 1000
  },
  "commands": [
    {
      "parameter": "TEMPERATURE", "unit": "CELSIUS", "type": "read",
      "write": { "cmd": "0300010001" },  // PDU: func=03, addr=0x0001, count=1 (no MBAP here)
      "read":  { "parser": "MODBUS_TCP", "bufsize": 11, "factor": 0.1 }
    }
  ]
}

// config/topology.json — override host per instance
{
  "id": "temp-sensor-1",
  "driver_file": "GENERIC_MODBUS_TCP.json",
  "port": "TCP",
  "keep_alive": false,
  "enabled": true,
  "connection": { "host": "10.0.0.50", "unit_id": 3 }  // overrides driver defaults
}

Broadcast (no write.cmd) — IAKR thermohygrometer

// Device sends data automatically; no request needed.
// Two commands share the same response line: "T;025.50;F;060.00"
{
  "id": "IAKR", "enabled": true,
  "connection": { "protocol": "STRING", "baud": 9600, ... },
  "commands": [
    {
      "parameter": "TEMPERATURE", "unit": "CELSIUS", "type": "read",
      // no "write" field
      "read": { "parser": "T;[+-]?([0-9]{3}[.]){1}[0-9]{2}" }
    },
    {
      "parameter": "RELATIVE_HUMIDITY", "unit": "%", "type": "read",
      "read": { "parser": "F;[+-]?([0-9]{3}[.]){1}[0-9]{2}" }
    }
  ]
}

10. Complete field template

// drivers/MY_DEVICE.json
{
  "id":      "MY_DEVICE",                 // required — unique, uppercase
  "enabled": true,                       // required — true | false
  "version": "1",                        // optional

  "info": {                               // optional block
    "displayName":  "Brand Model-X",
    "model":        "Model-X",
    "manufacturer": "Brand",
    "serie":        "X-Series",         // optional
    "type":         "thermometer"        // thermometer | scales | barometer |
                                           // thermphygrometer | multichannel thermometer |
                                           // thermohygrometer with barometer | comparator
  },

  "connection": {                         // required block. Topology can override any field.
    "protocol": "STRING",               // STRING | STRING_BINARY | BINARY | MODBUS_RTU | MODBUS_TCP
    "timeout":  1000,                    // ms — how long to wait for a response (all transports)

    // Serial fields — used by STRING / STRING_BINARY / BINARY / MODBUS_RTU
    "baud":     9600,                    // 1200 | 2400 | 4800 | 9600 | 19200 | 38400 | ...
    "parity":   0,                       // 0 = none | 1 = even
    "stopBit":  1,                       // 1 = 1 bit | 2 = 2 bits | 15 = 1.5 bits

    // TCP fields — used by MODBUS_TCP (serial fields are ignored)
    "host":     "192.168.1.100",         // IP address or hostname of the device/gateway
    "tcp_port": 502,                     // TCP port (default: 502)
    "unit_id":  1                         // Modbus unit ID in MBAP header (default: 1)
  },

  "commands": [
    {
      "parameter": "TEMPERATURE",         // required — TEMPERATURE | WEIGHT | PRESSURE |
                                           // RELATIVE_HUMIDITY | TEMPERATURE_1 | ...
      "unit":      "CELSIUS",             // required — CELSIUS | g | % | hPa | ...
      "type":      "read",                // required — read | command

      "write": {                          // optional — omit for broadcast devices
        "cmd": "d\r",                    // STRING: ASCII string  ("d\r", "SI\r\n")
                                           // BINARY: hex string    ("010300010001D5CA")
        "dtr": "SET_DTR",               // optional — SET_DTR | CLEAR_DTR
        "rts": "SET_RTS",               // optional — SET_RTS | CLEAR_RTS
        "brk": "IGNORE"                 // optional — IGNORE
      },

      "read": {                           // required block
        "parser":    "[+-]?\\d+\\.\\d+", // required — regex (STRING)
                                           //           "BE"          (binary, big-endian int)
                                           //           "BE_DECIMAL"  (binary, ASCII decimal)
                                           //           "MODBUS_RTU"  (Modbus RTU frame)
                                           //           "MODBUS_TCP"  (Modbus TCP — strips MBAP header)
        "validator": "S",               // optional — regex; no match → status UNSTABLE
        "offset":    6,                   // optional — byte offset (BE / BE_DECIMAL)
        "length":    2,                   // optional — byte count  (BE / BE_DECIMAL)
                                           //            2 → uint16 | 4 → uint32
        "head":      "1002",             // optional — expected hex header bytes
        "tail":      "1004",             // optional — expected hex footer bytes
        "bufsize":   64,                  // optional — bytes to read (default: 64)
        "factor":    0.01,                // optional — raw × factor = value (default: 1.0)
                                           //            raw 2500 × 0.01 = 25.00 °C
                                           //            ignored when expression is set
        "expression": "value * 1.8 + 32" // optional — arithmetic expression; takes precedence
                                           //            over factor. Variable: value (parsed raw)
                                           //            e.g. "value * 0.03527396" (g → oz)
      }
    }
  ]
}