mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:09:12 +00:00
Refactored the component to use a list-based configuration structure that
reduces duplication and makes it clearer that multiple sensors come from
the same device.
New configuration format:
sensor:
- platform: bthome_ble
mac_address: "A4:C1:38:12:34:56"
bindkey: "..." # optional
sensors:
- type: temperature
name: "Temperature"
- type: humidity
name: "Humidity"
binary_sensor:
- platform: bthome_ble
mac_address: "A4:C1:38:9A:BC:DE"
binary_sensors:
- type: motion
name: "Motion"
- type: door
name: "Door"
Benefits:
- MAC address and bind key are specified once per device
- More efficient (one BLE listener per device instead of per sensor)
- Clearer relationship between sensors from the same device
- Matches user expectations for multi-sensor devices
Updated test configurations to demonstrate the new format.
42 lines
962 B
YAML
42 lines
962 B
YAML
esp32_ble_tracker:
|
|
scan_parameters:
|
|
interval: 1100ms
|
|
window: 1100ms
|
|
active: true
|
|
|
|
sensor:
|
|
- platform: bthome_ble
|
|
mac_address: "A4:C1:38:12:34:56"
|
|
sensors:
|
|
- type: temperature
|
|
name: "BTHome Temperature"
|
|
- type: humidity
|
|
name: "BTHome Humidity"
|
|
|
|
- platform: bthome_ble
|
|
mac_address: "A4:C1:38:78:90:AB"
|
|
bindkey: "231d39c1d7cc1ab1aee224cd096db932"
|
|
sensors:
|
|
- type: battery
|
|
name: "BTHome Battery"
|
|
- type: pressure
|
|
name: "BTHome Pressure"
|
|
|
|
binary_sensor:
|
|
- platform: bthome_ble
|
|
mac_address: "A4:C1:38:9A:BC:DE"
|
|
binary_sensors:
|
|
- type: motion
|
|
name: "BTHome Motion"
|
|
- type: window
|
|
name: "BTHome Window"
|
|
|
|
- platform: bthome_ble
|
|
mac_address: "A4:C1:38:AB:CD:EF"
|
|
bindkey: "231d39c1d7cc1ab1aee224cd096db932"
|
|
binary_sensors:
|
|
- type: door
|
|
name: "BTHome Door"
|
|
- type: occupancy
|
|
name: "BTHome Occupancy"
|