feat: add Home Assistant integration and improve CLI/UI

Home Assistant Integration:
- New homeassistant.py module with webhook support
- Webhooks for scan results, new devices, and device departures
- Absence detection with configurable timeout
- Documentation in docs/HOME_ASSISTANT.md

CLI Improvements:
- Replace 'web' command with start/stop/restart/status
- Background daemon mode with PID file management
- Foreground mode for debugging (--foreground)

Web UI Enhancements:
- Improved device list styling and layout
- Better floor assignment UI
- Enhanced map visualization

Documentation:
- Add CHANGELOG.md
- Add docs/API.md with full endpoint reference
- Add docs/CHEATSHEET.md for quick reference
- Update project documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
User
2026-02-01 03:31:02 +01:00
parent 0ffd220022
commit 7cc7c47805
16 changed files with 2704 additions and 108 deletions

View File

@@ -31,6 +31,7 @@ Understanding the RF environment around you is useful for:
- **Historical Database** - SQLite storage for device history, RSSI time-series, statistics
- **Auto-scan** - Scheduled background scanning
- **Data Export** - JSON scan history with timestamps
- **Home Assistant Integration** - Webhook-based presence tracking, new device alerts, departure notifications
## Architecture
@@ -64,6 +65,14 @@ Understanding the RF environment around you is useful for:
│ │ iw │ │ bleak │ │ SQLite │ │
│ │ (WiFi) │ │ (BLE) │ │(History) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────┬───────────────────────────────────┘
│ Webhooks
┌─────────────────────────┴───────────────────────────────────┐
│ Home Assistant │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Scan Results │ │ New Device │ │ Device Gone │ │
│ │ Webhook │ │ Webhook │ │ Webhook │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
@@ -81,6 +90,7 @@ Understanding the RF environment around you is useful for:
- PyYAML - Configuration
- dataclasses - Data structures
- bleak - BLE scanning with RSSI
- requests - HTTP client for webhooks
### Frontend
- Leaflet.js - 2D maps
@@ -99,8 +109,11 @@ pip install -e .
## Quick Start
```bash
# Start web interface
rf-mapper web
# Start web server (background)
rf-mapper start
# Check status
rf-mapper status
# CLI scan
rf-mapper scan
@@ -126,6 +139,14 @@ building:
enabled: true
floors: 12
current_floor: 11
home_assistant:
enabled: true
url: http://192.168.129.10:8123
webhook_scan: rf_mapper_scan
webhook_new_device: rf_mapper_new_device
webhook_device_gone: rf_mapper_device_gone
device_timeout_minutes: 5
```
## Documentation