Implement sensor auto-discovery feature
New Features: - Automatic discovery of unknown Bluetooth sensors - Discovery manager tracks pending/approved/ignored sensors - ntfy notifications when new sensors found (optional) - Interactive CLI tool: sensorpajen-approve-sensors - Automatic config reload every 15 minutes (no restart needed) Files Added: - src/sensorpajen/discovery_manager.py: Sensor discovery management - src/sensorpajen/approve_sensors.py: Interactive approval CLI - config/discovered_sensors.json.example: Example discovery file Files Modified: - src/sensorpajen/config.py: Added ntfy and discovery config - src/sensorpajen/main.py: Added discovery manager and config reload - src/sensorpajen/sensor_reader.py: Added discovery on unknown sensors - config/sensorpajen.env.example: Added ntfy and reload settings - pyproject.toml: Added approve-sensors CLI command Configuration: - NTFY_ENABLED, NTFY_URL, NTFY_TOPIC, NTFY_TOKEN - DISCOVERED_SENSORS_FILE, CONFIG_RELOAD_INTERVAL - Pre-filled comments with sensor metadata See TASKS.md for complete feature specification.
This commit is contained in:
32
config/discovered_sensors.json.example
Normal file
32
config/discovered_sensors.json.example
Normal file
@@ -0,0 +1,32 @@
|
||||
[
|
||||
{
|
||||
"mac": "A4:C1:38:12:34:56",
|
||||
"name": "ATC_123456",
|
||||
"rssi": -65,
|
||||
"first_seen": "2025-12-27T10:30:15",
|
||||
"last_seen": "2025-12-27T10:35:42",
|
||||
"sample_reading": {
|
||||
"temperature": 21.5,
|
||||
"humidity": 45,
|
||||
"battery_percent": 87,
|
||||
"battery_voltage": 2950
|
||||
},
|
||||
"status": "pending"
|
||||
},
|
||||
{
|
||||
"mac": "A4:C1:38:AB:CD:EF",
|
||||
"name": "ATC_ABCDEF",
|
||||
"rssi": -72,
|
||||
"first_seen": "2025-12-27T11:00:00",
|
||||
"last_seen": "2025-12-27T11:10:00",
|
||||
"sample_reading": {
|
||||
"temperature": 19.8,
|
||||
"humidity": 52,
|
||||
"battery_percent": 65,
|
||||
"battery_voltage": 2800
|
||||
},
|
||||
"status": "ignored",
|
||||
"ignored_at": "2025-12-27T11:15:00",
|
||||
"ignore_reason": "Test sensor, not needed"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user