Skip to content

Commit 260cb7d

Browse files
fix(gecloud): don't include standalone PV inverters in pv_today/pv_power by default
Add ge_cloud_automatic_split_pv (default false) to opt in to summing standalone PV-only inverters alongside battery inverters. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 57f13bd commit 260cb7d

6 files changed

Lines changed: 31 additions & 3 deletions

File tree

apps/predbat/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,7 @@
21922192
"ge_cloud_load_today_ignore": {"type": "boolean"},
21932193
"ge_cloud_automatic_shared_ct": {"type": "boolean"},
21942194
"ge_cloud_automatic_split_ct": {"type": "boolean"},
2195+
"ge_cloud_automatic_split_pv": {"type": "boolean"},
21952196
"num_inverters": {"type": "integer", "zero": False},
21962197
"balance_inverters_seconds": {"type": "integer", "zero": True},
21972198
"givtcp_rest": {"type": "string_list", "entries": "num_inverters"},

apps/predbat/gecloud.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,9 @@ def build_entities(domain, candidates):
921921
self.set_arg("battery_scaling", [f"sensor.{self.prefix}_gecloud_{device}_battery_dod_soh" for device in batteries])
922922
self.set_arg("inverter_limit", [f"sensor.{self.prefix}_gecloud_{device}_max_inverter_rate" for device in batteries])
923923

924-
self.set_arg("pv_today", [f"sensor.{self.prefix}_gecloud_{device}_solar_total" for device in batteries + pvs])
925-
self.set_arg("pv_power", [f"sensor.{self.prefix}_gecloud_{device}_solar_power" for device in batteries + pvs])
924+
pv_devices = batteries + pvs if self.get_arg("ge_cloud_automatic_split_pv", default=False) else batteries
925+
self.set_arg("pv_today", [f"sensor.{self.prefix}_gecloud_{device}_solar_total" for device in pv_devices])
926+
self.set_arg("pv_power", [f"sensor.{self.prefix}_gecloud_{device}_solar_power" for device in pv_devices])
926927

927928
if len(batteries):
928929
self.set_arg("battery_temperature_history", f"sensor.{self.prefix}_gecloud_{batteries[0]}_battery_temperature")

apps/predbat/predbat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import pytz
3636
import asyncio
3737

38-
THIS_VERSION = "v8.46.2"
38+
THIS_VERSION = "v8.46.3"
3939

4040
from download import predbat_update_move, predbat_update_download, check_install, DEFAULT_PREDBAT_REPOSITORY
4141
from const import MINUTE_WATT

apps/predbat/tests/test_ge_cloud.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,28 @@ async def test():
31483148
assert ge.config_args.get("grid_power") == ["sensor.predbat_gecloud_battery001_grid_power", "sensor.predbat_gecloud_battery002_grid_power"], "split CT should win when both overrides are set"
31493149
assert ge.config_args.get("import_today") == ["sensor.predbat_gecloud_battery001_grid_import_total", "sensor.predbat_gecloud_battery002_grid_import_total"], "import_today should use all batteries when split CT wins"
31503150

3151+
# Test 3h: standalone PV inverter present, ge_cloud_automatic_split_pv unset (default False) — PV inverter excluded
3152+
ge.config_args = {}
3153+
ge.settings = {"battery001": {"reg1": {"name": "Enable_Eco_Mode"}}}
3154+
3155+
devices = {"ems": None, "gateway": None, "battery": ["battery001"], "pv": ["pv001"]}
3156+
3157+
await ge.async_automatic_config(devices)
3158+
3159+
assert ge.config_args.get("pv_today") == ["sensor.predbat_gecloud_battery001_solar_total"], "pv_today should exclude standalone PV inverters by default"
3160+
assert ge.config_args.get("pv_power") == ["sensor.predbat_gecloud_battery001_solar_power"], "pv_power should exclude standalone PV inverters by default"
3161+
3162+
# Test 3i: standalone PV inverter present, ge_cloud_automatic_split_pv=True — PV inverter included
3163+
ge.config_args = {"ge_cloud_automatic_split_pv": True}
3164+
ge.settings = {"battery001": {"reg1": {"name": "Enable_Eco_Mode"}}}
3165+
3166+
devices = {"ems": None, "gateway": None, "battery": ["battery001"], "pv": ["pv001"]}
3167+
3168+
await ge.async_automatic_config(devices)
3169+
3170+
assert ge.config_args.get("pv_today") == ["sensor.predbat_gecloud_battery001_solar_total", "sensor.predbat_gecloud_pv001_solar_total"], "pv_today should include standalone PV inverters when ge_cloud_automatic_split_pv is set"
3171+
assert ge.config_args.get("pv_power") == ["sensor.predbat_gecloud_battery001_solar_power", "sensor.predbat_gecloud_pv001_solar_power"], "pv_power should include standalone PV inverters when ge_cloud_automatic_split_pv is set"
3172+
31513173
# Test 3d: Three-phase alternative names should be auto-selected when default names do not exist
31523174
ge.config_args = {}
31533175
ge.settings = {

docs/apps-yaml.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ See also **ge_cloud_automatic_split_ct** which takes priority over this setting
510510
Use this to override automatic shared-CT detection if Predbat incorrectly identifies your system as sharing a CT clamp (e.g. when duplicate meter serials are reported by the cloud API but the inverters actually have separate CT clamps).
511511
This setting takes priority over **ge_cloud_automatic_shared_ct** if both are set.
512512

513+
- **ge_cloud_automatic_split_pv** - Optional, defaults to false. When set to `true`, Predbat will also include any standalone PV-only inverters (e.g. a GivEnergy AC-coupled PV inverter with no battery attached) in **pv_today** and **pv_power**, in addition to the battery inverters.
514+
Use this if you have a separate PV-only inverter alongside your battery inverter(s) and want its solar generation included in Predbat's totals. Leave this off (the default) if your battery inverters already report all of your solar generation, to avoid duplicating or including unwanted readings.
515+
513516
### SolaX Cloud Direct
514517

515518
Predbat supports direct communication with the SolaX Cloud API to control SolaX inverters and batteries without requiring local integrations.

docs/components.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Connects directly to the GivEnergy Cloud to control your GivEnergy inverter and
218218
| `load_today_ignore` | Boolean | No | false | `ge_cloud_load_today_ignore` | Set to `true` to ignore GE Cloud load_today data and use the `load_today` sensor from `apps.yaml` instead |
219219
| `automatic_shared_ct` | Boolean | No | false | `ge_cloud_automatic_shared_ct` | Set to `true` to force shared CT clamp mode — only the first inverter's grid and load readings are used, preventing double-counting on multi-inverter systems with a single shared CT |
220220
| `automatic_split_ct` | Boolean | No | false | `ge_cloud_automatic_split_ct` | Set to `true` to force split CT clamp mode — each inverter's readings are summed independently. Takes priority over `ge_cloud_automatic_shared_ct` if both are set |
221+
| `automatic_split_pv` | Boolean | No | false | `ge_cloud_automatic_split_pv` | Set to `true` to also include standalone PV-only inverters' solar readings in `pv_today`/`pv_power`, in addition to battery inverters |
221222

222223
#### How to get your API key (gecloud)
223224

0 commit comments

Comments
 (0)