Methods
(async) assertConnected() → {Promise.<this>}
Asserts that the device is connected and if not, connects with the device.
Returns:
- Type:
-
Promise.<this>
(async) connect() → {Promise.<this>}
Connects to the peripheral if Homey disconnected from it
Returns:
- Type:
-
Promise.<this>
(async) disconnect() → {Promise.<void>}
Disconnect Homey from the peripheral
Returns:
- Type:
-
Promise.<void>
(async) discoverAllServicesAndCharacteristics() → {Promise.<Array.<BleService>>}
Discovers all services and characteristics of the peripheral
Returns:
- Type:
-
Promise.<Array.<BleService>>
(async) discoverServices(servicesFilteropt) → {Promise.<Array.<BleService>>}
Discovers the services of the peripheral
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
servicesFilter |
Array.<string>
|
<optional> |
list of services to discover, if not given all services will be discovered |
Returns:
- Type:
-
Promise.<Array.<BleService>>
(async) getService(uuid) → {Promise.<BleService>}
Get a service with the given uuid
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string
|
The uuid of the service |
Returns:
- Type:
-
Promise.<BleService>
(async) read(serviceUuid, characteristicUuid) → {Promise.<Buffer>}
Shorthand to read a characteristic for given serviceUuid and characteristicUuid
Parameters:
Name | Type | Description |
---|---|---|
serviceUuid |
string
|
The uuid of the service that has given characteristic |
characteristicUuid |
string
|
The uuid of the characteristic that needs to be read |
Returns:
- Type:
-
Promise.<Buffer>
(async) updateRssi() → {Promise.<string>}
Updates the RSSI signal strength value
Returns:
- Type:
-
Promise.<string>
rssi
(async) write(serviceUuid, characteristicUuid, data) → {Promise.<Buffer>}
Shorthand to write to a characteristic for given serviceUuid and characteristicUuid
Parameters:
Name | Type | Description |
---|---|---|
serviceUuid |
string
|
The uuid of the service that has given characteristic |
characteristicUuid |
string
|
The uuid of the characteristic that needs to be written to |
data |
Buffer
|
The data that needs to be written |
Returns:
- Type:
-
Promise.<Buffer>
Type Definitions
Advertisement
Properties:
Name | Type | Description |
---|---|---|
localName |
string
|
The local name of the peripheral |
manufacturerData |
string
|
Manufacturer specific data for peripheral |
serviceData |
Array.<string>
|
Array of service data entries |
serviceUuids |
Array.<string>
|
Array of service uuids |
Type:
-
object