Skip to content

Services

All services are registered under the kilowahti domain. When only one Kilowahti instance is configured, config_entry_id can be omitted.

Price query services

All price query services accept a formatted parameter (default true). When false, prices are returned as raw c/kWh at full precision regardless of your display unit setting.


kilowahti.get_active_prices

Returns all price slots for today and tomorrow (default), or a custom time range. Each slot includes the effective price (spot or fixed-period) and total price (effective + transfer).

service: kilowahti.get_active_prices
data: {}
service: kilowahti.get_active_prices
data:
  start: "2026-03-10T00:00:00"
  end: "2026-03-10T23:59:59"
  formatted: false

Response (clipped — full response contains one entry per slot):

{
  "unit": "c/kWh",
  "price_periods": [
    {
      "time": "2026-03-10T00:00:00+02:00",
      "price": 4.32,
      "total_price": 6.87,
      "rank": 3,
      "is_fixed": false
    },
    {
      "time": "2026-03-10T00:15:00+02:00",
      "price": 4.32,
      "total_price": 6.87,
      "rank": 3,
      "is_fixed": false
    },
    "..."
  ]
}


kilowahti.get_prices

Returns raw spot price slots for a time range. Prices are spot-only (with VAT and commission applied) — fixed-price periods and transfer are not included.

service: kilowahti.get_prices
data:
  start: "2026-03-10T00:00:00"
  end: "2026-03-10T23:59:59"

kilowahti.cheapest_hours

Finds the cheapest consecutive window of a given length within a time range, using total price (spot or fixed-period rate plus transfer).

service: kilowahti.cheapest_hours
data:
  start: "2026-03-10T18:00:00"
  end: "2026-03-11T08:00:00"
  hours: 3
  reverse: false  # optional, default false

Set reverse: true to return the latest cheapest window when there are ties (useful for "discharge before peak" automations or finding the most recent valid charge slot). Default false returns the earliest match.

Response:

{
  "start": "2026-03-10T22:00:00+02:00",
  "end": "2026-03-11T00:45:00+02:00",
  "average_price": 3.21,
  "unit": "c/kWh",
  "price_periods": [...]
}

Scheduling appliances at the cheapest time

Call this service once per day after tomorrow's prices arrive, store the result in an input_datetime helper, and trigger your appliance from that. See Automation guides → Schedule appliance at cheapest upcoming window for a complete example.


kilowahti.average_price

Returns aggregate price statistics for a time range, using spot effective price (with VAT and commission). Fixed-price periods and transfer are not included.

service: kilowahti.average_price
data:
  start: "2026-03-10T00:00:00"
  end: "2026-03-10T23:59:59"

Response:

{
  "average_price": 5.14,
  "min_price": 1.23,
  "max_price": 12.87,
  "unit": "c/kWh",
  "slot_count": 96
}


Generation & export services

These services require generation to be enabled in configuration.


kilowahti.get_export_prices

Returns export price slots for a time range, using the configured export pricing mode (spot-linked or fixed rate).

service: kilowahti.get_export_prices
data:
  start: "2026-03-10T00:00:00"
  end: "2026-03-10T23:59:59"

Response:

{
  "unit": "c/kWh",
  "price_periods": [
    {
      "time": "2026-03-10T00:00:00+02:00",
      "export_price": 3.00
    }
  ]
}


kilowahti.best_export_hours

Finds the most profitable consecutive window for grid export within a time range, using export price.

service: kilowahti.best_export_hours
data:
  start: "2026-03-10T08:00:00"
  end: "2026-03-10T20:00:00"
  hours: 2

Response:

{
  "start": "2026-03-10T14:00:00+02:00",
  "end": "2026-03-10T16:00:00+02:00",
  "average_export_price": 8.45,
  "unit": "c/kWh",
  "price_periods": [...]
}


kilowahti.generation_schedule

Takes an hourly solar generation forecast and returns a recommended action for each slot.

service: kilowahti.generation_schedule
data:
  forecast:
    - time: "2026-03-10T10:00:00"
      kwh: 2.5
    - time: "2026-03-10T11:00:00"
      kwh: 3.1

Response:

{
  "schedule": [
    {
      "time": "2026-03-10T10:00:00+02:00",
      "kwh": 2.5,
      "action": "self_consume",
      "export_price": 3.20,
      "self_consumption_value": 7.85
    }
  ]
}

Possible action values: self_consume, export, charge_battery.


Fixed-period management services

kilowahti.add_fixed_period

Adds a fixed-price contract period. Periods cannot overlap.

service: kilowahti.add_fixed_period
data:
  label: "Winter fixation"
  start_date: "2026-01-01"
  end_date: "2026-03-31"
  price: 8.5

Note

price is entered gross (VAT included). It is used as-is — no VAT is added.


kilowahti.remove_fixed_period

Removes a fixed-price period by its ID (returned by list_fixed_periods).

service: kilowahti.remove_fixed_period
data:
  period_id: "3f4a1b2c-..."

kilowahti.list_fixed_periods

Lists all configured fixed-price periods.

service: kilowahti.list_fixed_periods
data: {}