OREI HDMI Matrix - HTTP JSON API Reference
This document describes the OREI HDMI Matrix HTTP JSON API used by TMRemote.
API Endpoint
All commands are sent via HTTP POST to:
POST http://{matrix-ip}/cgi-bin/instr
Content-Type: application/json
Default Matrix IP: 192.168.0.100
Power Control
Power On
{
"comhead": "set poweronoff",
"language": 0,
"power": 1
}
Power Off (Standby)
{
"comhead": "set poweronoff",
"language": 0,
"power": 0
}
Preset Management
Recall Preset
Load a saved preset configuration (1-8):{
"comhead": "preset set",
"language": 0,
"index": 1
}
Parameters:
index: Preset number (1-8)
{
"comhead": "preset set",
"language": 0,
"index": 3
}
Save Preset
Save current routing to a preset slot:{
"comhead": "preset save",
"language": 0,
"index": 1
}
Note: This command is not currently implemented in TMRemote but can be added if needed.
Video Routing
Set Single Output
Route a specific input to a specific output:{
"comhead": "video switch",
"language": 0,
"source": [2, 1]
}
Parameters:
source: Array with 2 elements:[input, output]
{
"comhead": "video switch",
"language": 0,
"source": [2, 1]
}
Windows Command:
curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"video switch\",\"language\":0,\"source\":[2,1]}"
Set All Outputs
Route inputs to all outputs at once:{
"comhead": "set allsource",
"language": 0,
"source": [1, 2, 3, 4, 5, 6, 7, 8]
}
Parameters:
source: Array of 8 input numbers (one for each output)
{
"comhead": "set allsource",
"language": 0,
"source": [3, 3, 1, 1, 5, 5, 2, 2]
}
This routes:
- Output 1 → Input 3
- Output 2 → Input 3
- Output 3 → Input 1
- Output 4 → Input 1
- Output 5 → Input 5
- Output 6 → Input 5
- Output 7 → Input 2
- Output 8 → Input 2
Status Queries
Get System Status
Query power status and system information:{
"comhead": "get system status",
"language": 0
}
Response:
{
"comhead": "get system status",
"power": 1,
"baudrate": 6,
"beep": 0,
"lock": 0,
"mode": 3,
"version": "v1.0.0"
}
Fields:
power: 1=ON, 0=Standbybaudrate: Serial baud rate settingbeep: Beep on/offlock: Front panel lockmode: Operating modeversion: Firmware version
Get Video Status
Query current routing and preset information:{
"comhead": "get video status",
"language": 0
}
Response:
{
"comhead": "get video status",
"allsource": [1, 2, 3, 4, 5, 6, 7, 8],
"presetname": ["Atom-4", "Gaming", "Movies", "Sports", "", "", "", ""]
}
Fields:
allsource: Array of current routing (position = output, value = input)presetname: Array of preset names (empty strings for unnamed presets)
{
"allsource": [3, 3, 1, 1, 5, 5, 2, 2],
"presetname": ["Atom-4", "Gaming", "", "", "", "", "", ""]
}
This shows:
- Output 1 is showing Input 3
- Output 2 is showing Input 3
- Output 3 is showing Input 1
- etc.
Get Output Status
Query output port configuration:{
"comhead": "get output status",
"language": 0
}
Response:
{
"comhead": "get output status",
"name": ["TV1", "TV2", "Projector", "Monitor", "Output5", "Output6", "Output7", "Output8"]
}
Fields:
name: Array of custom output names
Get Input Status
Query input port configuration:{
"comhead": "get input status",
"language": 0
}
Response:
{
"comhead": "get input status",
"inname": ["PC", "Xbox", "PS5", "Apple TV", "Input5", "Input6", "Input7", "Input8"]
}
Fields:
inname: Array of custom input names
External Audio Control
Set External Audio Output
Route audio from a specific input to external audio output:{
"comhead": "set extaudio",
"language": 0,
"source": 3
}
Parameters:
source: Input number (1-8) to route to external audio
{
"comhead": "set extaudio",
"language": 0,
"source": 3
}
Disable External Audio
{
"comhead": "set extaudio",
"language": 0,
"source": 0
}
Note: Setting source to 0 disables external audio output.
EDID Management
Set EDID Mode
{
"comhead": "set edid",
"language": 0,
"edid": [input, mode]
}
Parameters:
input: Input number (1-8)mode: EDID mode (see table below)
| Value | EDID Mode |
|---|---|
| 1 | 1080P, Stereo Audio 2.0 |
| 2 | 1080P, Dolby/DTS 5.1 |
| 3 | 1080P, HD Audio 7.1 |
| 10 | 4K60(444), Stereo Audio 2.0 |
| 21 | 4K60(420)_HDR, HD Audio 7.1 |
| 36 | FRL12G_8K_HDR, HD Audio 7.1 |
| 24 | COPY_FROM_OUTPUT_1 |
| 25 | COPY_FROM_OUTPUT_2 |
| 26 | COPY_FROM_OUTPUT_3 |
| 27 | COPY_FROM_OUTPUT_4 |
| 28 | COPY_FROM_OUTPUT_5 |
| 29 | COPY_FROM_OUTPUT_6 |
| 30 | COPY_FROM_OUTPUT_7 |
| 31 | COPY_FROM_OUTPUT_8 |
{
"comhead": "set edid",
"language": 0,
"edid": [1, 21]
}
Windows Command:
curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"set edid\",\"language\":0,\"edid\":[1,21]}"
Example - Set Input 2 to copy EDID from Output 1:
{
"comhead": "set edid",
"language": 0,
"edid": [2, 24]
}
Windows Command:
curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"set edid\",\"language\":0,\"edid\":[2,24]}"
Usage in TMRemote
Implemented Commands
CLI:<h1>Power</h1>
TMRemote.exe MATRIX_ON
TMRemote.exe MATRIX_OFF
<h1>Video Routing</h1>
TMRemote.exe SWITCH 2 5
<h1>Presets</h1>
TMRemote.exe PRESET1
TMRemote.exe PRESET8
<h1>EDID Configuration</h1>
TMRemote.exe SET_EDID 1 21
TMRemote.exe SET_EDID 2 24
<h1>Status</h1>
TMRemote.exe CHECK_POWER
TMRemote.exe CHECK_VIDEO
TMRemote.exe CHECK_OUTPUT
TMRemote.exe CHECK_INPUT
GUI:
- Matrix Power button (⚡MTX)
- Preset buttons 1-8
- Status bar dropdown menu
Not Yet Implemented
The following API commands are not currently implemented in TMRemote but can be added:
- External Audio - Route audio to external output
# Proposed CLI syntax: TMRemote.exe SET_EXTAUDIO 3 # Route Input 3 audio to external```
- Save Presets - Save current routing to preset slot
bash # Proposed CLI syntax: TMRemote.exe SAVE_PRESET 1 # Save current routing to Preset 1`
<h2>Adding New Commands to TMRemote</h2>
To add video routing or other commands to TMRemote:<h3>1. Add to CommandControl.cs</h3>
<h4>For Matrix Commands (GetCommandPayload method):</h4></code></pre>csharp // Set single output if (command == "SET_OUTPUT" && modifier != null) { var parts = modifier.Split(','); if (parts.Length == 2 && int.TryParse(parts[0], out int output) && int.TryParse(parts[1], out int input)) { return JsonSerializer.Serialize(new { comhead = "set video", language = 0, index = output, source = input }); } }// Set all outputs if (command == "SET_ALL" && modifier != null) { var parts = modifier.Split(','); if (parts.Length == 8) { var sources = new int[8]; for (int i = 0; i < 8; i++) { if (!int.TryParse(parts[i], out sources[i])) return null; } return JsonSerializer.Serialize(new { comhead = "set allsource", language = 0, source = sources }); } }
2. Add to s_staticCommands Dictionary
csharp { "SET_OUTPUT", "set video" }, { "SET_ALL", "set allsource" }, { "SET_EXTAUDIO", "set extaudio" }, { "SAVE_PRESET", "preset save" },`csharp Console.WriteLine("🎬 Video Routing:"); Console.WriteLine(" SET_OUTPUT<h3>3. Update Help Text (Program.cs)</h3>Route input to output"); Console.WriteLine(" SET_ALL <1,2,3...> Set all outputs"); Console.WriteLine(); Console.WriteLine("🔊 External Audio:"); Console.WriteLine(" SET_EXTAUDIO Route input to ext audio"); powershell Invoke-RestMethod -Uri "http://192.168.0.100/cgi-bin/instr" -Method POST -ContentType "application/json" -Body '{"comhead":"set poweronoff","language":0,"power":1}'<h3>4. Add GUI Controls (Optional)</h3>Create a routing matrix UI in RemoteForm.cs with:
- 8x8 grid of buttons for input→output mapping
- External audio selector dropdown
- Preset save/load interface
<h2>Testing API Commands (Windows)</h2>
<h3>Using curl (Windows Command Prompt):</h3> <pre><code>curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"set poweronoff\",\"language\":0,\"power\":1}"curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"get video status\",\"language\":0}"
curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"video switch\",\"language\":0,\"source\":[3,1]}"curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"set allsource\",\"language\":0,\"source\":[1,2,3,4,5,6,7,8]}"</code></pre>
<h3>Using PowerShell:</h3>Invoke-RestMethod -Uri "http://192.168.0.100/cgi-bin/instr" -Method POST -ContentType "application/json" -Body '{"comhead":"get video status","language":0}'
Invoke-RestMethod -Uri "http://192.168.0.100/cgi-bin/instr" -Method POST -ContentType "application/json" -Body '{"comhead":"video switch","language":0,"source":[3,1]}'Invoke-RestMethod -Uri "http://192.168.0.100/cgi-bin/instr" -Method POST -ContentType "application/json" -Body '{"comhead":"set allsource","language":0,"source":[1,2,3,4,5,6,7,8]}'
"language": 0` parameter
Common Patterns (Windows)
Query Before Change
REM 1. Query current routing curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"get video status\",\"language\":0}"REM 2. Make changes - Route Input 3 to Output 1 curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"video switch\",\"language\":0,\"source\":[3,1]}"
REM 3. Verify change curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"get video status\",\"language\":0}"Save Custom Routing as Preset
REM 1. Set desired routing curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"set allsource\",\"language\":0,\"source\":[3,3,1,1,5,5,2,2]}"REM 2. Save to preset curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"preset save\",\"language\":0,\"index\":1}"
REM 3. Test recall curl -X POST http://192.168.0.100/cgi-bin/instr -H "Content-Type: application/json" -d"{\"comhead\":\"preset set\",\"language\":0,\"index\":1}"
Notes
- All commands require
Last Updated: 2025 TMRemote Version: 1.0 Target Device: OREI HDMI Matrix (HTTP JSON API)