A standalone mock app built with Electron and Vite, with Codex-assisted development, providing an API Simulator, a Modbus TCP Simulator, and Modbus Bridge Mapping as a response source for the API Simulator.
npm installnpm start- Host / Port / API Path / Delay (ms).
- Response Source:
Scenario / Payload EditororModbus Bridge. - Request Log keeps the most recent 100 entries.
GET /healthGET /api/energyGET /api/energy?scenario=normalGET /api/energy?scenario=no-totalGET /api/energy?scenario=http-500GET /api/energy?scenario=invalid-jsonGET /api/energy?scenario=invalid-schemaGET /api/energy?scenario=timeoutGET /api/energy?scenario=custom
normal: full energy payloadno-total: removetotalhttp-500: respond with HTTP 500invalid-json: respond with invalid JSONinvalid-schema: respond with missing or invalid fieldstimeout: delay response (min 10s)custom: respond with current Payload Editor content
Scenario can be overridden per request with ?scenario=....
When Response Source is Modbus Bridge, the API response payload is always the bridge payload (scenario is only used for logging and delay).
- Apply current JSON to
customscenario. - Format JSON and reset example payload for the current scenario.
- Host / Port / Unit ID.
- Request Address Base Mode:
- Standard 0-based: request address 0 = internal 0.
- Legacy 1-based: request address 1 = internal 0 (request 0 still resolves to 0).
- Address Input Mode:
- Reference Address / 1-based: input
1or full address like100001for the first point. Input0is invalid. - Protocol Address / 0-based: input
0for the first point.
- Reference Address / 1-based: input
Countmust be a multiple of the type span (e.g.int= 2 registers,long= 4 registers).
- Coil 0x
- Discrete Input 1x
- Input Register 3x
- Holding Register 4x
- FC01 Read Coils
- FC02 Read Discrete Inputs
- FC03 Read Holding Registers
- FC04 Read Input Registers
- FC05 Write Single Coil
- FC06 Write Single Holding Register
- FC15 Write Multiple Coils
- FC16 Write Multiple Holding Registers
- short / int / long / float / double / binary
- HL / LH word order (multi-register types)
- actions: manual / random / increment / toggle / sine
- request log (latest 100 entries)
Internal address uses Modbus protocol address (0-based).
Display (Reference) address:
- Coil 0x: address 0 = 000001
- Discrete Input 1x: address 0 = 100001
- Input Register 3x: address 0 = 300001
- Holding Register 4x: address 0 = 400001
- Port 502 may require admin privileges. For local testing, use 1502.
- Discrete Input 1x and Input Register 3x are read-only.
- Coil 0x and Holding Register 4x are writable.
longuses 64-bit signed integer encoding. Use integer strings in the UI when exceeding JavaScript safe integer range.
Controls how undefined Coil/Discrete Input addresses are handled during reads:
Compatibility: undefined addresses return false / 0.Strict: undefined addresses return Modbus exception.
Simulates PLC/DDC feedback by writing Coil changes into Discrete Input.
Disabled: no auto feedback.Coil write → Discrete Input same address: after Coil write or manual Coil apply, update Discrete Input at the same offset.
Example:
Coil 000001 = true
=> Discrete Input 100001 = true
Note: this is not a Coil/Discrete Input mirror. It only updates Discrete Input on Coil writes or manual Coil apply.
Bridge does not provide a standalone HTTP API server. The API response uses Bridge data only when the API Simulator Response Source is set to Modbus Bridge.
Bridge roles:
- data source for Modbus TCP Simulator points
- response source for API Simulator
- Mapping Table / Preset / Payload Preview / Diagnostics settings
- Internal mapping key is
regType + protocolAddress(not point ID or reference address). - JSON Path supports dot notation only (no array path).
- Transform types:
raw,number,boolean,string. - Optional fallback value per mapping.
Default presets:
Sample Booleansample.coil1 <= coil protocolAddress 0sample.discreteInput1 <= discreteInput protocolAddress 0
Plumbing Pump Statusplumbing.pumps.pump1.run <= discreteInput protocolAddress 0plumbing.pumps.pump1.fault <= discreteInput protocolAddress 1- ...
plumbing.pumps.pump11.run <= discreteInput protocolAddress 20plumbing.pumps.pump11.fault <= discreteInput protocolAddress 21
User presets can be created, saved, and deleted in the Bridge Mapping panel.
- Start Modbus TCP Simulator.
- Configure points and address modes.
- In Bridge Mapping advanced settings, select a preset and adjust mappings if needed.
- Use Payload Preview and Diagnostics to confirm output.
- Back in API Simulator, switch response source to Modbus Bridge.
- Start API Server and call the API Simulator URL.