Skip to main content
Version: 1.0

IR

caution

Available as preview. The API is subject to change.

note

Available for Gen 4 devices with IR hardware.

IR components are a subset of dynamic components for managing infrared remote controls. The system supports learning IR signals from physical remotes, storing them, and transmitting them on demand.

Each IR device (remote control) can hold multiple IR codes. Codes can be learned from physical remotes using IRDevice.LearnCode or stored from external sources (e.g., Home Assistant IR code databases) using IRDevice.StoreCode. Devices and codes are persisted across reboots.

Each IR device can have a type describing what kind of appliance it controls (e.g., "tv", "ac", "fan"), and each IR code a function describing what the button does (e.g., "power_on", "volume_up"). Both are free-form strings and are not checked against a list.

The management is accomplished through RPC methods within the IR namespace:

Available IR components:

Methods​

IR.GetConfig​

Find the IR.GetConfig response properties in config section

IR.SetConfig​

PropertyTypeDescription

config

object

Configuration that the method takes

Find more about the config properties in config section

IR.GetStatus​

Does not own status at the moment.

IR.AddDevice​

Parameters:

PropertyTypeDescription

config

object

Configuration for the new device

PropertyTypeDescription

name

string

Name of the IR device (e.g., "Living Room TV", "Bedroom AC"). name length should not exceed 64 chars. Required

type

string or null

Kind of appliance the IR device controls (e.g., "tv", "ac", "fan"). See IRDevice configuration. type length should not exceed 64 chars. Optional

model

string or null

Model of the device the codes are imported from (e.g., from an IR library). See IRDevice configuration. model length should not exceed 64 chars. Optional

id

number

Id for the new component. Accepted range: [200..299]. Optional. If omitted, the first free ID will be used.

Response​

The result is a JSON object with the newly assigned component ID.

PropertyTypeDescription

id

number

Id of the created IRDevice component

IR.DeleteDevice​

Deletes an IRDevice and all its child IRCode components (cascading delete).

Parameters:

PropertyTypeDescription

id

number

Id of the IR device to delete. Required

IR.EmitRaw​

Transmit a raw IR signal on demand. The pulse timings are passed at call time -- no learning, no stored component is created. Returns immediately; actual transmission is asynchronous.

Parameters:

PropertyTypeDescription

timings

array

List of signed pulse durations in microseconds. Positive values are marks (carrier on), negative values are spaces (carrier off). Accepted length: [1..1024]. Required

freq

number

Carrier frequency in Hz. Accepted range: [20000..60000]. Optional, default: 38000

sends

number

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

Response​

null on success.

Configuration​

The configuration of the IR component. To Get/Set the configuration, use IR.GetConfig / IR.SetConfig.

Properties:

PropertyTypeDescription

raw_receive

boolean

Enable raw receive notifications. When enabled, a raw_receive notification event is fired for every received IR signal (when not in learning mode). Default: false

Notifications​

Instances of the IR component can send notifications for the following events:

  • raw_receive - produced when an IR signal is received and raw_receive is enabled in the configuration. The event carries the raw timings as signed microseconds -- the same format IR.EmitRaw accepts.

Examples​

IR.GetConfig example​

http://192.168.33.1/rpc/IR.GetConfig?

Response

{
"raw_receive": false
}

IR.SetConfig example​

http://192.168.33.1/rpc/IR.SetConfig?config={"raw_receive":true}

Response

{
"restart_required": false
}

IR.AddDevice example​

http://192.168.33.1/rpc/IR.AddDevice?config={"name":"Living Room TV","type":"tv","model":"BN59-01199F"}

Response

{
"id": 200
}

IR.DeleteDevice example​

http://192.168.33.1/rpc/IR.DeleteDevice?id=200

Response

{}

IR.EmitRaw example​

http://192.168.33.1/rpc/IR.EmitRaw?timings=[9000,-4500,560,-1690,560,-560,560,-40000]&freq=38000&sends=1

Response

null