2020-09-21 01:58:32 +02:00
# Bluetooth Binding
This binding provides support for generic Bluetooth devices.
It has the following extensions:
<!-- list - subs -->
## Bridges
In order to function, this binding requires a Bluetooth adapter to be present, which handles the wireless communication.
As there is no standard in Bluetooth for such dongles resp. chips, different adapters require a different implementation.
2022-12-07 21:09:32 +01:00
This is why the Bluetooth binding itself does not come with any bridge handlers for such adapters itself, but instead is extensible by additional bundles which can implement support for a specific adapter.
2020-09-21 01:58:32 +02:00
For Linux, there exists a special bundle which provides a Bluetooth bridge that talks to BlueZ.
This should be the best choice for any Linux-based single board computers like e.g. the Raspberry Pi.
## Supported Things
2020-11-23 10:43:44 +01:00
The base bluetooth binding only supports a single thing type.
Additional thing types are available through bluetooth extensions.
2020-09-21 01:58:32 +02:00
| Thing Type ID | Description |
|---------------|---------------------------------------------------------------------------------------------------------|
2020-11-23 10:43:44 +01:00
| beacon | A Bluetooth device that is not connected, but only broadcasts announcements. |
2020-09-21 01:58:32 +02:00
## Discovery
Discovery is performed through the Bluetooth bridge.
Normally, any broadcasting Bluetooth device can be uniquely identified and thus a bridge can create an inbox result for it.
2020-11-23 10:43:44 +01:00
As this might lead to a huge list of devices, bridges usually disable this behavior by default.
2020-09-21 01:58:32 +02:00
## Thing Configuration
2020-11-23 10:43:44 +01:00
All bluetooth thing types require a configuration parameter `address` , which corresponds to the Bluetooth address of the device (in format "XX:XX:XX:XX:XX:XX").
Other configuration parameters may be required depending on the bluetooth thing type, look at the documentation for that thing type for details.
2020-09-21 01:58:32 +02:00
## Channels
Every Bluetooth thing has the following channel:
2024-12-05 20:37:15 +01:00
| Channel ID | Item Type | Description |
|------------|--------------|-----------------------------------------------------------------------------------------------------|
| rssi | Number:Power | The "Received Signal Strength Indicator", the [RSSI ](https://blog.bluetooth.com/proximity-and-rssi ) |
2020-09-21 01:58:32 +02:00
## Full Example
demo.things (assuming you have a Bluetooth bridge with the ID `bluetooth:bluez:hci0` ):
2022-12-07 21:09:32 +01:00
```java
2020-09-21 01:58:32 +02:00
bluetooth:beacon:hci0:b1 "BLE Beacon" (bluetooth:bluez:hci0) [ address="68:64:4C:14:FC:C4" ]
```
demo.items:
2022-12-07 21:09:32 +01:00
```java
2024-12-05 20:37:15 +01:00
Number:Power Beacon_RSSI "My Beacon [%.0f %unit%]" { unit="dBm", channel="bluetooth:beacon:hci0:b1:rssi" }
2020-09-21 01:58:32 +02:00
```
demo.sitemap:
2022-12-07 21:09:32 +01:00
```perl
2020-09-21 01:58:32 +02:00
sitemap demo label="Main Menu"
{
Frame {
Text item=Beacon_RSSI
}
}
```
See also the following extensions for further examples:
2021-04-14 15:11:31 +02:00
<!-- list - subs -->