Skip to main content

Bluetooth Low Energy

The Bluetooth Low Energy component is called BLE. It handles bluetooth services of a device. It supports the following methods:

BLE.GetStatus#

This method returns the status of the component instance.

Request#

This method takes no parameters.

http://192.168.33.1/rpc/BLE.GetStatus

Response#

The result is an empty JSON object because the BLE component does not own any status properties.

{}

BLE.GetConfig#

This method returns the configuration of the BLE component instance.

Request#

This method takes no parameters.

http://192.168.33.1/rpc/BLE.GetConfig

Response#

Attributes in the result:

  • enable: boolean, true if bluetooth is enabled, false otherwise
{
"enable": true
}

BLE.SetConfig#

This method makes changes in the configuration of the BLE component instance.

Request#

Parameters:

  • config: JSON object, configuration to be applied. This object should be identical in structure to the JSON returned by BLE.GetConfig, containing only the keys that need to be modified. Required
Enable bluetooth connection for this device.
curl -X POST -d '{"id":1, "src":"user_1", "method":"BLE.SetConfig",
"params":{"config":{"enable":true}}}' http://${SHELLY}/rpc

Response#

Attributes in the result:

  • restart_required: boolean, true if restart is required to apply the changes, false otherwise
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"result": {
"restart_required": false
}
}