Skip to content

Forecast: mark estimated prices - #36138

Open
naltatis wants to merge 8 commits into
masterfrom
feat/forecast-estimate
Open

naltatis wants to merge 8 commits into
masterfrom
feat/forecast-estimate

Conversation

@naltatis

@naltatis naltatis commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

fixes #36117, refs #35505, #35208

The price chart on the Forecast page now shows which prices are confirmed and which are only an estimate. The tariff source sets the marker per price.

 [
   { "start": "2026-11-16T12:00:00Z", "end": "2026-11-16T12:15:00Z", "value": 0.21 },
   {
     "start": "2026-11-17T23:00:00Z",
     "end": "2026-11-17T23:15:00Z",
     "value": 0.24,
+    "estimate": true
   }
 ]

The first price is published by the market (e.g. EPEX) and final. The second is a prediction that can still change. Price tariffs only, display only: planning treats both the same.

  • Estimates are drawn with a thin line and a hatched area, the tooltip adds "estimate"
  • Custom tariffs and Stekker set the marker, merged passes it through
  • State forecast slots get a trailing 1: [start, end, value, 1]
  • Demo price tariff: new days and knowndays options
  • Storybook overview for the price chart

Follow-ups (tariffs that deliver predicted prices, separate PRs)

  • stekker: forecast prices are marked (@djfanatix)
  • elpriser: map type: forecast to estimate (@x2q)
  • epex-predictor: mark slots after knownUntil (@t0mas)
  • energypriceforecast, stroomprijsprognose: API sends estimate, no template change (@RenatusRo, @hendriksoppa-droid)
  • spotovyradar: mark the 72-hour forecast (@Nemovitosti)
  • voltcast: all prices are predictions (@ossedk)
  • energyforecast: map price_origin: forecast to estimate (@andig)
  • amber: mark ForecastInterval prices (@ross-w)

Screenshots

CleanShot 2026-11-12 at 12 42 11@2x CleanShot 2026-11-12 at 12 41 59@2x

🤖 Generated with Claude Code

@github-actions github-actions Bot added enhancement New feature or request tariffs Specific tariff support ux User experience/ interface labels Nov 12, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 32808aa

#36117 Label the source in the tariff forecast chart for merged tariffs · 0 of 1 met

# Requirement Status Notes
1 Indicate whether a merged tariff price came from the primary or secondary source, or explicitly name the source. 🟡 Partly met The chart can label flagged prices as estimates, but it does not identify which merged source supplied them; the EPEX predictor mapping called out in the PR description is deferred.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="api/rates.go" line_range="15" />
<code_context>
 	End   time.Time `json:"end"`
 	Value float64   `json:"value"`
+	// Estimate marks a predicted value that may still be replaced by an actual one
+	Estimate bool `json:"estimate,omitempty"`
 }

</code_context>
<issue_to_address>
**Estimated prices lose their marker**

When an estimate-bearing tariff passes through a combined or averaging tariff, `combined.Rates` and the averaging wrapper rebuild rates without copying `Estimate`, so callers see estimated prices as confirmed.

Copy the `Estimate` field when rebuilding rates in both wrappers.

Also at `tariff/merged.go:101`.
</issue_to_address>

### Comment 2
<location path="templates/definition/tariff/demo-dynamic-grid.yaml" line_range="109-114" />
<code_context>

