BTHomeControl
The BTHomeControl component maintains mapping between Shelly BLU devices and outputs of Shelly WiFi device.
BTHomeControl.StartLearning with input_id parameter starts process of adding BLU device and maps its buttons to outputs like Switch, Cover or Light components.
Other way of starting process is triggering 4 times desired Input which corresponds to Output.
During process of creating mapping Shelly WiFi device has following indication of outputs:
- 1 blink/movement - Learn mode is enabled.
- 2 times blink/movement - a BLU device has been added or it already exists and it is seen that it is in pair mode. Now it is possible to add or remove mapping by pressing button on BLU device.
- 3 times blink/movement - mapping has been successfully added.
There might be device specific sequence of pressing Input or indicating.
BTHomeControl component uses BTHomeControl as RPC namespace and has the following methods:
BTHomeControl.ListList added mappingsBTHomeControl.DeleteAllDelete one or all BTHomeControl componentsBTHomeControl.StartLearningStart process of adding mappingsBTHomeControl.StopLearningStop process of adding mappingsBTHomeControl.GetStatusto obtain the component's status
Devices which supports BTHomecontrol:
With Switch component
- Pro 1
- Pro 1 PM
- Pro 2
- Pro 2 PM
- Pro 3
- Pro 4 PM
- 1L Gen3
- 2L Gen3
- 1 Gen3
- 1 Gen4
- 1 PM Gen3
- 1 PM Gen4
- 2 PM Gen3
- 1 Mini Gen3
- 1 Mini Gen4
- 1 PM Mini Gen3
- 1 PM Mini Gen4
- Ogemray 25A
- PlugS Gen3
- OutdoorPlugS Gen3
With Cover component
With Light component
- Pro Dimmer 1 PM
- Pro Dimmer 2 PM
- Pro Dimmer 0/1-10V PM
- Pro RGBWW PM
- Dimmer Gen3
- Dimmer 0/1-10V PM Gen3
- D Dimmer
Methods
BTHomeControl.List
This method returns a list with mappings between BLU device buttons and device output.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance |
Response
Attributes in the result:
| Property | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the component instance | |||||||||||||||
| string | Output component key in the format | |||||||||||||||
| array of objects | Each entry is a object
|
offset
number
Index of the first BTHomeDevice component key in inputs array
total
number
Total number of BTHomeDevice component keys in inputs array
Possible values for event:
single_pushdouble_pushtriple_pushrotate_leftrotate_righthold_press
Note: for BLU Devices with channel support event will be single_push@2 for channel 2.
Possible values for action:
close,open,cycle,step_up,step_downFor output of type Coveron,off,toggleFor output of type Switchdim_up,dim_down,toggleFor output of type Light
BTHomeControl.StartLearning
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the Input component |
Starts process of adding mapping. If Bluetooth on Shelly WiFi device is disabled will be enabled. When mapping is added successfully, Bluetooth will stay enabled, otherwise will be disabled
BTHomeControl.StopLearning
Stops process of learning.
BTHomeControl.GetStatus
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance |
Find more about the status response properties in status section
BTHomeControl.DeleteAll
| Property | Type | Description |
|---|---|---|
| number | Id of the component instance |
When id is given BTHomeControl component with given id is removed. Without id all BTHomeControl components will be deleted.
Status
The status of the BTHomeControl component contains information about learn progress when procedure of creating mapping between Shelly BLU devices and outputs of Shelly WiFi device has been started. To obtain the status of the BTHomeDevice component its id must be specified.
Properties:
| Property | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the component instance | ||||||||||||||||||||||||
| object | Information about the learning progress, only presented when Learn procedure is started with
|
learning.stage could be one of following: pairing, press, done, remove, and error.
pairing- when Shelly WiFi device is looking for BLU devicepress- after Shelly WiFi device found and added BLU device and it is ready to accept user press on button of BLU devicedone- when successfull mapping is created between Shelly WiFi device and BLU deviceremove- when mapping is removederror- when there is an error
| learning.err.code | learning.err.msg |
|---|---|
| 1 | Internal Error |
| 2 | Pairing timeout |
| 3 | Press timeout |
| 4 | Stopped by input |
| 5 | Stopped by RPC |
| 6 | Bluetooth is disabled |
| 7 | BLU device is not button type |
| 8 | No BLU devices found |
| any other | Unknown error |
Examples
BTHomeControl.List example
- BTHomeControl.List HTTP GET Request
- BTHomeControl.List Curl Request
- BTHomeControl.List Mos Request
http://192.168.33.1/rpc/BTHomeControl.List?id=200
curl -X POST -d '{"id":1,"method":"BTHomeControl.List","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call BTHomeControl.List '{"id":200}'
Response
- BTHomeControl.List HTTP GET Response
- BTHomeControl.List Curl Response
- BTHomeControl.List Mos Response
{
"id": 200,
"output": "switch:0",
"inputs": [
{
"bthomedevice:200": {
"58:0": {
"single_push": {
"action": "on"
}
},
"58:1": {
"single_push": {
"action": "off"
}
}
}
},
{
"bthomedevice:201": {
"58:0": {
"single_push": {
"action": "toggle"
}
}
}
}
],
"offset": 0,
"total": 2
}
{
"id": 1,
"src": "shelly1pmg3-84fce73fe000",
"params": {
"id": 200,
"output": "switch:0",
"inputs": [
{
"bthomedevice:200": {
"58:0": {
"single_push": {
"action": "on"
}
},
"58:1": {
"single_push": {
"action": "off"
}
}
}
},
{
"bthomedevice:201": {
"58:0": {
"single_push": {
"action": "toggle"
}
}
}
}
],
"offset": 0,
"total": 2
}
}
{
"id": 200,
"output": "switch:0",
"inputs": [
{
"bthomedevice:200": {
"58:0": {
"single_push": {
"action": "on"
}
},
"58:1": {
"single_push": {
"action": "off"
}
}
}
},
{
"bthomedevice:201": {
"58:0": {
"single_push": {
"action": "toggle"
}
}
}
}
],
"offset": 0,
"total": 2
}
BTHomeControl.StartLearning example
- BTHomeControl.StartLearning HTTP GET Request
- BTHomeControl.StartLearning Curl Request
- BTHomeControl.StartLearning Mos Request
http://192.168.33.1/rpc/BTHomeControl.StartLearning?input_id=2
curl -X POST -d '{"id":1,"method":"BTHomeControl.StartLearning","params":{"input_id":2}}' http://${SHELLY}/rpc
mos --port ${PORT} call BTHomeControl.StartLearning '{"input_id":2}'
Response
- BTHomeControl.StartLearning HTTP GET Response
- BTHomeControl.StartLearning Curl Response
- BTHomeControl.StartLearning Mos Response
null
{
"id": 1,
"src": "shelly1pmg3-84fce73fe000",
"params": null
}
null
BTHomeControl.StopLearning example
- BTHomeControl.StopLearning HTTP GET Request
- BTHomeControl.StopLearning Curl Request
- BTHomeControl.StopLearning Mos Request
http://192.168.33.1/rpc/BTHomeControl.StopLearning
curl -X POST -d '{"id":1,"method":"BTHomeControl.StopLearning"}' http://${SHELLY}/rpc
mos --port ${PORT} call BTHomeControl.StopLearning
Response
- BTHomeControl.StopLearning HTTP GET Response
- BTHomeControl.StopLearning Curl Response
- BTHomeControl.StopLearning Mos Response
null
{
"id": 1,
"src": "shelly1pmg3-84fce73fe000",
"params": null
}
null
BTHomeControl.GetStatus example
- BTHomeControl.GetStatus HTTP GET Request
- BTHomeControl.GetStatus Curl Request
- BTHomeControl.GetStatus Mos Request
http://192.168.33.1/rpc/BTHomeControl.GetStatus?id=200
curl -X POST -d '{"id":1,"method":"BTHomeControl.GetStatus","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call BTHomeControl.GetStatus '{"id":200}'
Response
- BTHomeControl.GetStatus HTTP GET Response
- BTHomeControl.GetStatus Curl Response
- BTHomeControl.GetStatus Mos Response
{
"learning": {
"stage": "pairing",
"err": null,
"ts": 1751280234.92,
"duration": 60
}
}
{
"id": 1,
"src": "shelly1pmg3-84fce73fe000",
"params": {
"learning": {
"stage": "pairing",
"err": null,
"ts": 1751280234.92,
"duration": 60
}
}
}
{
"learning": {
"stage": "pairing",
"err": null,
"ts": 1751280234.92,
"duration": 60
}
}
BTHomeControl.DeleteAll example
- BTHomeControl.DeleteAll HTTP GET Request
- BTHomeControl.DeleteAll Curl Request
- BTHomeControl.DeleteAll Mos Request
http://192.168.33.1/rpc/BTHomeControl.DeleteAll?id=200
curl -X POST -d '{"id":1,"method":"BTHomeControl.DeleteAll","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call BTHomeControl.DeleteAll '{"id":200}'
Response
- BTHomeControl.DeleteAll HTTP GET Response
- BTHomeControl.DeleteAll Curl Response
- BTHomeControl.DeleteAll Mos Response
null
{
"id": 1,
"src": "shelly1pmg3-84fce73fe000",
"params": null
}
null