MQTT connection

If you want to use your own custom-developed software while still working with Realix hardware and software devices, such as the SBUS Box or the Audio Box, you can do so via MQTT.

In the Designer you start a new project and choose it creation that you want to use MQTT. The Realix puzzle flow is then disabled and invisible. You just create the devices and objects as in a regular project, but now you can control them over MQTT. To start the MQTT, you have to load the configuration and start the logics (buts as said, not a puzzle flow).

In the Designer, you start a new project and select MQTT as the desired creation mode. The Realix puzzle flow is then disabled and hidden. You can create devices and objects just like in a regular project, but they can now be controlled via MQTT. To start MQTT communication, load the configuration and start the logic, there is no puzzle flow involved.

Topic conventions

Commands: erc/cmd/<objectType>/<objectId>/<command>
State:    erc/state/<objectType>/<objectId>

Special cases:

System state: erc/state/system
Device pods:  erc/state/devicenode/<deviceId>.<podId>

All payloads are JSON.

System and Device Topics

System State

The system topic is send when the ERC Core connects with MQTT. It has a retained state and when the ERC Core stops or suddenly disconnect, the state will go to offline. This way you can always determine if the ERC Core is online. License information is passed which can be used to inform your system a renew has to take place. Note: When you only use the SBUS hardware, the license is free of charge.

erc/state/system
{
  "online": true,
  "license": {
    "licenseActive": true,
    "expiryTime": "2026-01-31T23:59:59Z",
    "warnForExpiration": false,
    "requestedUserAction": "",
    "currentError": "NoError"
  }
}

Device State

erc/state/device/<deviceId>
{
  "value": "Connected",  // Disconnected, Connecting, Connected
}

Pod State

erc/state/devicenode/<deviceId>.<podId>
{
  "value": "Connected",  // Disconnected, Connecting, Connected
}

Request State

When request state is sent, the ERC responds by sending the system status and all device and pod states.

erc/cmd/system/system/requestState

Object State Topics

RFID Reader State

RFID tag unique serial identifier or assigned symbolic name.

erc/state/rfidreader/<readerId>
{
  "value": "Green Object", 
}

Input State

In most cases, 0 represents inactive and 1 represents active; however, additional integer values may be supported.

erc/state/input/<inputId>
{
  "value": 0,  
}

Sensor State

Provides an integer state value calculated from the analog input using thresholds defined in the Designer.

erc/state/sensor/<sensorId>
{
  "value": 0, 
}

Object Command Topics

Output commands

SetActive
erc/cmd/output/<objectId>/setActive
SetInactive
erc/cmd/output/<objectId>/setInactive
SetValue
erc/cmd/output/<objectId>/setValue
{
  "value": 1
}
Pulse
erc/cmd/output/<objectId>/pulse
{
  "duration": 100   // ms
}
PulseTrain
erc/cmd/output/<objectId>/pulseTrain
{
  "duration": 100,
  "duration2": 200,
}

Actuator Commands

SetPercentage
erc/cmd/actuator/<objectId>/setPercentage
{
  "percentage": 0    // 0-100
}
TransientPercentage
erc/cmd/actuator/<objectId>/transientPercentage
{
  "percentage": 75,   // 0-100
  "duration": 1000     // ms
}

Light Commands

SetLight
erc/cmd/light/<objectId>/setLight

Brightness only

{
  "intensity": 100   // % (0–100)
}

Temperature only

{
  "temperature": 50  // % (warm → white)
}

Color only

{
  "color": "#ff8800" // RGB hex color
}

Temperature + Brightness

{
  "temperature": 40, // % (warm → white)
  "intensity": 80    // % (0–100)
}

Color + Brightness

{
  "color": "#3366ff", // RGB hex color
  "intensity": 60     // % (0–100)
}
TransitionLight
erc/cmd/light/<objectId>/transitionLight

Brightness fade

{
  "intensity": 100,  // % (0–100)
  "duration": 1000  // ms
}

Temperature fade

{
  "temperature": 70, // % (warm → white)
  "duration": 1500  // ms
}

Color fade

{
  "color": "#ff0000", // RGB hex color
  "duration": 800    // ms
}

Color + Brightness fade

{
  "color": "#00ffcc", // RGB hex color
  "intensity": 75,    // % (0–100)
  "duration": 1200   // ms
}

AudioPlayer Commands

PlayMedia
erc/cmd/audioplayer/<objectId>/playMedia
{
  "mediaFile": "music.mp3", // filename
  "position": 0,            // seconds
  "loop": false,            // boolean
  "volume": 80              // % (0–100, optional)
}
StopMedia
erc/cmd/audioplayer/<objectId>/stopMedia
{
  "volume": 0,        // % (0–100)
  "duration": 500    // ms
}
FadeVolume
erc/cmd/audioplayer/<objectId>/fadeVolume
{
  "volume": 40,      // % (0–100)
  "duration": 1000  // ms
}
SetDuckingLevel
erc/cmd/audioplayer/<objectId>/setDuckingLevel
{
  "level": 60  // % (0 = no ducking, 100 = fully muted)
}

VideoPlayer Commands

PlayMedia

erc/cmd/videoplayer/<objectId>/playMedia
{
  "mediaFile": "intro.mp4", // filename
  "position": 0,            // seconds
  "loop": false,            // boolean
  "volume": 100             // % (0–100, optional)
}

StopMedia

erc/cmd/videoplayer/<objectId>/stopMedia
{
  "volume": 0,        // % (0–100)
  "duration": 500    // ms
}

FadeVolume

erc/cmd/videoplayer/<objectId>/fadeVolume
{
  "volume": 40,      // % (0–100)
  "duration": 1000  // ms
}

ImageViewer Commands

ShowImage

erc/cmd/imageviewer/<objectId>/showImage
{
  "mediaFile": "image.png" // filename
}

Hide

erc/cmd/imageviewer/<objectId>/hide

TextViewer Commands

ShowText

erc/cmd/textviewer/<objectId>/showText
{
  "text": "Welcome to the control room" // UTF-8 text
}

Hide

erc/cmd/textviewer/<objectId>/hide

CustomViewer Commands

ShowView

erc/cmd/customviewer/<objectId>/showView

Hide

erc/cmd/customviewer/<objectId>/hide

Lock Commands

Lock

erc/cmd/lock/task/lock
{
  "TaskName": "Main Door" // task name
}

Unlock

erc/cmd/lock/task/unlock
{
  "TaskName": "Main Door" // task name
}

Switch Commands

On

erc/cmd/switch/task/on
{
  "TaskName": "Main Power" // task identifier
}

Off

erc/cmd/switch/task/off
{
  "TaskName": "Main Power" // task identifier
}

Trigger Commands

LaunchTrigger

erc/cmd/trigger/task/launchtrigger
{
  "TaskName": "alarm_flash", // task identifier
  "RepeatCount": 5,          // number of repetitions (0 = infinite)
  "Duration": 1000           // ms between repetitions
}

CancelTrigger

erc/cmd/trigger/task/canceltrigger
{
  "TaskName": "alarm_flash" // task identifier
}

Related Articles