Integrations

Get electricity price forecasts into your smart home and charge your EV automatically when power is cheap.

Up and running in 5 minutes

  1. 1

    Create an account

    Sign up for free, no payment details required.

  2. 2

    Create an API key

    Generate a token under API Keys.

  3. 3

    Pick your platform

    Copy the matching code block below, paste it, done.

The code examples show the placeholder YOUR_API_TOKEN. Once you are logged in and have created a key, we insert it on copy without ever showing it on the page: API Keys

Forecasts are divided into three categories:

  • 2 full days in advance (free)
  • 6 full days in advance: Pricing
  • 12 full days in advance (Business plan) Pricing

For both options, data is delivered from midnight of the current day. Forecasts are updated twice daily.

🏠

Home Assistant Integration

The fastest route is a REST sensor in your configuration.yaml. No HACS, no extra integration.

🚗

EVCC Integration

If you already run evcc, the setup is a handful of lines in your evcc.yaml.

The forecasts can be integrated into evcc to control when your car is charged.

Here's how:

  1. Install evcc (see EVCC documentation)
  2. Create an API key under API Keys
  3. Set your fixed costs and VAT in your profile:
    • Go to Edit profile
    • Enter your fixed costs (in cents per kWh)
    • Enter your VAT rate (in %)

    The price is then calculated using the formula <code class="bg-gray-50 px-2 py-1 rounded text-sm font-mono">(Preis + fixed_cost_cent) * (1 + vat / 100.0)</code>.

  4. Add the following code to your EVCC configuration file: (see also EVCC.io documentation)
    evcc.yaml
    tariffs:
      grid:
        type: template
        template: energyforecast
        token: YOUR_API_TOKEN
        charges: # Additional fixed surcharge per kWh (e.g. 0.05 for 5 cents) (optional)
        tax: # Tax, additional percentage surcharge (e.g. 0.2 for 20%) (optional)
    
  5. Restart EVCC and you should be able to see the forecasts in the app.

Before integration, only EPEX Spot day-ahead prices are available.

After integration

🧩

ioBroker Integration

Fetch the forecast with the JavaScript adapter and expose it as data points.

ioBroker is an open-source IoT platform that is especially popular in Germany. The JavaScript adapter fetches the forecast and exposes it as data points.

Here's how:

  1. Install ioBroker (see ioBroker documentation)
  2. Create an API key under API Keys
  3. Set your fixed costs and VAT in your profile:
    • Go to Edit profile
    • Enter your fixed costs (in cents per kWh)
    • Enter your VAT rate (in %)
  4. Install the JavaScript Adapter in ioBroker
  5. Create a new script with the following content:
    javascript
    // Create the data points (only needed on the first run)
    createState("javascript.0.energyforecast.data", "[]", { type: "string" });
    createState("javascript.0.energyforecast.price_now", 0, { type: "number", unit: "ct/kWh" });
    createState("javascript.0.energyforecast.cheap_now", false, { type: "boolean" });
    
    // Fetch and cache the forecast (every 6 hours)
    async function fetchForecast() {
      const res = await httpGetAsync("https://www.energyforecast.de/api/v2/forecast?token=YOUR_API_TOKEN");
      setState("javascript.0.energyforecast.data", JSON.stringify(JSON.parse(res.data).data), true);
    }
    
    // Determine the current quarter hour from the cached data (every 15 minutes)
    function evaluate() {
      const slots = JSON.parse(getState("javascript.0.energyforecast.data").val || "[]");
      const now = Date.now();
      const upcoming = slots.filter(s => new Date(s.end).getTime() > now).slice(0, 96);
      if (upcoming.length === 0) return;
    
      const cheapest = [...upcoming]
        .sort((a, b) => a.total_ct_kwh - b.total_ct_kwh)
        .slice(0, 16)
        .map(s => s.start);
    
      setState("javascript.0.energyforecast.price_now", upcoming[0].total_ct_kwh, true);
      setState("javascript.0.energyforecast.cheap_now", cheapest.includes(upcoming[0].start), true);
    }
    
    schedule("0 */6 * * *", async () => { await fetchForecast(); evaluate(); });
    schedule("*/15 * * * *", evaluate);
    fetchForecast().then(evaluate);
    
  6. This gives you the data points price_now, cheap_now and data. The forecast is fetched every six hours and evaluated every 15 minutes. Use them in Blockly or JavaScript to switch devices at cheap times.

Tip: Use total_ct_kwh for the total price including fixed costs, grid fees and taxes. price_ct_kwh holds the plain market price if you want to do your own maths.

🔴

Node-RED Integration

Flow based automation, standalone or as a Home Assistant add-on.

The flow separates fetching from evaluating: one tick pulls the forecast every six hours and stores it in the flow context, a second one evaluates it every 15 minutes and decides whether to charge right now.

Here's how:

  1. Install Node-RED, either standalone or as a Home Assistant add-on.
  2. Open the menu at the top right, choose Import, then paste the flow below.
  3. Wire the output of the evaluation node to a call service node that switches your wallbox.
