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

@@ -15,7 +15,9 @@ src/rf_mapper/
├── __main__.py # CLI entry point and argument parsing
├── scanner.py # WiFi/Bluetooth scanning (WifiNetwork, BluetoothDevice dataclasses)
├── config.py # Configuration management (Config, BuildingConfig, etc.)
├── database.py # SQLite database for device history and tracking
├── distance.py # RSSI to distance estimation
├── homeassistant.py # Home Assistant webhook integration
├── oui.py # MAC address manufacturer lookup
├── bluetooth_*.py # Bluetooth device identification and classification
├── visualize.py # ASCII radar and chart generation
@@ -35,18 +37,23 @@ src/rf_mapper/
| Modify data model | `src/rf_mapper/scanner.py`, `config.py` |
| Change web UI | `web/templates/index.html`, `static/js/app.js`, `static/css/style.css` |
| Add configuration | `src/rf_mapper/config.py`, `config.yaml` |
| Home Assistant integration | `src/rf_mapper/homeassistant.py`, `docs/HOME_ASSISTANT.md` |
## Running
```bash
source venv/bin/activate
rf-mapper web # Web interface at http://localhost:5000
rf-mapper start # Start web server (background)
rf-mapper status # Check if running
rf-mapper stop # Stop server
rf-mapper scan -l room # CLI scan
rf-mapper --help # All commands
```
## Tech Stack
- Python 3.10+, Flask, PyYAML
- Python 3.10+, Flask, PyYAML, requests
- Leaflet.js (2D maps), MapLibre GL JS (3D maps)
- Linux tools: `iw`, `hcitool`, `bluetoothctl`
- Linux tools: `iw`, bleak (BLE via D-Bus)
- SQLite for device history
- Home Assistant webhooks for integration