Bluetooth protocol today is the most common option in the segment of wearable electronics, in particular for fitness trackers and smart watches. It is well suited for direct communication devices at a short distance, when it is necessary to ensure minimum energy consumption and long battery life, and there are no high speed requirements. Plus is the low cost of products.
However, this protocol is increasingly common in stationary devices, such as lamps, various sensors, control devices, and even locks. Some manufacturers, in particular Archos, use it to implement a home automation system. Its support appears in professional controllers like Evika LogicMachine Wall. However, in such scenarios remote monitoring and control is also required, which cannot be done using only Bluetooth, since this protocol is exclusively local and cannot be routed through the Internet. This issue can be resolved, in particular, by using a smartphone or tablet at the site where wireless devices are installed, but this option is clearly not convenient.

')
The Bluetooth SIG organization, which deals with the development, certification and promotion of Bluetooth protocols, not wanting to miss the growth of the IoT segment and automation systems, offered
tools for creating gateways for connecting Bluetooth devices to the Internet and cloud services in early February. It is focused on developers and OEM, and is capable, according to the creators, to provide access to the Internet for "billions of devices." The kit includes server codes and documentation to quickly implement the basic version of the device.
The proposed example uses the well-known Node.js environment and is not demanding of computational resources. The documentation discusses the creation of a gateway and a Frontend Web server based on the Raspberry Pi platform. To start you need a Bluetooth adapter for it. True model with BLE support can be difficult to find. In this case, you can suggest using other platforms, such as Intel Edison, where this interface is embedded.
The gateway scans Bluetooth devices present on the air, caches information about them, including features and available services. When an external request is received, it issues a response either on the basis of previously collected data or requests current values from the device. The gateway interface works with GAP and GATT RESTful API, brief descriptions of which can be found on the Bluetooth SIG website, and JSON is used for information exchange. In particular, there are implemented such features as a request for a list of devices, a request for device services, a request for service characteristics, read and write data.

Frontend is implemented by the NaviBLE web application, which allows the user to work with Bluetooth devices connected to the gateway. In the examples, interfaces to the above capabilities of the gateway are available. In addition, the developer can create your own pages, including those with CSS and embedded data processing functions in JavaScript, for more convenient work with specific devices. For example, the lamp can provide buttons on and off, as well as the choice of color.

These examples can be useful both for developers of automation systems who plan to include support for the Bluetooth protocol in their products, and for enthusiasts. In particular, you will be able to implement the processing of such a scenario as the appearance of a Bluetooth device at home, for example, to automatically turn on the light or change the mode of the security alarm.

Note that on the Bluetooth SIG website, you can also find documentation and examples of working with Bluetooth devices (for example, tags) to integrate support for this protocol on various platforms, including the source code of applications for Android, iOS and Windows.