Skip to main content
Version: 1.0

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:

Devices which supports BTHomecontrol:

With Switch component

With Cover component

With Light component

Methods

BTHomeControl.List

This method returns a list with mappings between BLU device buttons and device output.

Request

Parameters:

PropertyTypeDescription

id

number

Id of the component instance

Response

Attributes in the result:

PropertyTypeDescription

id

number

Id of the component instance

output

string

Output component key in the format <type> <cid> (for example, cover:0)

inputs

array of objects

Each entry is a object

PropertyTypeDescription

bthomedevice

string

BTHomeDevice component key in the format <type> <cid> (for example, bthomedevice:200). Contains one or more ObjectID:idx.

obj_id

string

Object ID in decimal and index of button - ObjectID:idx. Contains one or more events.

event

string

Blu device event which will be mapped

action

string

Action of Shelly WiFi device output.

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_push
  • double_push
  • triple_push
  • rotate_left
  • rotate_right
  • hold_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_down For output of type Cover
  • on, off, toggle For output of type Switch
  • dim_up, dim_down, toggle For output of type Light

BTHomeControl.StartLearning

Properties:

PropertyTypeDescription

input_id

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.DeleteAll

PropertyTypeDescription

id

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.

Examples

BTHomeControl.List example

http://192.168.33.1/rpc/BTHomeControl.List?id=200

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
}

BTHomeControl.StartLearning example

http://192.168.33.1/rpc/BTHomeControl.StartLearning?input_id=2

Response

{}

BTHomeControl.StopLearning example

http://192.168.33.1/rpc/BTHomeControl.StopLearning

Response

{}

BTHomeControl.DeleteAll example

http://192.168.33.1/rpc/BTHomeControl.DeleteAll?id=200

Response

{}