Skip to main content
Version: 1.0

IRCode

IRCode components store individual IR signals and can transmit them on demand. Each IRCode belongs to a parent IRDevice.

IRCode instances are identified with ircode:<id> where <id> is in the dynamic range (200-299).

Methods:

Methods​

IRCode.GetStatus​

Parameters:

PropertyTypeDescription

id

number

Id of the component instance. Required

Find more about the status response properties in status section

IRCode.GetConfig​

Parameters:

PropertyTypeDescription

id

number

Id of the component instance. Required

Find the IRCode.GetConfig response properties in config section

IRCode.SetConfig​

PropertyTypeDescription

id

number

Id of the component instance. Required

config

object

Configuration that the method takes

Find more about the config properties in config section

IRCode.Emit​

Transmit the stored IR code.

Parameters:

PropertyTypeDescription

id

number

Id of the IRCode instance. Required

sends

number

Total number of transmissions (1 = send once). Accepted range: [1..10]. Optional, default: 1

after

number

Delay in seconds before the first transmission and between repeats. Accepted range: [0..10]. Optional, default: 0

Configuration​

The configuration of the IRCode component contains the code name, function, parent device, carrier frequency, and the stored IR signal timings. To Get/Set the configuration of the IRCode component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

name

string

Code name (e.g., "power", "vol_up"). name length should not exceed 64 chars

function

string or null

What the code does (e.g., "power_on", "volume_up"). function length should not exceed 64 chars. Optional, set to null to clear. Recommended values (not enforced): power_toggle, power_on, power_off, volume_up, volume_down, mute, channel_up, channel_down, input, digit_0...digit_9, up, down, left, right, ok, back, menu, home, play, pause, play_pause, stop, next, previous, mode, temp_up, temp_down, fan_speed, swing, speed_up, speed_down, oscillate, brightness_up, brightness_down. AC remotes usually send the full state with every press, so AC codes can use free-named presets (e.g., cool_22)

device_id

number

Id of the parent IRDevice

freq

number

Carrier frequency in Hz. Accepted range: [20000..60000]. Default: 38000

timings

array

Stored IR signal as signed pulse durations in microseconds. Positive values are marks (carrier on), negative values are spaces (carrier off). Same format as IR.EmitRaw.

Status​

The status of the IRCode component contains its unique identifier and information about the stored IR signal. To obtain the status of the IRCode component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

uid

string or null

Unique identifier of the IR code (UUID). Generated when the IR code is created and never reused: a new IR code gets a new uid even when it gets the id of a deleted one. null for IR codes stored by an older firmware version

symbols

number

Number of symbols in the stored IR code

Webhook Events​

Available events from IRCode component that can trigger webhooks:

  • ircode.emit - produced when an IR code is transmitted
  • ircode.receive - produced when an incoming IR signal matches the stored code

Examples​

IRCode.GetConfig example​

http://192.168.33.1/rpc/IRCode.GetConfig?id=201

Response

{
"id": 201,
"name": "power",
"function": "power_on",
"device_id": 200,
"freq": 38000,
"timings": [
9000,
-4500,
560,
-1690,
560,
-560,
560,
-40000
]
}

IRCode.SetConfig example​

http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"name":"pwr","function":"power_on"}

Response

{
"restart_required": false
}

IRCode.SetConfig example​

http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"function":null}

Response

{
"restart_required": false
}

IRCode.SetConfig example​

http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"device_id":200}

Response

{
"restart_required": false
}

IRCode.SetConfig example​

http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":40000}

Response

{
"restart_required": false
}

IRCode.GetStatus example​

http://192.168.33.1/rpc/IRCode.GetStatus?id=201

Response

{
"id": 201,
"uid": "9985fb6e-d805-4ebe-a4fa-12af2541aee5",
"symbols": 34
}

IRCode.Emit example​

http://192.168.33.1/rpc/IRCode.Emit?id=201&sends=1&after=3

Response

null