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.
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.
disconnectevent will be emitted.
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.
homey app createusing the Homey CLI to get started with your new app.
app.jscan stay as it is. Instead, we must add a new driver.
homey app driver createand 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.
this.advertisement, a lot of things are possible. For example writing to a peripheral: