Skip to content

fix(evcc): remove non-existent result wrapper from /api/state parsing - #1067

Open
bt122 wants to merge 1 commit into
linuxserver:masterfrom
bt122:fix/evcc-api-no-result-wrapper
Open

bt122 wants to merge 1 commit into
linuxserver:masterfrom
bt122:fix/evcc-api-no-result-wrapper

Conversation

@bt122

@bt122 bt122 commented Oct 24, 2026

Copy link
Copy Markdown

Problem

The evcc tile always shows 0.0 kW for both PV power and charging power, even though the API connection test reports success.

Root cause: The livestats() method checks for $json->result but the evcc /api/state endpoint returns a flat JSON object with no result wrapper:

{ "apiReady": true, "pvPower": 3384, "loadpoints": [...], ... }

Because $json->result is always null, the inner block never executes and both values stay at the 0.0 kW default. The API test still passes because it only checks the HTTP 200 status code.

Fix

  • Read pvPower and loadpoints directly from $json instead of $json->result
  • Guard on $json->apiReady === true (present in every /api/state response) instead of the absent result key

Tested against evcc v0.200+ running locally.

The evcc /api/state endpoint returns a flat JSON object directly, not
a {"result": {...}} wrapped payload. The previous code checked for
$json->result which was always null, so pvPower and chargePower were
never read and the tile permanently displayed 0.0 kW for both values.

The API test still passed because it only checks the HTTP 200 status.

Fix: read pvPower and loadpoints directly from $json, and guard on
$json->apiReady === true (a field present in all evcc /api/state
responses) instead of the absent result key.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants