Skip to content

Catch issue where batteries is empty#3863

Merged
springfall2008 merged 1 commit intomainfrom
fix/ge_cloud_battery
May 4, 2026
Merged

Catch issue where batteries is empty#3863
springfall2008 merged 1 commit intomainfrom
fix/ge_cloud_battery

Conversation

@springfall2008
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 4, 2026 18:26
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 updates the GivEnergy Cloud device-discovery logic to correctly classify certain “legacy” hybrid inverters as battery devices even when connections.batteries is empty, and adds a regression test to cover that production-shaped payload.

Changes:

  • Treat inverters as battery devices when inverter.info.battery is present, even if connections.batteries is empty.
  • Add a new GE Cloud test case covering the legacy device structure (e.g. GIV-HY3.6) with empty connections.

Reviewed changes

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

File Description
apps/predbat/gecloud.py Extends battery-device detection to include legacy payloads where battery details exist only under info.battery.
apps/predbat/tests/test_ge_cloud.py Adds a regression test for device discovery when connections.batteries is empty but info.battery is populated.

Comment thread apps/predbat/gecloud.py
Comment on lines 1428 to 1432
elif "gateway" in model:
result["gateway"] = serial
elif batteries:
elif batteries or info.get("battery"):
result["battery"].append(serial)
result["battery_meters"][serial] = meter_serials
Comment on lines +682 to +686
result = await ge_cloud.async_get_devices()

if result["battery"] != ["sa1919g001"]:
print("ERROR: Expected battery=['sa1919g001'] for legacy device, got {}".format(result))
return 1
@springfall2008 springfall2008 merged commit 2e73d94 into main May 4, 2026
5 checks passed
@springfall2008 springfall2008 deleted the fix/ge_cloud_battery branch May 4, 2026 18:29
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