Adds GoodWe SEMS Portal energy plugin - #44
Open
startswithaj wants to merge 58 commits into
Open
Conversation
Owner
Author
|
/build |
|
📦 PR image published: docker pull ghcr.io/startswithaj/chargeha:pr-44Built from |
…ttern and adds detailed sems api logging
… sigenergy and enphase
…ugin logs table with throttling
… in the ocpp pairing dialog
…selecting a plugin keeps the full list
…ilds so a save race can no longer strand the null adapter
…hat logs raw responses without affecting served data
…ms gateway probe env flag
…rt and logs the state change
…ty-response retries
…he replaced adapter
Adds a dev-only component style guide page
…uration is visible
…nto feat/goodwe-sems
…ayload omits load
…s rejecting the shared legacy token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A cloud energy plugin for GoodWe inverters via the SEMS Portal, filling the gap ChargeHQ covered for GoodWe owners.
Works with any GoodWe inverter registered in SEMS — single or multi-inverter stations, with or without a battery. Log in with your SEMS account, pick your station from a list, done.
Requires a GoodWe HomeKit or smart meter. Without one SEMS reports no power flow block, so there is no grid or consumption figure — setup fails with a clear message rather than half-working.
Notes on the SEMS API
It is undocumented — the endpoint GoodWe's own mobile app uses. Behaviour was derived from four open-source clients plus four real captured payloads.
gridis an unsigned magnitude. Direction comes fromloadStatus(1= import,-1= export), confirmed across all four payloads.gridStatuslooks like the obvious flag and agrees on three of four, but is-1in both directions on a multi-inverter station — signing by it would silently report an exporting system as importing, and solar excess would never trigger a charge. Tests pin all three real cases.bettery/betteryStatus. A test asserts the misspelling is honoured so a future tidy-up fails loudly.GY0429). Poll interval is 60s, not the 30s used for other cloud sources.Rate-limit handling
Contained entirely in the adapter — no changes to
EnergyPollerorChargeController. OnGY0429it stops issuing requests for 300s and serves the last good reading, bounded to 15 minutes, after which it throws so the outage is recorded honestly. Every outbound call routes through one guard, soconnect()andgetDeviceInfo()cannot bypass the backoff.Trade-off worth knowing: a served-from-cache reading is recorded by
DataRecorderas a normal reading, so a throttle can put up to 15 minutes of repeated values into energy history. Chosen deliberately over pausing charging.Simulator
devtools/sems-simulator— a fake SEMS Portal so the integration can be exercised without an account.deno task sems:sim, then point ChargeHA at it withGOODWE_SEMS_BASE_URL. Self-contained, imports nothing from ChargeHA, not a workspace member.Four station profiles (three-phase no battery, hybrid with battery, multi-inverter, no HomeKit), a daily solar curve, injectable rate limits and token expiry, and it serves both grid-sign interpretations so the mapping is testable either way.
deno task sems:sim:smokeruns 25 protocol checks. Request logging never prints passwords, even atLOG_LEVEL=debug.Also in here
@deno/vite-pluginv1 → v2. v1 resolved workspace specifiers by shelling out todeno info --jsonwith Node's default 1MB buffer and silently swallowed failures as "unresolvable". This plugin pushed that output to 1,075,294 bytes, breaking@chargeha/plugins/*resolution for the whole client. A latent limit — the next plugin would have hit it regardless.NetworkDeviceSearchso a cloud station list renders identically to LAN discovery. LAN markup unchanged.Testing
173 server tests, 1569 client tests,
deno task check:allgreen.Known limitations
connect()logs the raw powerflow at info so the first real connection confirms the sign convention.loadStatuscould conceivably mean "not from grid" rather than "exporting". Does not affect non-battery inverters.