BLE door/window sensor
Monitor your doors and windows with a Shelly low-power BLE sensor, combined with a Particle Photon 2.
Story
This project reads the Bluetooth advertisements from the Shelly BLU Door/Window sensor using a Particle Photon 2.
These sensors can be used with a Particle Argon, Boron, or Monitor One. In fact, they can be used with any current or future Particle device that supports BLE.
Particle Photon 2
This powerful Wi-Fi microcontroller from Particle continuously scans for nearby Shelly sensors.
For the longest range, add an external BLE antenna (and enable it in the code).
Shelly BLU Door/Window sensor setup
This sensor detects and reports the opening or closing of doors and windows, measures tilt angle, and monitors luminosity. It advertises this data in the BTHome format.
It is recommended to update the Shelly devices to the latest firmware using the Shelly app. In case of trouble, you can use the Shelly debug app.
For this project the Shelly sensors were configured with the Beacon mode on. In this mode the device broadcasts the current open/closed state, illuminance, and battery status every 30 seconds.
For the sensors technical information, click here.
BTHome
BTHome is an open standard for broadcasting sensor data and button presses over Bluetooth LE.
BTHome is an energy efficient but flexible BLE format for devices to broadcast their sensor data and button presses. Devices can run over a year on a single battery. It allows data encryption and is supported by popular home automation platforms, like Home Assistant, out of the box.
For visiting the BTHome website, click here.
Code
The Particle beacon-scanner library was updated as part of this project to detect BTHome devices.
The minimal code to scan and get information from these devices is on GitHub.
Here's the output of a couple of sensors detected by the Photon 2:
0000387525 [app] INFO: Scanning...
0000388560 [app] INFO: Scanning...
0000389600 [app] INFO: BTHome Address: B0:C7:DE:2C:44:45, Battery: 100, Button: 0, Window: 0, Rotation:
00000389625 [app] INFO: BTHome Address: B0:C7:DE:61:51:52, Battery: 100, Button: 0, Window: 0, Rotation:
00000389651 [app] INFO: Scanning...
0000390689 [app] INFO: Scanning...
Adapters from Printables
Here are a few adapters you can 3D print in case the installation proves difficult:
Usage Examples
You can use this setup to monitor various points of entry in your home, e.g., front doors, windows, and garage doors.
Here's an example of a real-life application: these sensors can send an alert to your phone if a window or door is left open. Click here to check out the project.
Connectivity Options:
If there is no Wi-Fi available, Particle offers alternative options:
- Wi-Fi: Use an Argon or Photon 2/P2.
- Cellular: Use a Boron, Tracker One, or Monitor One.
- LoRaWAN: Use the upcoming Particle Muon LTE CAT1/3G/2G + Wi-Fi + LoRaWAN Dev Board for Europe (MUON524) or the Muon LTE-M/2G + Wi-Fi + LoRaWAN Dev Board for North America (MUON404).
- Satellite: Use the upcoming Particle Muon LTE-M/2G/Satellite + Wi-Fi + LoRaWAN Dev Board for Global (MUON635).
Real-life application: