Skip to content

GE Cloud - Detect Inverter limit from model#3755

Merged
springfall2008 merged 9 commits intomainfrom
ge_max_rate
Apr 8, 2026
Merged

GE Cloud - Detect Inverter limit from model#3755
springfall2008 merged 9 commits intomainfrom
ge_max_rate

Conversation

@springfall2008
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 7, 2026 07:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_rate and set inverter_limit to 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

matches = re.findall(r"\d+\.\d+", model)
if matches:
try:
max_inverter_rate = int(float(matches[-1]) * 1000)
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
max_inverter_rate = int(float(matches[-1]) * 1000)
max_inverter_rate = int(round(float(matches[-1]) * 1000))

Copilot uses AI. Check for mistakes.
("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)"),
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
("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)"),

Copilot uses AI. Check for mistakes.
@springfall2008 springfall2008 changed the title Detect Inverter limit from model GE Cloud - Detect Inverter limit from model Apr 8, 2026
@springfall2008 springfall2008 merged commit 1e7535b into main Apr 8, 2026
1 check passed
@springfall2008 springfall2008 deleted the ge_max_rate branch April 8, 2026 07:33
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.

2 participants