Shelly BLU Distance
Short device name: SBDI-003E
Functional description
- Buttons: 1
- LED
- Ultrasonic distance sensor
- Vibration sensor
The main function of the device is to measure distance using ultrasonic technology. The measurements are done periodically on 30 seconds interval (by default). Measurement is also activated on button press, and optionally on vibration. Data is transmitted through two channels:
- BLE Advertising - The measured values are broadcast periodically as BLE advertising packets
- Zigbee Communication - The sensor data is also sent over the Zigbee network to the bound devices
Device specific features
Measured ranges
Measurment algorithm works different on short, middle and long ranges. These 3 ranges can be enabled separately.
Ranges are set using a bitmask: CLOSE = 0x01, MIDDLE = 0x02, FAR = 0x04. By default - all ranges are enabled.
| Characteristic | UUID | Type | Length | Properties | Function |
|---|---|---|---|---|---|
| Measured ranges | d61da5aa-5515-46ae-a2b2-f9a5a9ad5f1e | byte | 1 | Read, Write bonded, write without response bonded | Bit mask of enabled ranges |
Measure interval
Valid range is 5 seconds to 300 seconds. Default value is 30 seconds.
| Characteristic | UUID | Type | Length | Properties | Function |
|---|---|---|---|---|---|
| Measure interval | 342d88e8-88e3-4aa6-8cf8-178ad229a049 | byte | 2 | Read, Write bonded, write without response bonded | Measurement period in seconds [5-300] |
Measure on vibration (deprecated)
Measure on vibration is enabled by default.
| Characteristic | UUID | Type | Length | Properties | Function |
|---|---|---|---|---|---|
| Measure on vibration | b65a6119-889b-4275-869e-946a93bd23c4 | byte | 1 | Read, Write bonded, write without response bonded | 1 - enable, 0 - disable |
- this feature is planned for removal in the forecomming firmwares.
Configuration using the button
- Press 1 time: Trigger on-demand measurement.
- Press 3 times rapidly: Send Zigbee Identify query broadcast.
- Press 4 times rapidly: Enter Bluetooth pairing mode.
- Press 5 times rapidly: Enter Zigbee inclusion mode.
- Press and hold for 10 seconds: Enter Bluetooth pairing mode.
- Press and hold for 30 seconds: Factory reset.
BLE pairing
Duration: 1 min
To enter BLE pairing, press the button 4 times or hold it for 10 seconds. The BLE pairing process is indicated by the LED flashing. (0.5s on/0.5s off)
Adding to a ZigBee network
Duration: 1 min
To start the ZigBee steering process, press the button 5 times. Indicated by the LED flashing. (0.2s on/0.8s off)
ZigBee identify
Duration: 5 seconds
To trigger ZigBee identify, press the button 3 times. Indicated by the LED flashing. (0.2s on/0.2s off)
Factory reset
To trigger a factory reset, hold the button for 30 seconds. The LED will turn on, and a reset of the device will follow.
Bluetooth
Advertising (BTHome)
Beacon
BTHome sensor data objects
| id | name | data type | scale factor | description |
|---|---|---|---|---|
| 0x00 | packet id | uint8 | 1 | revolving counter |
| 0x01 | battery | uint8 | 1 | battery level in percent (0-100) |
| 0x2C | vibration* | uint8 | 1 | vibration detected |
| 0x3A | button | uint16 | 1 | button press event |
| 0x40 | distance mm | uint16 | 1 | measured distance |
- Vibration is planned for removal
Button press events
| id | name | example |
|---|---|---|
| 0x00 | None | 0x3A00 |
| 0x01 | press | 0x3A01 |
Characteristics
| Characteristic | UUID | Type | Access | Default | Meaning |
|---|---|---|---|---|---|
| Measured ranges | d61da5aa-5515-46ae-a2b2-f9a5a9ad5f1e | uint8 | rw | 0x07 | Bit mask of enabled ranges (CLOSE=0x01, MIDDLE=0x02, FAR=0x04) |
| Measure interval | 342d88e8-88e3-4aa6-8cf8-178ad229a049 | uint16 | rw | 30 | Measurement period in seconds [5-300] |
| Measure on vibration | b65a6119-889b-4275-869e-946a93bd23c4 | uint8 | rw | 1 | 0: disabled, 1: enabled |
| Measure algorithm | 881959c1-8e34-4cb8-9393-0e8aa6610d54 | uint8 | rw | 0 | 0: Basic algorithm, 1: Confidence algorithm |
| Attenuation configuration | a7432eac-3518-4931-9867-b03e2674e8ad | byte[13] | rw | 0 | Attenuation bit array (see below) |
| Factory reset | b0a7e40f-2b87-49db-801c-eb3686a24bdb | uint8 | w | - | 1: perform factory reset |
Confidence algorithm
Measurement algorithm selection
| Characteristic | UUID | Type | Length | Properties | Function |
|---|---|---|---|---|---|
| Measure algorithm | 881959c1-8e34-4cb8-9393-0e8aa6610d54 | byte | 1 | Read, Write bonded, write without response bonded | value* |
- 0 = Basic algorithm, 1 = Confidence algorithm
The Basic algorithm returns the distance detected in the first range possible.
Confidence algorithm compares the data from all enabled ranges and reports the distance from the most confident object.
- Factory default: 0 = Basic algorithm
Attenuation
Attenuation by default is set to all zeroes - no change.
| Characteristic | UUID | Type | Length | Properties | Function |
|---|---|---|---|---|---|
| Attenuation configuration | a7432eac-3518-4931-9867-b03e2674e8ad | byte | 13 | Read, Write bonded, write without response bonded | Bit array - read below. |
- A single attenuation setting is applied to a whole decimeter.
- Decimeter is rounded so the setting for decimeter 10 (1m) applies to the range 950mm-1049mm.
- Total attenuation ranges: 52 for proper byte padding.
- Attenuation: 2 bits per range.
| Bit setting | Multiplier | Attenuation | Description |
|---|---|---|---|
| 0x01 | x2 | +6dB | Double the confidence |
| 0x00 | x1 | 0dB | Do not change |
| 0x11 | x0.5 | -6dB | Halve the confidence |
| 0x10 | x0 | -∞ | Clear result |
Byte ordering: Sample: 00112233445566778899AABBCC 00 - decimeters 0 to 3 11 - decimeters 4 to 7 ... CC - decimeters 48 to 51
Bit ordering: Sample: 0bwwxxyyzz zz - decimeter 0 yy - decimeter 1 xx - decimeter 2 ww - decimeter 3
BTHome sensor data objects (Confidence algorithm)
Packet 1:
| id | name | data type | scale factor | description |
|---|---|---|---|---|
| 0x00 | packet id | uint8 | 1 | revolving counter |
| 0x01 | battery | uint8 | 1 | battery level in percent (0-100) |
| 0x2C | vibration | uint8 | 1 | vibration detected |
| 0x3A | button | uint16 | 1 | button press event |
| 0x40 | distance mm | uint16 | 1 | measured distance |
| 0x09 | count | uint8_t | 1 | confidence in % of the reported value |
Packet 2:
| id | name | data type | scale factor | description |
|---|---|---|---|---|
| 0x00 | packet id | uint8 | 1 | revolving counter |
| 0x54 | raw | uint8 x10 | - | packed listing of top 5 results with their confidence * |
Raw data consits of 10 bytes - 5 groups of 2 bytes.
2-byte group format
| byte 2*n+0 | byte 2*n+1, bit 0 | byte 2*n+1, bits 1-7 |
|---|---|---|
| Distance in cm - LSB | Distance in cm - MSB 1 bit | Confidence |
Example data as can be seen on Shelly BLE Debug App's screen:
raw:0: C16AD022EE1C88156409
- C16A: 193cm distance with 53% confidence
- D022: 208cm distance with 17% confidence
- EE1C: 238cm distance with 14% confidence
- 8815: 392cm distance with 10% confidence
- 6409: 356cm distance with 4% confidence
Values are sorted by confidence decreasing. Distance is rounded to cm (35mm to 44mm = 4cm) to save packet space. Total sum of percents may be between 95-100 due to integer rounding.
ZigBee
ZigBee device info
Device Id: 0x0107 (Occupancy Sensor) Profile Id: 0x0104 (Home Automation)
| EP | Dir | Id | Cluster | Id | Attribute/Command | Access/Direction |
|---|---|---|---|---|---|---|
| 1 | S | 0x0000 | Basic | 0x0000 | ZCL Version | r |
| 0x0001 | Application version | r | ||||
| 0x0004 | Manufacturer name | r | ||||
| 0x0005 | Model Identifier | r | ||||
| 0x0007 | Power source | r | ||||
| 0x4000 | Sw Build Id | r | ||||
| 0xFFFD | Cluster Rev. | r | ||||
| S | 0x0001 | Power config | 0x0021 | Battery percentage remaining | rp | |
| 0xFFFD | Cluster Rev. | r | ||||
| C | 0x0003 | Identify | 0xFFFD | Cluster Rev. | r | |
| 0x0000 | Identify | C->S | ||||
| 0x0001 | IdentifyQuery | C->S | ||||
| S | 0x0003 | Identify | 0x0000 | Identify time | r | |
| 0xFFFD | Cluster Rev. | r | ||||
| 0x0000 | Identify | C->S | ||||
| 0x0001 | IdentifyQuery | C->S | ||||
| S | 0x0406 | Occupancy Sensing | 0x0000 | Occupancy | rp | |
| 0x0001 | Occupancy sensor type | r | ||||
| 0x0002 | Occupancy sensor type bitmap | r | ||||
| 0xFFFD | Cluster Rev. | r | ||||
| S | 0xFC22 | Occupancy Config MFC:0x1490 | 0x0000 | Distance (mm) | rp | |
| 0x0001 | Occupied threshold | rw | ||||
| 0x0002 | Hysteresis | rw | ||||
| 0xFFFD | Cluster Rev. | r |
Bootloader
To enter bootloader mode, hold the button while the device starts (when inserting the battery).
LED will blink rapidly, indicating bootloader mode.