Skip to content

MQTT Topic Reference

This section details the MQTT topics used by IR2MQTT. This is useful for debugging, manual integration, or using the application in standalone mode.

Standalone Mode

In standalone mode, topics use readable names (e.g. living_room_tv) or IDs depending on your settings.

Subscriptions (Input)

  • ir2mqtt/devices/{device}/{button}/in: Send PRESS to trigger a button.
  • ir2mqtt/automations/{automation}/trigger: Send PRESS to trigger an automation.

Publications (Output)

  • ir2mqtt/devices/{device}/last_button: Name of the last received button.
  • ir2mqtt/devices/{device}/{button}/out: State (ON/OFF) for input buttons.
  • ir2mqtt/devices/{device}/{button}/event: Published when an event button is received.
  • ir2mqtt/automations/{automation}/state: State (ON/OFF) of an automation.
  • ir2mqtt/automations/{automation}/event: JSON payload when an automation fires an event.

Home Assistant Mode

In this mode, topics use internal IDs to ensure stability.

Subscriptions (Input)

  • ir2mqtt/cmd/{device_id}/{button_id}: Send PRESS to trigger a button.
  • ir2mqtt/automation/{automation_id}/trigger: Send PRESS to trigger an automation.

Publications (Output)

  • ir2mqtt/status/{device_id}/last_button: Name of the last received button.
  • ir2mqtt/events/{device_id}: Payload is the button name. Used for HA device triggers.
  • ir2mqtt/input/{device_id}/{button_id}/state: State (ON/OFF) for binary sensors.
  • ir2mqtt/automation/{automation_id}/state: State (ON/OFF) of an automation.
  • ir2mqtt/automation_event/{automation_id}/{event}/state: Payload press when an automation fires an HA event.

Bridge Communication

The bridge firmware communicates with the backend using newline-delimited JSON over MQTT (or UART in serial mode). The MQTT base topic is ir2mqtt/bridge/<device_id>.

TopicDirectionRetainedDescription
.../configBridge → HostYesStatic configuration, published on boot or get_config.
.../stateBridge → HostYesDynamic state (online status, enabled protocols). LWT sets {"online": false}.
.../receivedBridge → HostNoIR signal received by the bridge.
.../commandHost → BridgeNoCommands sent to the bridge (send, set_protocols, etc.).
.../responseBridge → HostNoResponse to commands that include a request_id.

Bridge → Host Messages

Discovery (/config) — retained

Sent on boot, MQTT reconnect, or when get_config is received.

json
{
  "type": "config",
  "id": "28562f9056c4",
  "name": "ir2mqtt-bridge-lan",
  "version": "2024.6.0",
  "mac": "28:56:2F:90:56:C4",
  "ip": "192.168.1.50",
  "network_type": "ethernet",
  "receivers": [{ "id": "rx1" }],
  "transmitters": [{ "id": "tx1" }],
  "capabilities": ["nec", "samsung", "raw"],
  "enabled_protocols": ["nec", "samsung"]
}

ip and network_type are omitted in serial-only mode.

State (/state) — retained

Sent on boot or when enabled protocols change. The broker publishes {"online": false} as the LWT on unexpected disconnect.

json
{
  "type": "state",
  "request_id": "12345",
  "online": true,
  "enabled_protocols": ["nec", "samsung", "raw"]
}

Received IR (/received)

Fired when a signal is decoded by an active protocol. All protocol-specific data is in the payload object.

json
{
  "type": "received",
  "protocol": "nec",
  "receiver_id": "rx1",
  "timestamp": 123456,
  "payload": {
    "address": "0xFF00",
    "command": "0x1A"
  }
}

Unmatched signals are decoded as raw:

json
{
  "type": "received",
  "protocol": "raw",
  "receiver_id": "rx1",
  "timestamp": 123500,
  "payload": {
    "timings": [8976, -2239, 609, -1000]
  }
}

Host → Bridge Commands (/command)

All commands accept an optional "request_id" field. If present, the bridge replies with {"request_id": "...", "success": true/false} on /response.

Send IR

transmitter_id can be a string, an array, or omitted (broadcasts to all transmitters).

json
{
  "command": "send",
  "transmitter_id": "tx1",
  "code": {
    "protocol": "nec",
    "payload": {
      "address": "0xFF00",
      "command": "0x1A",
      "repeats": 1
    }
  }
}

RAW send (frequency defaults to 38000 if omitted):

json
{
  "command": "send",
  "code": {
    "protocol": "raw",
    "payload": {
      "frequency": 38000,
      "timings": [8976, -2239, 609, -1000]
    }
  }
}

Set Active Protocols

Changes are persisted to flash on the bridge.

json
{ "command": "set_protocols", "protocols": ["nec", "samsung", "raw"] }

Status Commands

CommandEffect
{"command": "get_state"} or {"command": "ping"}Re-publishes /state
{"command": "get_config"}Re-publishes /config

Protocol Payload Reference

All fields below go inside the "payload" object when sending, and are returned inside "payload" in a received message.

ProtocolFieldTypeNotes
necaddress, command0xHEX / int16-bit address and command.
repeatsintOptional, default 0.
samsungdata0xHEX / int6464-bit data packet.
nbitsintOptional, default 32.
samsung36address, command0xHEX / int16-bit address, 32-bit command.
sonydata0xHEX / int32-bit data.
nbitsintOptional, default 12.
panasonicaddress, command0xHEX / int16-bit address, 32-bit command.
rc5address, command0xHEX / int8-bit address and command.
rc6address, command0xHEX / int8-bit fields.
mode, toggleintOptional, default 0.
jvcdata0xHEX / int32-bit data.
lgdata0xHEX / int32-bit data.
nbitsintOptional, default 28.
coolixfirst, second0xHEX / intTwo 24-bit codes.
pioneerrc_code_1, rc_code_20xHEX / intTwo 16-bit codes.
dishaddress, command0xHEX / int8-bit address and command.
mideadataarrayArray of 0xHEX or integers (bytes).
haierdataarrayArray of 0xHEX or integers (bytes).
rawtimingsarrayArray of signed integers (µs).
frequencyintOptional, default 38000.
prontodatastringSend only. Hex string format.
deltaintOptional, default 0.
aehaaddress0xHEX16-bit address.
dataarrayByte array.
abbwelcomeaddress, command0xHEX / int32-bit source address, 8-bit message type.
beo4command0xHEX / int8-bit command.
source0xHEX / intOptional.
byronsxaddress, command0xHEX / int8-bit address and command.
canalsatdevice, command0xHEX / int8-bit fields. address optional.
canalsat_lddevice, command0xHEX / int8-bit fields. address optional.
dooyaaddress, command0xHEX / int32-bit motor ID, 8-bit button code. channel optional.
draytonaddress, command0xHEX / int16-bit address, 8-bit command.
dysonaddress, command0xHEX / int16-bit code, 8-bit index.
goboxdataintSingle integer code.
keeloqencrypted, serial0xHEX / int32-bit encrypted portion and 32-bit serial.
magiquestid, magnitude0xHEX / int32-bit Wand ID and 16-bit magnitude.
miragedataarrayArray of 0xHEX or integers (bytes).
nexadevice0xHEX / int32-bit device ID.
group, state, channel, levelint8-bit fields.
rc_switchcode0xHEX / int6464-bit code.
protocolintOptional, default 1.
roombacommand0xHEX / int8-bit command.
symphonydata0xHEX / int32-bit code.
nbitsintOptional, default 12.
toshiba_acrc_code_1, rc_code_20xHEX / int64Two 64-bit data chunks.
totocommand0xHEX / int8-bit command.

Data type legend:

  • 0xHEX / int — A JSON string starting with 0x (e.g. "0xFF00") or a raw integer (e.g. 65280).
  • 0xHEX / int64 — Same, but supports 64-bit values (needed for samsung, toshiba_ac).
  • array — A JSON array, e.g. [255, 128, "0x0A"].