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. |
||
|---|---|---|
| .github/workflows | ||
| extra-addons/open_workshop/open_workshop_mqtt | ||
| iot_bridge | ||
| odoo@fd43f0445a | ||
| .gitignore | ||
| .readthedocs.yaml | ||
| DEPLOYMENT.md | ||
| DOCUMENTATION_STRATEGY.md | ||
| FEATURE_REQUEST_DEVICE_STATUS.md | ||
| FEATURE_REQUEST_OPEN_WORKSHOP_MQTT_IoT.md | ||
| IMPLEMENTATION_PLAN_DEVICE_STATUS.md | ||
| IMPLEMENTATION_PLAN.md | ||