mirror of
https://github.com/esphome/esphome.git
synced 2026-09-30 00:10:22 +00:00
[bthome] Add BTHome v2 BLE protocol support
Implements native BTHome v2 protocol support for broadcasting sensor data over BLE advertisements. This enables ESP32 devices to act as battery-powered BLE sensors that are natively compatible with Home Assistant. Features: - Support for multiple sensor types (temperature, humidity, battery, etc.) - Support for binary sensors (motion, door, window, etc.) - AES-CCM encryption support with 16-byte keys - Automatic packet encoding per BTHome v2 specification - Dynamic advertisement updates when sensor values change - Configurable advertising intervals and TX power - Proper BTHome v2 device info byte and service UUID Implementation: - Python configuration for sensor/binary sensor mapping - C++ component for BTHome packet encoding and BLE advertising - mbedtls CCM encryption for secure advertisements - Leverages existing esp32_ble infrastructure Test coverage: - Basic sensor/binary sensor configuration tests - Encryption test configuration - Multi-platform support (ESP32, ESP32-C3, ESP32-S3 with IDF) Closes: https://github.com/orgs/esphome/discussions/3235
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
sensor:
|
||||
- platform: template
|
||||
id: test_temperature
|
||||
name: "Test Temperature"
|
||||
- platform: template
|
||||
id: test_humidity
|
||||
name: "Test Humidity"
|
||||
- platform: template
|
||||
id: test_battery
|
||||
name: "Test Battery"
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
id: test_motion
|
||||
name: "Test Motion"
|
||||
- platform: template
|
||||
id: test_door
|
||||
name: "Test Door"
|
||||
|
||||
bthome:
|
||||
measurement:
|
||||
- type: temperature
|
||||
id: test_temperature
|
||||
- type: humidity
|
||||
id: test_humidity
|
||||
- type: battery
|
||||
id: test_battery
|
||||
binary_sensor:
|
||||
- type: motion
|
||||
id: test_motion
|
||||
- type: door
|
||||
id: test_door
|
||||
@@ -0,0 +1 @@
|
||||
<<: !include common.yaml
|
||||
@@ -0,0 +1 @@
|
||||
<<: !include common.yaml
|
||||
@@ -0,0 +1 @@
|
||||
<<: !include common.yaml
|
||||
@@ -0,0 +1,18 @@
|
||||
sensor:
|
||||
- platform: template
|
||||
id: test_temperature
|
||||
name: "Test Temperature"
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
id: test_motion
|
||||
name: "Test Motion"
|
||||
|
||||
bthome:
|
||||
encryption_key: "231d39c1d7cc1ab1aee224cd096db932"
|
||||
measurement:
|
||||
- type: temperature
|
||||
id: test_temperature
|
||||
binary_sensor:
|
||||
- type: motion
|
||||
id: test_motion
|
||||
Reference in New Issue
Block a user