Skip to content

Refactor battery partitions to be able to generically add above/below partitions#179

Draft
TrentHouliston wants to merge 13 commits intomainfrom
houliston/battery-partitions
Draft

Refactor battery partitions to be able to generically add above/below partitions#179
TrentHouliston wants to merge 13 commits intomainfrom
houliston/battery-partitions

Conversation

@TrentHouliston
Copy link
Contributor

No description provided.

- Model layer: battery.md → energy-storage.md
- Model layer: battery-balance-connection.md → energy-balance-connection.md
- Device layer: battery_section.md → energy_storage.md
- User guide: battery_section.md → energy_storage.md
- Update all cross-references to use new filenames
- Update terminology from 'section' to 'partition' throughout
- Update mkdocs.yml navigation
- Add PartitionConfigSchema and PartitionConfigData TypedDicts
- Support both new partition-based and legacy percentage-based configs
- Refactor adapter to use _create_legacy_elements method
- Add stub for _create_partition_based_elements method
- Make min/max_charge_percentage optional with defaults for legacy support
- Update __init__.py to export new partition types
- Add _create_partition_based_elements method
- Support greedy bottom-up initial charge allocation
- Create energy storage elements for each partition
- Create internal node and connections with costs
- Create balance connections between adjacent partitions
- Apply early charge incentives on main connection
@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

❌ Patch coverage is 84.63476% with 61 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
custom_components/haeo/elements/battery/flow.py 21.05% 40 Missing and 5 partials ⚠️
custom_components/haeo/elements/battery/adapter.py 82.66% 11 Missing and 2 partials ⚠️
custom_components/haeo/model/network.py 86.36% 0 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@TrentHouliston TrentHouliston added this to the 0.3 milestone Jan 4, 2026
- Fix EnergyBalanceConnection to use reactive pattern (@constraint, @output, @cost)
- Update Network.add() to validate and set partition references
- Fix TimeSeriesLoader API calls (load -> load_intervals)
- Fix grid translations (remove _mode suffix from field names)
- Fix battery adapter partition loading (load_boundaries/load_intervals)
- Fix ElementAdapter protocol (create_model_elements -> model_elements)
- Update tests for reactive API
- Fix linting issues (line length, dict comprehensions, __all__ sorting)
- Update snapshots for scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant