Repository navigation
Conversation
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
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.
Problem
The evcc tile always shows
0.0 kWfor both PV power and charging power, even though the API connection test reports success.Root cause: The
livestats()method checks for$json->resultbut the evcc/api/stateendpoint returns a flat JSON object with noresultwrapper:{ "apiReady": true, "pvPower": 3384, "loadpoints": [...], ... }Because
$json->resultis alwaysnull, the inner block never executes and both values stay at the0.0 kWdefault. The API test still passes because it only checks the HTTP 200 status code.Fix
pvPowerandloadpointsdirectly from$jsoninstead of$json->result$json->apiReady === true(present in every/api/stateresponse) instead of the absentresultkeyTested against evcc v0.200+ running locally.