> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nomos.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Load Shifting and Optimization

> Pull a customer's 15-minute electricity prices, shift their flexible loads into the cheap intervals, and verify the result against actual consumption.

A Home Energy Management System (HEMS) decides when flexible loads (heat pumps, EV chargers, batteries, thermal storage) should run. To do that well, it needs the customer's actual electricity price, interval by interval. With a Nomos dynamic plan that's straightforward: pull prices, schedule loads against the cheap intervals, and after the fact compare against the realized consumption.

## How it works

<Steps>
  <Step title="Find the customer's active subscription">
    [List subscriptions](/api-reference/subscriptions/list-subscriptions) and
    pick the one with `status: "active"`. If none is active yet, subscribe to
    [`subscription.activated`](/webhooks/events/subscription-activated) and show
    a "we're still setting up your contract" state in the meantime.
  </Step>

  <Step title="Pull the day-ahead price time series">
    [Retrieve a price time
    series](/api-reference/prices/retrieve-a-price-time-series) returns
    15-minute intervals with `timestamp`, `amount` (all-in ct/kWh, incl. taxes,
    levies, grid fees), and a `components` breakdown.
  </Step>

  <Step title="Schedule loads against the cheap intervals">
    Pick the cheapest N intervals that fit your load's run time. The algorithm
    below is the simplest possible version.
  </Step>

  <Step title="Verify against actual consumption">
    [Retrieve usage data](/api-reference/usage/retrieve-usage-data) returns
    15-minute usage in kWh. Aligned with the price intervals, `usage * amount`
    gives you cost per interval.
  </Step>
</Steps>

<Note>
  Intervals are 15 minutes long. Since the EPEX day-ahead auction switched to
  quarter-hourly products on 1 October 2025, that's the native resolution of the
  underlying market and what we expose.
</Note>

## Picking the cheapest window

The simplest version: sort intervals ascending by price, take the cheapest N.

```ts theme={null}
function pickChargingWindow(prices, requiredHours) {
  const sorted = [...prices].sort((a, b) => a.amount - b.amount);
  const slotsNeeded = requiredHours * 4; // 15-min intervals
  return sorted.slice(0, slotsNeeded);
}
```

A real HEMS layers on its own constraints: battery cycle caps, comfort bounds for heat pumps, grid-export revenues, contiguous-window requirements, and so on. Nomos doesn't take a position on any of that; we just give you accurate, customer-specific prices to schedule against.

## When data is available

* **Tomorrow's prices.** Published in one batch each afternoon, finalized by \~14:20 CET at the latest. Tolerate "tomorrow's prices not yet available" in your UI; don't render zero-cent intervals as cheap windows.
* **Smart-meter consumption.** Appears from \~16:00 on D+1, once the metering operator forwards the previous day's values. Preliminary readings may be replaced by final ones up to the 8th working day of the following month. Don't expect same-day verification.
* **Auction failures.** The price endpoint omits intervals that haven't cleared. Treat missing intervals as "no schedule decision yet" rather than zero.
