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:
IRCode.GetStatusto obtain the component's statusIRCode.GetConfigto obtain the component's configurationIRCode.SetConfigto update the component's configurationIRCode.Emitto transmit the stored IR code
Methods
IRCode.GetStatus
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance. Required |
Find more about the status response properties in status section
IRCode.GetConfig
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance. Required |
Find the IRCode.GetConfig response properties in config section
IRCode.SetConfig
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance. Required |
| object | Configuration that the method takes |
Find more about the config properties in config section
IRCode.Emit
Transmit the stored IR code.
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the IRCode instance. Required |
| number | Total number of transmissions (1 = send once). Accepted range: |
| number | Delay in seconds before the first transmission and between repeats. Accepted range: |
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:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance |
| string | Code name (e.g., "power", "vol_up"). |
| string or null | What the code does (e.g., "power_on", "volume_up"). |
| number | Id of the parent IRDevice |
| number | Carrier frequency in Hz. Accepted range: |
| 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 |
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:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance |
| 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 |
| 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 transmittedircode.receive- produced when an incoming IR signal matches the stored code
Examples
IRCode.GetConfig example
- IRCode.GetConfig HTTP GET Request
- IRCode.GetConfig Curl Request
- IRCode.GetConfig Mos Request
http://192.168.33.1/rpc/IRCode.GetConfig?id=201
curl -X POST -d '{"id":1,"method":"IRCode.GetConfig","params":{"id":201}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.GetConfig '{"id":201}'
Response
- IRCode.GetConfig HTTP GET Response
- IRCode.GetConfig Curl Response
- IRCode.GetConfig Mos Response
{
"id": 201,
"name": "power",
"function": "power_on",
"device_id": 200,
"freq": 38000,
"timings": [
9000,
-4500,
560,
-1690,
560,
-560,
560,
-40000
]
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"id": 201,
"name": "power",
"function": "power_on",
"device_id": 200,
"freq": 38000,
"timings": [
9000,
-4500,
560,
-1690,
560,
-560,
560,
-40000
]
}
}
{
"id": 201,
"name": "power",
"function": "power_on",
"device_id": 200,
"freq": 38000,
"timings": [
9000,
-4500,
560,
-1690,
560,
-560,
560,
-40000
]
}
IRCode.SetConfig example
- IRCode.SetConfig HTTP GET Request
- IRCode.SetConfig Curl Request
- IRCode.SetConfig Mos Request
http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"name":"pwr","function":"power_on"}
curl -X POST -d '{"id":1,"method":"IRCode.SetConfig","params":{"id":201,"config":{"name":"pwr","function":"power_on"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.SetConfig '{"id":201,"config":{"name":"pwr","function":"power_on"}}'
Response
- IRCode.SetConfig HTTP GET Response
- IRCode.SetConfig Curl Response
- IRCode.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
IRCode.SetConfig example
- IRCode.SetConfig HTTP GET Request
- IRCode.SetConfig Curl Request
- IRCode.SetConfig Mos Request
http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"function":null}
curl -X POST -d '{"id":1,"method":"IRCode.SetConfig","params":{"id":201,"config":{"function":null}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.SetConfig '{"id":201,"config":{"function":null}}'
Response
- IRCode.SetConfig HTTP GET Response
- IRCode.SetConfig Curl Response
- IRCode.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
IRCode.SetConfig example
- IRCode.SetConfig HTTP GET Request
- IRCode.SetConfig Curl Request
- IRCode.SetConfig Mos Request
http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"device_id":200}
curl -X POST -d '{"id":1,"method":"IRCode.SetConfig","params":{"id":201,"config":{"device_id":200}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.SetConfig '{"id":201,"config":{"device_id":200}}'
Response
- IRCode.SetConfig HTTP GET Response
- IRCode.SetConfig Curl Response
- IRCode.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
IRCode.SetConfig example
- IRCode.SetConfig HTTP GET Request
- IRCode.SetConfig Curl Request
- IRCode.SetConfig Mos Request
http://192.168.33.1/rpc/IRCode.SetConfig?id=201&config={"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":40000}
curl -X POST -d '{"id":1,"method":"IRCode.SetConfig","params":{"id":201,"config":{"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":40000}}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.SetConfig '{"id":201,"config":{"timings":[9000,-4500,560,-1690,560,-560,560,-40000],"freq":40000}}'
Response
- IRCode.SetConfig HTTP GET Response
- IRCode.SetConfig Curl Response
- IRCode.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
IRCode.GetStatus example
- IRCode.GetStatus HTTP GET Request
- IRCode.GetStatus Curl Request
- IRCode.GetStatus Mos Request
http://192.168.33.1/rpc/IRCode.GetStatus?id=201
curl -X POST -d '{"id":1,"method":"IRCode.GetStatus","params":{"id":201}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.GetStatus '{"id":201}'
Response
- IRCode.GetStatus HTTP GET Response
- IRCode.GetStatus Curl Response
- IRCode.GetStatus Mos Response
{
"id": 201,
"uid": "9985fb6e-d805-4ebe-a4fa-12af2541aee5",
"symbols": 34
}
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": {
"id": 201,
"uid": "9985fb6e-d805-4ebe-a4fa-12af2541aee5",
"symbols": 34
}
}
{
"id": 201,
"uid": "9985fb6e-d805-4ebe-a4fa-12af2541aee5",
"symbols": 34
}
IRCode.Emit example
- IRCode.Emit HTTP GET Request
- IRCode.Emit Curl Request
- IRCode.Emit Mos Request
http://192.168.33.1/rpc/IRCode.Emit?id=201&sends=1&after=3
curl -X POST -d '{"id":1,"method":"IRCode.Emit","params":{"id":201,"sends":1,"after":3}}' http://${SHELLY}/rpc
mos --port ${PORT} call IRCode.Emit '{"id":201,"sends":1,"after":3}'
Response
- IRCode.Emit HTTP GET Response
- IRCode.Emit Curl Response
- IRCode.Emit Mos Response
null
{
"id": 1,
"src": "shellyirctrlg4-xxx",
"params": null
}
null