Language

Home Assistant ยท price and CO2

No dedicated Home Assistant integration is required here

A normal REST sensor is enough to consume price, CO2 and best-window data. The public summary endpoint already returns the fields most automations actually need.

Key point

The API is already usable directly from Home Assistant, scripts and other automations. The missing piece was clear documentation, not a custom integration.

Recommended endpoint

For Home Assistant, /api/v1/home-assistant/summary is the simplest entry point. It returns not just raw values, but already computed windows for cheapest, greenest and combined use.

https://energypriceforecast.eu/api/v1/home-assistant/summary?country=de&hours=48&window_hours=4
Priceflat.current_price and flat.cheapest_window_*.
CO2flat.current_co2_g_kwh and flat.greenest_window_*.
Combinedflat.combined_window_* for the price/CO2 compromise.

REST sensor example

This example polls Germany every 15 minutes. For other markets, only the country parameter changes.

rest:
  - resource: "https://energypriceforecast.eu/api/v1/home-assistant/summary?country=de&hours=48&window_hours=4"
    scan_interval: 900
    sensor:
      - name: "EnergyPriceForecast current price"
        value_template: "{{ value_json.flat.current_price }}"
        unit_of_measurement: "EUR/kWh"

      - name: "EnergyPriceForecast current CO2 intensity"
        value_template: "{{ value_json.flat.current_co2_g_kwh }}"
        unit_of_measurement: "gCO2/kWh"

      - name: "EnergyPriceForecast cheapest window start"
        value_template: "{{ value_json.flat.cheapest_window_start }}"

      - name: "EnergyPriceForecast greenest window start"
        value_template: "{{ value_json.flat.greenest_window_start }}"

After adding the block, reload or restart Home Assistant and verify the sensor values in Developer Tools.

Public API support matrix

Not every visible market is publicly enabled for every endpoint yet. This matrix makes the current support level explicit instead of relying on guesswork.

Market hourly-forecast home-assistant/summary co2-live retail-forecast
DEyesyesyesyes
NLyesyesyesyes
BEyesyesyesno
FRyesyesyesno
CZyesyesnono
DK1yesyesyesyes
DK2yesyesyesyes
DenmarkUse dk1 or dk2. A generic dk request resolves to DK1.
Czech RepublicCZ is currently public as price-only: summary yes, but no public CO2 endpoint and no retail total price yet.
Total priceThe retail endpoint is currently meant only for DE, NL, DK1 and DK2.

Important notes

Is this an official Home Assistant integration?

No. This is intentionally a simple REST-based path. It is easier to test, easier to reason about and already sufficient for many setups.

Are the API prices my exact household electricity price?

Not automatically. hourly-forecast and the Home Assistant summary start with market/base prices. The exact total price depends on country-specific grid fees, taxes, levies and supplier markup.

What happens for an unsupported country?

The public API now returns an explicit error instead of silently falling back to Germany. That is intentional so automations do not run on wrong data.