Amber: invert feed-in prices to match evcc expectations #22405
Merged
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.
fixes #22394
The Amber API returns all prices as prices (ie what you will be charged). This logic extends into feed-in prices.
That means a feed-in price of -14c/kWh means you will be paid 14c per kWh for exports. Amber also has "negative" exports depending on the wholesale prices, which means you're charged for exports during that time, and these are represented as positive prices (ie exactly what you'd see for import pricing.)
This makes sense from a consistency point of view, but it appears evcc expects a positive feed-in rate to represent getting paid.
This is a real example from the API, representing a 8.3c/kWh earn rate per kWh:
I was confused by the display of the feed-in pricing in the UI and assumed that since this was showing as positive, evcc was interpreting the values correctly. At the time I don't think evcc did anything with the feed-in price besides displaying it. But now that the relatively new "feed-in priority" feature has come about, it has become clear this is actually inverted as described in #22394 .
This PR inverts feed-in pricing (only) to match evcc's model. It's worth noting that evcc after this change will actually show the inverse in the UI to what the Amber app shows for feed-in, which may be confusing for some users. But at least the feed-in priority feature will work.