Add support for predictive mode#623
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #623 +/- ##
=======================================
Coverage 99.26% 99.27%
=======================================
Files 9 9
Lines 680 685 +5
Branches 63 65 +2
=======================================
+ Hits 675 680 +5
Misses 2 2
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds support for the new Batteries “predictive” mode, exposing it in the Batteries.Mode enum, enabling updates via BatteriesUpdate, and reflecting availability based on API version (>= 2.3.0). Test coverage is extended with new fixtures and snapshot updates to validate parsing and supported-mode detection.
Changes:
- Add
Batteries.Mode.PREDICTIVEand allow creatingBatteriesUpdatefor it. - Extend
Device.supported_battery_modes()to include predictive mode for API >= 2.3.0. - Update v2 tests/fixtures/snapshots to cover predictive mode behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| homewizard_energy/models.py | Adds PREDICTIVE mode to Batteries and exposes it via supported modes + update conversion. |
| tests/v2/test_v2_device.py | Extends supported-battery-modes matrix to include API 2.3.0 predictive mode. |
| tests/v2/test_v2_batteries.py | Adds predictive mode coverage in update mapping + parsing tests. |
| tests/v2/fixtures/HWE-P1/batteries_2_3_0.json | New fixture representing API 2.3.0 batteries payload with predictive mode. |
| tests/v2/snapshots/test_v2_batteries.ambr | Snapshot updated to include predictive-mode deserialization result. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| "mode": "predictive", | ||
| "permissions": ["charge_allowed", "discharge_allowed"], | ||
| "charge_to_full": false, |
No description provided.