Repository navigation
Modular Architecture Refactoring Latest
🚀 Overview
This release represents a major architectural refactoring, splitting the monolithic codebase into focused, maintainable modules. The optimizer now follows a clean separation of concerns, making it easier to test, maintain, and extend.
✨ New Features
Modular Component Architecture - Split ESS.py into focused, single-responsibility modules:
optimizer.py- Main orchestration and optimization logicess_client.py- AlphaESS API client abstraction with clean interfacebattery_manager.py- Battery state calculations and capacity managementprice_analyzer.py- Price analysis, valley/peak detection, and smoothingprice_cache.py- Price data caching with ephemeral storage supportmodels.py- Data models (PriceWindow, ArbitrageCycle, OptimizationPlan)
🔧 Improvements
Better Code Organization - Each module has a clear, single responsibility for improved maintainability
Configuration Fix - Fixed min_soc default value in config.yaml (changed from 0 to 10) as per AlphaESS API docs
📦 New Files
| File | Purpose |
|---|---|
optimizer.py |
Main optimizer orchestration |
ess_client.py |
AlphaESS API client wrapper |
battery_manager.py |
Battery state and capacity calculations |
price_analyzer.py |
Price analysis and valley/peak detection |
price_cache.py |
Price data caching logic |
models.py |
Data models and type definitions |
🗑️ Removed Files
ESS.py- Split into modular components abovebuild.sh- Deprecated build script
⚙️ Configuration
No breaking changes - all existing configuration remains compatible. The refactoring maintains full backward compatibility with existing .env and config.yaml files.
Updated Defaults:
min_soc: Changed from0to10inconfig.yaml- AlphaESS API limit
This refactoring provides a solid foundation for future enhancements while maintaining all existing functionality.