Skip to content

GECloud: fix grid/load double-counting when multiple inverters share a CT clamp (no EMS)#3855

Merged
springfall2008 merged 3 commits intomainfrom
copilot/fix-double-counted-grid-power
May 3, 2026
Merged

GECloud: fix grid/load double-counting when multiple inverters share a CT clamp (no EMS)#3855
springfall2008 merged 3 commits intomainfrom
copilot/fix-double-counted-grid-power

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

With two GE hybrid inverters sharing a single physical grid CT clamp and no Plant EMS, grid_power, import_today, export_today, load_today, and load_power were summed across all inverters — producing 2× the real value since both inverters return identical readings from the shared CT.

The EMS path already handled this correctly via a "single source + zeros" pattern; the non-EMS multi-inverter path did not.

Changes

gecloud.pyasync_get_devices()

Returns a new battery_meters key: a dict mapping each battery serial to its list of meter serial numbers extracted from connections.meters in the GE Cloud API response.

gecloud.pyasync_automatic_config()

Adds shared-CT detection when num_inverters > 1 and no EMS is present:

  • no_dedicated_meters — all batteries have connections.meters: [] (typical GE hybrid setup)
  • has_duplicate_serials — any meter serial number appears on more than one inverter

When either condition is true, applies the same pattern the EMS path uses:

# Before (double-counts shared CT readings):
self.set_arg("grid_power", [f"sensor...{inv1}_grid_power", f"sensor...{inv2}_grid_power"])
self.set_arg("import_today", [f"sensor...{inv1}_grid_import_total", f"sensor...{inv2}_grid_import_total"])

# After (single CT source, second inverter contributes 0):
self.set_arg("grid_power", [f"sensor...{inv1}_grid_power", 0])
self.set_arg("import_today", [f"sensor...{inv1}_grid_import_total"])  # energy totals don't need padding

Per-inverter sensors (battery_power, pv_power, pv_today, SOC, etc.) are unaffected.

test_ge_cloud.py

  • Updated _test_async_get_devices_empty / _test_async_get_devices_with_batteries for the new battery_meters return field
  • Updated Test 3 (multiple batteries, no EMS) assertions to reflect shared-CT single-source behaviour
  • Added Test 3b: unique meter serials per inverter → per-inverter sensors preserved
  • Added Test 3c: duplicate meter serials → single-source fixup applied

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.octopus.energy
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick (dns block)
  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)
  • https://api.github.com/repos/springfall2008/batpred/contents/apps/predbat
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --test ge_cloud (http block)
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick (http block)
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --test ge_cloud --test solax --test solis --test gateway (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits May 3, 2026 10:55
… CT clamp (no EMS)

Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/8c8474e2-e731-4bcb-8158-f633401fb7be

Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
… log message

Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/8c8474e2-e731-4bcb-8158-f633401fb7be

Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix double-counting of grid power with two battery inverters GECloud: fix grid/load double-counting when multiple inverters share a CT clamp (no EMS) May 3, 2026
Copilot AI requested a review from springfall2008 May 3, 2026 10:59
@springfall2008 springfall2008 marked this pull request as ready for review May 3, 2026 13:39
Copilot AI review requested due to automatic review settings May 3, 2026 13:39
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

Fixes incorrect grid/load aggregation in GE Cloud automatic configuration when multiple GE hybrid inverters share a single physical CT clamp (and no Plant EMS is present). This prevents grid_power, load_power, and daily energy totals from being double-counted across inverters.

Changes:

  • Extend GECloudDirect.async_get_devices() to return a battery_meters mapping of inverter/battery serial → connected meter serial numbers.
  • Add shared-CT detection in GECloudDirect.async_automatic_config() for multi-inverter, non-EMS setups and apply the existing “single source + zeros” pattern to grid/load sensors and related energy totals.
  • Update/add GE Cloud tests to cover empty/unique/duplicate meter-serial scenarios and validate the new behavior.

Reviewed changes

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

File Description
apps/predbat/gecloud.py Adds battery_meters to device discovery and uses it to detect shared-CT setups to avoid grid/load double-counting.
apps/predbat/tests/test_ge_cloud.py Updates device-discovery expectations and adds/adjusts multi-inverter auto-config tests for shared vs dedicated meters.

@springfall2008 springfall2008 merged commit 15ed492 into main May 3, 2026
5 checks passed
@springfall2008 springfall2008 deleted the copilot/fix-double-counted-grid-power branch May 3, 2026 13:46
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.

GECloud: grid power double-counted with two battery inverters sharing one CT clamp (no EMS)

3 participants