Feature Request: Per-Scanner Device Count Sensors
- 主要语言
- Python
- 星标
- 2k
- 派生
- 71
- PR 合并指标
- 30 天内没有已合并 PR
描述
# Feature Request: Per-Scanner Device Count Sensors
## Related Issues
I searched for existing issues but didn't find any requesting this specific feature:
- **#99** (per-proxy distance sensors) is about distance from tracked devices to each scanner, not device counts
- **#45** (per-scanner ref_power) is about calibration settings
## Is your feature request related to a problem?
**Yes! Scanner health monitoring.**
Sometimes ESPHome BLE proxies stop receiving advertisements and require a restart. Currently there's no easy way to detect this automatically. The global sensors Bermuda provides don't help identify *which* scanner has failed:
- `sensor.bermuda_global_total_proxy_count` → 3
- `sensor.bermuda_global_active_proxy_count` → 3 (still shows 3 even if one scanner sees 0 devices!)
- `sensor.bermuda_global_visible_device_count` → 62
If one scanner silently stops working, the global count drops slightly but it's not obvious which one failed. I have to manually open the Bluetooth Advertisement Monitor page (`/config/bluetooth/advertisement-monitor`), look through the list of devices grouped by source, and count how many each scanner sees - then restart the one with 0 devices.
**I'd like to automate this**: detect when a scanner's device count drops to 0 (or below a threshold) and either alert me or automatically trigger a restart via the ESPHome restart button.
## Describe the solution you'd like
Add per-scanner sensors that show the device count for each Bluetooth proxy. For example, with two ESPHome BLE proxies named "BLE Bedroom" and "BLE Office", Bermuda would create:
- `sensor.bermuda_ble_bedroom_device_count` → 8
- `sensor.bermuda_ble_office_device_count` → 47
### Optional enhancements
It would also be useful to have attributes or additional sensors for:
- Last advertisement timestamp per scanner
- Average RSSI per scanner (as an indicator of scanner health/positioning)
- Count of "stale" devices (not seen in X minutes)
## Describe alternatives you've considered
1. **Command-line sensor with WebSocket Python script** - Works but requires custom code and a long-lived access token
2. **REST sensor** - Not possible as the advertisement data is only available via WebSocket, not REST API
3. **Custom integration** - Overkill for this use case
Bermuda already processes all this data internally for trilateration, so exposing per-scanner counts should be straightforward.
## Use cases
**Primary: Automated scanner health monitoring and recovery**
```yaml
automation:
- alias: "Restart BLE Proxy when no devices seen"
trigger:
- platform: numeric_state
entity_id: sensor.bermuda_ble_office_device_count
below: 1
for: "00:05:00" # No devices for 5 minutes
action:
- service: button.press
target:
entity_id: button.ble_proxy_office_restart
- service: notify.mobile_app
data:
message: "BLE Proxy Office was unresponsive and has been restarted"
```
**Secondary use cases:**
- **Dashboard visualization**: Show scanner health/coverage at a glance
- **Troubleshooting**: Quickly identify which scanner has issues without checking the Advertisement Monitor page
- **Load balancing**: Identify if one area has significantly more BLE traffic than another
## Environment
- Home Assistant version: 2025.x
- Bermuda version: latest
- Number of BLE proxies: 3 (ESPHome-based)
- Approximate device count: 60+ visible devices
## Additional context
The data is available in Home Assistant's Bluetooth Advertisement Monitor page (`/config/bluetooth/advertisement-monitor`), which shows a list of devices grouped by source (scanner). From my setup I can manually count:
- **BLE Bedroom**: 8 devices listed
- **BLE Office**: 47 devices listed
When a scanner fails, its section would show 0 devices - but there's no sensor exposing this count, so I have to manually open the page and count entries to detect a problem.
Having this as a sensor would allow automatic detection and recovery, rather than manually checking the page.
贡献指南
评估
这个 Issue 还没有评估数据。