You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Homey.BleService

const { BleService } = require('homey');

This class is a representation of a BLE Advertisement for a BlePeripheral in Homey. This class must not be initiated by the developer, but retrieved by calling BlePeripheral#discoverServices or BlePeripheral#getService.

Table of Contents

Constructor

new Homey.BleService()

Properties:
Name Type Description
id string

Id of the service assigned by Homey

uuid string

Uuid of the service

peripheral BlePeripheral

The peripheral object that is the owner of this service

name string

The name of the service

type string

The type of the service

Methods

(async) discoverCharacteristics(characteristicsFilteropt) → {Array.<BleCharacteristic>}

Discover characteristics of this service

Parameters:
Name Type Attributes Description
characteristicsFilter Array.<string> <optional>

List of characteristicUuids to search for

Returns:
Type:
Array.<BleCharacteristic>

(async) discoverIncludedServices(includedServicesFilteropt) → {Promise}

Discovers included service uuids

Parameters:
Name Type Attributes Description
includedServicesFilter Array.<string> <optional>

Array of included service uuids to search for

Returns:
Type:
Promise

(async) getCharacteristic(uuid) → {BleCharacteristic}

gets a characteristic for given characteristicUuid

Parameters:
Name Type Description
uuid string

The characteristicUuid to get

Returns:
Type:
BleCharacteristic

(async) read(characteristicUuid) → {Buffer}

Shorthand to read a characteristic for given characteristicUuid

Parameters:
Name Type Description
characteristicUuid string

The uuid of the characteristic that needs to be read

Returns:
Type:
Buffer

(async) write(characteristicUuid, data) → {Buffer}

Shorthand to write to a characteristic for given characteristicUuid

Parameters:
Name Type Description
characteristicUuid string

The uuid of the characteristic that needs to be written to

data Buffer

The data that needs to be written

Returns:
Type:
Buffer