Skip to main content
An optimization ranks the connected tariff for one device and returns the best times to consume or export energy. Use the result as an input to your own scheduling. Every optimization needs a connected tariff with prices. Without them the request fails with no_tariff_connected or no_price_data. See Errors.

Price windows

Optimizing by duration or by price limit returns price windows: the intervals of the tariff that match your request, in time order. Both take a window of at most 3 days, set by start_time and end_time. Ask for import, export or both. In each, segment picks the side of the tariff: LOW for the cheapest intervals, HIGH for the most expensive. Each window carries the tariff price: the average price per kWh for the interval, with a confidence. Where the location has PV, it also carries the solar forecast for the same interval. This request finds the cheapest 45 minutes to import in the next day.

Solar forecasts

Solar forecasts come only inside price windows. To get them:
  1. Give the PV device a pv capability block with peak_power_kw. azimuth, tilt and terrain_shading improve accuracy.
  2. Set forecasts_enabled to true in capabilities.pv. The location must have an address.
Within an hour, every window at the location carries solar: energy_kwh, power_kw and a confidence. Forecasts come from Solcast, run 7 days ahead and refresh hourly. solar is null when the device has no pv block or forecasts are off. rank_by SOLAR needs forecasts on the device or its location.

Power profiles

With VPP, two more optimizations return a power profile instead of price windows. Each row has a start_time, an end_time, the tariff price and a power_kw. Power is signed: positive imports, negative exports. Optimizing by strategy takes an end_time; the window starts now and extends at most 48 hours. Both accept storm_mode_enabled, which overrides the device’s storm mode setting for that request only. Omit it to use the setting from the latest device state. A row with storm_mode_active true is shaped by storm mode: the profile holds or builds charge ahead of forecast severe weather.

Keep results current

An optimization is a snapshot of its inputs at time_created, so run it again when an input changes. See Events.