Commit Graph

17 Commits

Author SHA1 Message Date
c9b68dd8e2 Phase 2 Complete: Python Package Structure
Core modules created:
- config.py: Environment-based configuration management
  - Loads MQTT settings from environment variables
  - SensorConfig class for JSON sensor mapping
  - Relative path resolution (PROJECT_ROOT)
  - Configuration validation with fail-fast

- mqtt_publisher.py: MQTT client wrapper
  - MQTTPublisher class with connection management
  - Replaces sendToMQTT.sh shell script
  - Direct Python MQTT publishing
  - Automatic reconnection support
  - Optional battery data publishing

- sensor_reader.py: Bluetooth BLE sensor reader
  - SensorReader class for passive BLE scanning
  - ATC firmware packet parsing
  - Duplicate packet filtering via advertisement counter
  - Watchdog thread for BLE recovery
  - Measurement dataclass for type safety

- utils.py: Bluetooth utilities
  - Ported from bluetooth_utils.py (MIT, Colin GUYON)
  - BLE scanning and advertisement parsing functions
  - Linux HCI socket operations

- main.py: Application entry point
  - Sensorpajen main application class
  - Signal handling (SIGTERM/SIGINT) for graceful shutdown
  - Logging to stdout for journald integration
  - Coordinates all components

Architecture:
- Direct Python integration (no shell scripts)
- Clean separation of concerns
- Type hints and dataclasses
- Comprehensive logging
- Graceful shutdown handling

Updated ROADMAP.md to mark Phase 2 as complete.

Next: Phase 3 - Configuration Migration (mostly done in Phase 1)
2025-12-27 13:17:26 +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
8cc2c41acf Begin version 2.0.0 development
Starting modernization phase:
- Transition to systemd service
- Modern Python package structure
- Relative configuration paths
- APT package support

See ROADMAP.md for complete implementation plan.
2025-12-27 13:10:40 +01:00
219ef3240c Add project documentation: AGENTS.md and ROADMAP.md
- AGENTS.md: Guidelines for AI agents working on this project
- ROADMAP.md: Complete migration plan from tmux/cron to systemd
- Configuration strategy using relative paths
- APT package creation plan (Phase 8)
- Progress tracking instructions
v1.0.0
2025-12-27 13:10:06 +01:00
1c20f50379 Uppdaterar sökväg 2022-11-22 09:31:22 +01:00
103b8dc48a Startup för körning på pimoroni audio 2022-01-30 21:35:33 +01:00
2ec3467e36 Lägger till fler termometrar 2021-11-26 17:10:53 +00:00
45ff1abb68 Uppdaterar readme med instruktioner om hur man flashar termometrarna 2021-11-26 17:53:24 +01:00
a9167b614a Lägger till bibliotek som behövs 2021-05-09 18:35:35 +02:00
7f923c3a9b Flyttar publiceringen 2021-01-11 12:50:01 +00:00
c1c02691da Inkluderar MQTT 2021-01-11 11:43:44 +00:00
f35fb548ee 1Merge branch 'master' of ssh://git.casablanca.wahlberg.se:2222/fredrik/sensorpajen 2021-01-11 09:14:57 +00:00
5d1e7d894e Ny ignore-fil 2021-01-11 09:14:35 +00:00
b0291d8cfe Uppdatera 'readme.md' 2020-12-30 14:56:12 +01:00
588c3be2c3 Uppdatera 'readme.md' 2020-12-30 14:49:52 +01:00
cdb5976340 Lite info 2020-12-30 13:45:03 +00:00
6940fc1a10 Först incheckning av scripten 2020-12-30 13:42:22 +00:00