IR
Available as preview. The API is subject to change.
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:
IR.GetConfigto obtain the component's configurationIR.SetConfigto update the component's configurationIR.GetStatusto obtain the component's statusIR.AddDeviceto create a new IR deviceIR.DeleteDeviceto delete an IR device and all its codesIR.EmitRawto transmit a raw IR signal on demand (no learning/storage)
Available IR components:
Methods
IR.GetConfig
Find the IR.GetConfig response properties in config section
IR.SetConfig
| Property | Type | Description |
|---|---|---|
| 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:
| Property | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| object | Configuration for the new device
| ||||||||||||
| number | Id for the new component. Accepted range: |
Response
The result is a JSON object with the newly assigned component ID.
| Property | Type | Description |
|---|---|---|
| number | Id of the created IRDevice component |
IR.DeleteDevice
Deletes an IRDevice and all its child IRCode components (cascading delete).
Parameters:
| Property | Type | Description |
|---|---|---|
| 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:
| Property | Type | Description |
|---|---|---|
| array | List of signed pulse durations in microseconds. Positive values are marks (carrier on), negative values are spaces (carrier off). Accepted length: |
| number | Carrier frequency in Hz. Accepted range: |
| number | Total number of transmissions (1 = send once). Accepted range: |
Response
null on success.
Configuration
The configuration of the IR component. To Get/Set the configuration, use IR.GetConfig / IR.SetConfig.
Properties:
| Property | Type | Description |
|---|---|---|
| boolean | Enable raw receive notifications. When enabled, a |
Notifications
Instances of the IR component can send notifications for the following events:
raw_receive- produced when an IR signal is received andraw_receiveis enabled in the configuration. The event carries the raw timings as signed microseconds -- the same formatIR.EmitRawaccepts.
Examples
IR.GetConfig example
- IR.GetConfig HTTP GET Request
- IR.GetConfig Curl Request
- IR.GetConfig Mos Request
http://192.168.33.1/rpc/IR.GetConfig?
curl -X POST -d '{"id":1,"method":"IR.GetConfig","params":{}}' http://${SHELLY}/rpc
mos --port ${PORT} call IR.GetConfig '{}'
Response
- IR.GetConfig HTTP GET Response
- IR.GetConfig Curl Response
- IR.GetConfig Mos Response
{
"raw_receive": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"raw_receive": false
}
}
{
"raw_receive": false
}
IR.SetConfig example
- IR.SetConfig HTTP GET Request
- IR.SetConfig Curl Request
- IR.SetConfig Mos Request
http://192.168.33.1/rpc/IR.SetConfig?config={"raw_receive":true}
curl -X POST -d '{"id":1,"method":"IR.SetConfig","params":{"config":{"raw_receive":true}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IR.SetConfig '{"config":{"raw_receive":true}}'
Response
- IR.SetConfig HTTP GET Response
- IR.SetConfig Curl Response
- IR.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
IR.AddDevice example
- IR.AddDevice HTTP GET Request
- IR.AddDevice Curl Request
- IR.AddDevice Mos Request
http://192.168.33.1/rpc/IR.AddDevice?config={"name":"Living Room TV","type":"tv","model":"BN59-01199F"}
curl -X POST -d '{"id":1,"method":"IR.AddDevice","params":{"config":{"name":"Living Room TV","type":"tv","model":"BN59-01199F"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IR.AddDevice '{"config":{"name":"Living Room TV","type":"tv","model":"BN59-01199F"}}'
Response
- IR.AddDevice HTTP GET Response
- IR.AddDevice Curl Response
- IR.AddDevice Mos Response
{
"id": 200
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"id": 200
}
}
{
"id": 200
}
IR.DeleteDevice example
- IR.DeleteDevice HTTP GET Request
- IR.DeleteDevice Curl Request
- IR.DeleteDevice Mos Request
http://192.168.33.1/rpc/IR.DeleteDevice?id=200
curl -X POST -d '{"id":1,"method":"IR.DeleteDevice","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call IR.DeleteDevice '{"id":200}'
Response
- IR.DeleteDevice HTTP GET Response
- IR.DeleteDevice Curl Response
- IR.DeleteDevice Mos Response
{}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {}
}
{}
IR.EmitRaw example
- IR.EmitRaw HTTP GET Request
- IR.EmitRaw Curl Request
- IR.EmitRaw Mos Request
http://192.168.33.1/rpc/IR.EmitRaw?timings=[9000,-4500,560,-1690,560,-560,560,-40000]&freq=38000&sends=1
curl -X POST -d '{"id":1,"method":"IR.EmitRaw","params":{"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":38000,"sends":1}}' http://${SHELLY}/rpc
mos --port ${PORT} call IR.EmitRaw '{"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":38000,"sends":1}'
Response
- IR.EmitRaw HTTP GET Response
- IR.EmitRaw Curl Response
- IR.EmitRaw Mos Response
null
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": null
}
null