-      for (var day = 0; day < 5; day++) {
+      // rolling horizon from the current slot, pattern stays anchored at midnight
+      var end = Math.floor(now.getTime() / slotDuration) * slotDuration + days * slotsPerDay * slotDuration;
+
+      for (var day = 0; day <= days; day++) {
         for (var slot = 0; slot < slotsPerDay; slot++) {
           var time = new Date(start.getTime() + (day * slotsPerDay + slot) * slotDuration);
+          if (time.getTime() >= end) break;
           var hour = slot / slotsPerHour;

</code_context>
<issue_to_address>
**Zero days emits past prices**

When the configurable `days` value is zero, the horizon ends at the current slot, but generation starts at local midnight, so the loop emits the elapsed slots from today instead of an empty forecast; the demo tariff then serves prices from before the requested start time.

Require a positive `days` value or start generation at the current slot when calculating the horizon.
</issue_to_address>

### Comment 3
<location path="assets/js/components/Forecast/PriceChart.vue" line_range="117-122" />
<code_context>
-						const rows = params.map((s) => ({
-							name: showLabels ? labels[s.seriesIndex] : undefined,
+						const showLabels = points.length > 1;
+						const estimate = vThis.$t("forecast.price.estimate");
+						const rows = points.map((s) => ({
+							name: vThis.rowLabel(
+								showLabels ? s.seriesName : undefined,
+								s.data?.estimate ? estimate : undefined
+							),
 							values: [vThis.fmtPricePerKWh(s.value[1], vThis.currency, true, true)],
 						}));
</code_context>
<issue_to_address>
**Name the tariff source**

The issue asks the chart to indicate primary versus secondary, or explicitly name the source. This tooltip labels the value “estimate,” which distinguishes estimates but does not identify the tariff source.
</issue_to_address>

### Comment 4
<location path="assets/js/components/Forecast/PriceChart.vue" line_range="117" />
<code_context>
-						const rows = params.map((s) => ({
-							name: showLabels ? labels[s.seriesIndex] : undefined,
+						const showLabels = points.length > 1;
+						const estimate = vThis.$t("forecast.price.estimate");
+						const rows = points.map((s) => ({
+							name: vThis.rowLabel(
</code_context>
<issue_to_address>
**Estimate label lacks agreed terminology**

When the new estimate label is added, the tooltip introduces “estimate” as a named distinction, but the glossary has no term for it, leaving translators without agreed wording for this new UI concept.

Add the estimate concept and its agreed language mappings to the glossary.
</issue_to_address>

### Comment 5
<location path="assets/js/components/Forecast/PriceChart.vue" line_range="164" />
<code_context>
 		},
 	},
 	methods: {
+		rowLabel(name?: string, hint?: string): string | undefined {
+			if (name && hint) return `${name} (${hint})`;
+			return name || hint;
</code_context>
<issue_to_address>
**Component method syntax contradicts convention**

When the new `rowLabel` method is added, the new `rowLabel` component method uses method syntax instead of the required `const` arrow-function form, leaving the component out of compliance with the frontend method convention.

Define `rowLabel` as a `const` arrow function and reference it from the component methods.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread api/rates.go Resolved
Comment thread api/rates.go Resolved
@andig

andig commented Nov 12, 2026

Copy link
Copy Markdown
Member

This is really nice, but do we need this? Are forecast is a forecast anyway an don't have no notion of "committed" prices in other tariffs either.

@naltatis

naltatis commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

This is really nice, but do we need this?

Yes, we need to decide on this. Especially for merged tariffs (epex + predictor) this is useful. But it's also quite advanced. See #35505 (reply in thread)

Are forecast is a forecast anyway

Technically yes, but the epex+predict use case has different certainties for data points. So I understand the urge #36117 to visualize this.

Comment thread api/rates.go Resolved
@naltatis naltatis changed the title Forecast: mark estimated prices of merged tariffs Forecast: mark estimated prices Nov 16, 2026
@naltatis naltatis added the needs documentation Triggers issue creation in evcc-io/docs label Nov 16, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

@naltatis

Copy link
Copy Markdown
Member Author

@andig removed the merged tariff special handling and secondary=estimate assumption and moved the estimate=true field to the tariff slot source. Tariffs seem to have this guaranteed/estimate data available are listed as followup todos above.

@BackupBaTTerY

BackupBaTTerY commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

the box can be ticked: it’s live in the API that both energypriceforecast and stroomprijsprognose call (/api/v1/evcc/tariff), so no template change is needed for either. Published day-ahead slots have no field, and every forecast slot has "estimate": true (all slots with mode=forecast_only). Example from ?country=NL&type=grid&currency=EUR&hours=48 right now:

{"start":"2026-11-17T22:45:00Z","end":"2026-11-17T23:00:00Z","value":0.11497},
{"start":"2026-11-17T23:00:00Z","end":"2026-11-18T00:00:00Z","value":0.125635,"estimate":true}

@ross-w

ross-w commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

raised #36336 into this branch for Amber

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

Co-authored-by: Peter Timko <ptimko@cts-group.local>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

Comment on lines +121 to +122
s.data?.estimate ? estimate : undefined
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Merged source not identified

The tooltip adds an “estimate” hint for flagged prices, but does not show whether the primary or secondary merged tariff supplied the price or name that source. The EPEX predictor used in the reported scenario is not marked in this change, so its prices will not receive that hint here.

Prompt for AI agents
In `assets/js/components/Forecast/PriceChart.vue` at lines 121-122:

**Merged source not identified**

The tooltip adds an “estimate” hint for flagged prices, but does not show whether the primary or secondary merged tariff supplied the price or name that source. The EPEX predictor used in the reported scenario is not marked in this change, so its prices will not receive that hint here.

From #36117:

Indicate whether a merged tariff price came from the primary or secondary source, or explicitly name the source.

@andig

andig commented Nov 17, 2026

Copy link
Copy Markdown
Member

OT @RenatusRo just stumbled across energypriceforecast averaging per hour- is that intended?

@BackupBaTTerY

Copy link
Copy Markdown
Contributor

@andig quick clarification first: I'm the developer of energypriceforecast.eu. @RenatusRo brought our forecast to evcc with the first integration, and a few months ago we agreed that I take over everything from here, so please ping my evcc account @hendriksoppa-droid for the energypriceforecast and stroomprijsprognose templates.

On the averaging: yes, it's intended (#34486, reviewed by @naltatis), and it's only active when the user enables evcc's standard "Average by hour" option. In that case the template skips evcc's local average feature and requests resolution=hourly from the API instead. Our response starts at the current quarter-hour, so after a restart mid-hour, local averaging would only see the remaining quarters and produce a partial hourly value. The API still has all four published quarters and returns the full hourly mean. With the option off, nothing is averaged: published prices come as 15-minute slots, and forecast slots are hourly because the model is hourly.

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

Labels

enhancement New feature or request needs documentation Triggers issue creation in evcc-io/docs tariffs Specific tariff support ux User experience/ interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label the source in the tariff forecast chart for merged tariffs

5 participants