GE Cloud - Detect Inverter limit from model#3755
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves GE Cloud auto-configuration by deriving an inverter power limit from the device model string (e.g., GIV-HY3.6) and wiring that into PredBat’s inverter_limit, so prediction/execution can respect the inverter’s true AC capability rather than relying solely on charge-rate limits.
Changes:
- Bump PredBat version to
v8.36.1. - Add a new GE Cloud published sensor
*_max_inverter_rateand setinverter_limitto that sensor during GE Cloud automatic config. - Add additional GE Cloud logging and extend the module’s standalone/mock scaffolding.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| apps/predbat/predbat.py | Version bump to reflect the new release containing inverter-limit detection. |
| apps/predbat/gecloud.py | Publish max_inverter_rate derived from the model string; auto-config inverter_limit from it; add extra logging and mock helpers. |
| matches = re.findall(r"\d+\.\d+", model) | ||
| if matches: | ||
| try: | ||
| max_inverter_rate = int(float(matches[-1]) * 1000) |
There was a problem hiding this comment.
int(float(matches[-1]) * 1000) can truncate due to floating point representation (e.g. 3.6 may become 3599.999… and truncate to 3599). Use a rounding approach (e.g. round(...)) before converting to int to avoid off-by-one watt results.
| max_inverter_rate = int(float(matches[-1]) * 1000) | |
| max_inverter_rate = int(round(float(matches[-1]) * 1000)) |
| ("All-In-One", 6000, 6000, "All-In-One => fallback to max_charge_rate"), | ||
| # No number at all - returns None when no max_charge_rate provided | ||
| ("Gateway", None, None, "Gateway => None (no number)"), | ||
| ("Plant EMS", None, None, "Plant EMS => None (no number)"), |
There was a problem hiding this comment.
The new test cases don’t cover the production call-site behavior where publish_info() currently passes max_charge_rate=0 when the field is missing. Adding a case like (model="Gateway", max_charge_rate=0, expected=None-or-fallback) would prevent regressions where non-inverter devices end up publishing/using a 0W inverter limit.
| ("Plant EMS", None, None, "Plant EMS => None (no number)"), | |
| ("Plant EMS", None, None, "Plant EMS => None (no number)"), | |
| # Production path: missing max_charge_rate is passed as 0 and should not become a 0W inverter limit | |
| ("Gateway", 0, None, "Gateway with max_charge_rate=0 => None (treat missing field as no fallback)"), |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.