flow.json
[
  {
    "id": "ef_fetch_tick",
    "type": "inject",
    "name": "Every 6 hours",
    "repeat": "21600",
    "once": true,
    "onceDelay": "5",
    "wires": [["ef_fetch"]]
  },
  {
    "id": "ef_fetch",
    "type": "http request",
    "name": "Energyforecast",
    "method": "GET",
    "ret": "obj",
    "url": "https://www.energyforecast.de/api/v2/forecast?token=YOUR_API_TOKEN",
    "wires": [["ef_store"]]
  },
  {
    "id": "ef_store",
    "type": "function",
    "name": "Cache the forecast",
    "func": "flow.set('energyforecast', msg.payload.data);\nreturn null;",
    "outputs": 1,
    "wires": [[]]
  },
  {
    "id": "ef_eval_tick",
    "type": "inject",
    "name": "Every 15 minutes",
    "repeat": "900",
    "wires": [["ef_eval"]]
  },
  {
    "id": "ef_eval",
    "type": "function",
    "name": "Cheapest quarter hours",
    "func": "const size = 16;\nconst slots = flow.get('energyforecast') || [];\nconst now = Date.now();\nconst upcoming = slots.filter(s => new Date(s.end).getTime() > now).slice(0, 96);\nif (upcoming.length === 0) { return null; }\nconst cheapest = [...upcoming].sort((a, b) => a.total_ct_kwh - b.total_ct_kwh).slice(0, size);\nconst cheapNow = cheapest.some(s => s.start === upcoming[0].start);\nmsg.payload = cheapNow ? 'on' : 'off';\nmsg.priceNow = upcoming[0].total_ct_kwh;\nreturn msg;",
    "outputs": 1,
    "wires": [[]]
  }
]

Afterwards msg.payload holds on or off, and msg.priceNow holds the current total price in ct/kWh.

🐝

openHAB Integration

Fetch the forecast via the HTTP binding and derive the current price in a rule.

openHAB can query our API directly through the HTTP binding, without any extra add-on.

1. Create the thing

things/energyforecast.things
Thing http:url:energyforecast "Energyforecast" [
    baseURL="https://www.energyforecast.de/api/v2/forecast?token=YOUR_API_TOKEN",
    refresh=21600,
    timeout=30000
] {
    Channels:
        Type string : forecast "Forecast" [ stateTransformation="JSONPATH:$.data" ]
}

2. Create the items

items/energyforecast.items
String Energyforecast_Forecast  "Forecast"
    { channel="http:url:energyforecast:forecast" }
Number Energyforecast_Price_Now "Current price [%.2f ct/kWh]"
Switch Energyforecast_Cheap_Now "Cheap charging window"

3. Add a rule for the current price

The HTTP binding cannot pick a "current" quarter hour via JSONPATH. This rule in your JS Scripting folder evaluates the stored list every 15 minutes and fills the two derived items.

automation/js/energyforecast.js
rules.JSRule({
  name: "Energyforecast",
  triggers: [triggers.GenericCronTrigger("0 */15 * * * ?")],
  execute: () => {
    const slots = JSON.parse(items.Energyforecast_Forecast.state || "[]");
    const now = Date.now();
    const upcoming = slots
      .filter(s => new Date(s.end).getTime() > now)
      .slice(0, 96);
    if (upcoming.length === 0) return;

    const cheapest = [...upcoming]
      .sort((a, b) => a.total_ct_kwh - b.total_ct_kwh)
      .slice(0, 16)
      .map(s => s.start);

    items.Energyforecast_Price_Now.postUpdate(upcoming[0].total_ct_kwh);
    items.Energyforecast_Cheap_Now.postUpdate(cheapest.includes(upcoming[0].start) ? "ON" : "OFF");
  }
});
⚙️

Integration into your own project

Pull the raw data over REST and build it into your own project.

If you know your way around, you can easily retrieve data via the API and use it in your project. The API documentation can be found at Swagger / Open API Documentation

Endpoints

Endpoint What for
/api/v2/forecast Current Quarter hourly values with the raw price (price_ct_kwh) and the total price including fixed costs, grid fees and taxes (total_ct_kwh), both in cents. Every example on this page uses this endpoint.
/api/v1/predictions/prices_for_ha Legacy Hourly values in EUR per kWh plus a ready made current price. Being replaced by v2.
/api/v1/predictions/prices Legacy Just the price values as a flat list, handy for simple scripts. Being replaced by v2.
Every example on this page uses API v2. The v1 endpoints keep working, but v2 will replace them in the long run. Build new integrations on v2 directly.

Parameters

Parameter Meaning
token Your API key. Required.
resolution HOURLY or QUARTER_HOURLY. Applies to the v1 endpoints only, v2 always returns quarter hourly values.
fixed_cost_cent Fixed costs in cents per kWh. Overrides the setting from your profile.
vat VAT rate in percent, for example 19. Overrides the setting from your profile.
market_zone Market zone, defaults to DE-LU.

Try it quickly

bash
curl "https://www.energyforecast.de/api/v2/forecast?token=YOUR_API_TOKEN"

If you build an integration that could be useful to others, let us know. We appreciate every integration and are happy to help spread the word.

Contact