Sungrow iSolarCloud usage vs AER electricity plan comparison
Find a file
dlawler489 9e66a9a97d
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 24s
Add battery telemetry for plants with a hybrid inverter/ESS
Confirmed against Sungrow's own docs and live-tested against a real
battery plant: SOC and charge/discharge power live at the *device*
level (getDeviceRealTimeData against the hybrid inverter's ps_key,
device_type 14), not in the plant-aggregate points used elsewhere in
this client -- querying them via the plant-level endpoint just returns
null. Battery status is fetched once per live "today" poll (not
backfilled historically) and stored in three new nullable columns,
self-migrated on startup since there's no Alembic here.

Also fixes the dashboard's self-consumption line to derive from
load - import rather than generation - export, which overstated
"solar -> house" for battery systems (a chunk of that gap was going
into charging, not the house). The live flow diagram now shows a
Battery node (SOC + charge/discharge) that stays hidden entirely for
solar-only plants like Kallangur.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 12:25:09 +10:00
.forgejo/workflows Add CI to build/push Docker image, switch compose to pull it 2026-09-09 11:15:27 +10:00
app Add battery telemetry for plants with a hybrid inverter/ESS 2026-09-09 12:25:09 +10:00
scripts Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
.env.example Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
.gitignore Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
docker-compose.yml Fix env_file path for Docker-outside-of-Docker deploy 2026-09-09 11:25:42 +10:00
Dockerfile Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
pyproject.toml Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
README.md Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00
SETUP.md Initial commit: solar usage vs AER plan comparison app 2026-09-09 11:07:01 +10:00

Power Compare

Compares your Sungrow solar system's actual usage against every electricity plan the AER publicly lists for your Queensland distributor, so you can see which plan would actually cost you the least given how much you generate, consume, import and export -- no battery/storage assumed.

How it works

  • An always-on background scheduler polls your Sungrow iSolarCloud plant every few minutes and stores interval generation/load/import/export data in a local SQLite database, building up history over time.
  • It also periodically refreshes a cache of every current QLD electricity plan from the AER's public "Get Generic Plans" / "Get Generic Plan Detail" APIs.
  • A costing engine evaluates every cached plan (flat or time-of-use, with supply charge and feed-in tariff credit) against your actual usage history and ranks them by estimated annual cost, compared against your own plan (entered manually in Settings).
  • A small web dashboard shows your usage over time and the plan comparison table.

Quick start (no real solar data yet)

The app runs entirely on synthetic mock usage data until you've registered a Sungrow developer app (see SETUP.md) -- useful for seeing how the comparison works today.

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env

# optional: instantly backfill a year of synthetic usage data instead of
# waiting for the scheduler to accumulate it in real time
python scripts/seed_sample_data.py --days 365

uvicorn app.main:app --reload

Then open http://localhost:8000, set your distributor/postcode and current plan under Settings, and check the Plan Comparison page.

Running the tests

pytest

The costing engine and the AER plan mapper are both unit-tested, including against real plan data fetched from the live AER API (see app/aer/tests/sample_*.json).

Connecting your real Sungrow system

See SETUP.md for registering a developer app on the iSolarCloud portal and connecting your account.

Running as an always-on service

docker compose up -d

This persists the SQLite database in a named Docker volume and restarts automatically. See .env.example for configuration.