Go to file
matthias.lotz eb3c49c8c4 refactor(phase2.2): Refactor main.py - Extract bootstrap and service_manager
Massive refactoring of main.py to improve code organization:

Files Created:
1. core/bootstrap.py (234 lines)
   - BootstrapConfig: Configuration container
   - parse_arguments(): CLI arg parsing
   - load_bridge_config(): Config loading with persisted fallback
   - setup_logger(): Structured logging setup
   - get_mqtt_config(): MQTT config with env var fallback
   - bootstrap(): Complete initialization orchestration

2. core/service_manager.py (369 lines)
   - ServiceManager: Central service lifecycle coordinator
   - Signal handlers for graceful shutdown
   - Service initialization (Odoo, MQTT, Event Queue, etc.)
   - Callbacks for config updates and MQTT reconnection
   - Graceful shutdown sequencing

Files Modified:
   - Now ultra-clean entry point
   - Only orchestration logic remains
   - 7-phase startup sequence clearly documented

2. core/__init__.py
   - Export new modules for clean imports

Benefits:
-  Single Responsibility: Each module has one clear purpose
-  Testability: Services can be tested independently
-  Readability: main.py is now self-documenting
-  Maintainability: Easy to find and modify specific logic
-  No global variables: All state in ServiceManager
-  Type hints throughout

Architecture:
  main.py (orchestration)
    ├── bootstrap() → config + logger
    └── ServiceManager() → all services
         ├── Odoo Client
         ├── Event Queue
         ├── Status Monitor
         ├── MQTT Client
         ├── Device Manager
         └── HTTP Config Server

Test: python3 main.py --config config.example.yaml
 Bridge starts successfully with all services

See OPTIMIZATION_PLAN.md Phase 2.2 for details.
2026-02-18 22:43:00 +01:00
.github/workflows Phase 1: Foundation & Quality Tools 2026-02-18 22:11:25 +01:00
extra-addons/open_workshop/open_workshop_mqtt feat: IoT Bridge Health Monitoring & Dynamic MQTT Reconnection 2026-02-18 20:36:11 +01:00
iot_bridge refactor(phase2.2): Refactor main.py - Extract bootstrap and service_manager 2026-02-18 22:43:00 +01:00
odoo@fd43f0445a initial MQTT Development 2026-02-11 21:07:32 +01:00
.gitignore initial version 2026-02-10 20:00:27 +01:00
.readthedocs.yaml feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
DEPLOYMENT.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
DOCUMENTATION_STRATEGY.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
FEATURE_REQUEST_DEVICE_STATUS.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
FEATURE_REQUEST_OPEN_WORKSHOP_MQTT_IoT.md feat: benutzerfreundliche GUI für Device-Konfiguration mit Auto-Config-Push 2026-02-17 00:09:51 +01:00
IMPLEMENTATION_PLAN_DEVICE_STATUS.md feat: Add automatic API documentation generation and device status monitoring 2026-02-15 11:03:22 +01:00
IMPLEMENTATION_PLAN.md Update Implementation Plan 2026-02-18 21:20:22 +01:00