homey:wireless:ble
permission. For more information about permissions read the permissions guide.ManagerBLE#discover()
function we can detect advertisements of devices near Homey. An advertisement contains some generic information from the device, and contains the data that is necessary to be able to connect to the device as well.uuid: string
rssi: number
localName: string
connectable: boolean
serviceUuids: string[]
state: string
address: string
addressType: string
serviceData: {}
discover()
function is the ManagerBLE#find()
function. When you already know the UUID of the peripheral you want to connect with you can get the advertisement of the peripheral like this:BlePeripheral#disconnect()
will simply resolve. If, for some reason, you have opened multiple connections to one device Homey will only actually close the BLE connection when all connections are closed.disconnect
event will be emitted.BlePeripheral#read()
and BlePeripheral#write()
. However, if more flexibility is desired it can also be achieved by accessing a characteristic immediately.BleCharacteristic#subscribeToNotifications()
function. This function expects a callback which is called whenever a notification is received. The received data from the notification is available in the `data` argument.my_device_name
my_service_uuid
my_characteristic_uuid
homey app create
using the Homey CLI to get started with your new app.app.js
can stay as it is. Instead, we must add a new driver.homey app driver create
and configure it to your liking. The driver is responsible for finding and pairing your BLE device. In other words, when a user tries to add your BLE device in the app, then this user will be using your driver to scan for the device and to pair with it.map()
function a 'store' property is added. This property will be used in the next step to identify our device using the ManagerBLE#find()
method.this.advertisement
.this.advertisement
, a lot of things are possible. For example writing to a peripheral:this.peripheral
: