Commit Graph

5 Commits

Author SHA1 Message Date
cfa24d1fa5 feat: implement Textual TUI and SQLite database for sensor management 2025-12-29 09:39:33 +01:00
e9b8d56f6d Release v2.0.0 - Production ready
Version bump:
- Update VERSION to 2.0.0 (from 2.0.0-dev)
- Update pyproject.toml to 2.0.0
- Change development status to Production/Stable

Documentation updates:
- Add Debian package installation instructions (system-wide)
- Add sensor discovery and approval workflow documentation
- Update configuration section with approval workflow
- Update service management for system installation
- Update troubleshooting for system installation
- Update MQTT settings documentation
- Add links to download Debian packages from releases

The application is now production-ready with:
- Systemd integration for automatic service management
- Automatic startup and restart on failure
- Configuration via /etc/sensorpajen/
- Runtime state in /var/lib/sensorpajen/
- Interactive sensor approval workflow
- Automatic configuration reload
- Comprehensive logging via journalctl
2025-12-28 10:54:57 +01:00
f2ac55eac1 Fix missing PyBluez dependency
The code imports 'bluetooth._bluetooth' which requires the PyBluez package
(not bluepy). PyBluez provides Classic Bluetooth support needed by utils.py
and sensor_reader.py.

- Add pybluez>=0.31 to both requirements.txt and pyproject.toml
- Keep bluepy and paho-mqtt as they are also needed
- bluez system package also needed (already in debian/control)

Fixes: ModuleNotFoundError: No module named 'bluetooth'
2025-12-28 00:33:35 +01:00
9b1229a2ee 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.
2025-12-27 15:03:19 +01:00
426f1d3813 Phase 1 Complete: Preparation & Cleanup
Directory structure:
- Created src/sensorpajen/ for new Python package
- Created config/ for configuration templates
- Created legacy/ for old scripts
- Created systemd/ and debian/ for future phases

Package setup:
- Added pyproject.toml with modern Python packaging
- Created package __init__.py
- Defined dependencies: bluepy, paho-mqtt

Configuration:
- Created config/sensors.json.example (converted from INI)
- Created config/sensorpajen.env.example for environment variables
- All 8 Xiaomi sensors migrated to JSON format

Cleanup:
- Removed temperatur_koksfonstret.py (DHT11 functionality)
- Moved all legacy scripts to legacy/ folder:
  - LYWSD03MMC.py
  - bluetooth_utils.py
  - sendToMQTT.sh
  - sensorer.sh
  - startup.sh
  - sensorer.ini

Updated ROADMAP.md to mark Phase 1 as complete.

Next: Phase 2 - Python Package Structure
2025-12-27 13:13:51 +01:00