Skip to content

About

Home Assistant integration for the Strømligning API

Topics

Resources

Stars

61 stars

Watchers

2 watching

Forks

Repository files navigation

Current Release Github All Releases hacs_badge

Buy Me A Coffee

Stromligning for Home Assistant integrates Day Ahead spotprices for electricity, from the Stromligning API.

The integration automatically recognises tariff settings from the Home Assistant home location coordinates and allows you to select your electricity vendor.

Requires Home Assistant 2024.12.0 or newer.

Table of Content

Installation

Setup

Use the custom template to show the next x cheapest hours

Installation:

Option 1 (easy) - HACS:

  • Ensure that HACS is installed.
  • Search for and install the "Stromligning" integration (or click the blue button below, to take you there directly).
  • Restart Home Assistant.

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Option 2 - Manual installation:

  • Download the latest release.
  • Unpack the release and copy the custom_components/stromligning directory into the custom_components directory of your Home Assistant installation.
  • Restart Home Assistant.

Setup

My Home Assistant shortcut:

Or go to Home Assistant > Settings > Integrations

Add "Stromligning" integration (If it doesn't show, try CTRL+F5 to force a refresh of the page)

The device's model field shows the electricity agreement name, price interval, and forecast setting, for example Provider - Product (1h, forecasts disabled). These details update when options change. Device names, integration titles, and entity IDs do not include the agreement or settings. Existing names and entity IDs are preserved.

API key (optional)

You can enter a personal API key from stromligning.dk/bruger/api-noegler during setup or in the integration options. With a key, the API counts its rate limits per key instead of per IP address. Leave the field empty to use the API without a key. If the API rejects the saved key, Home Assistant asks for a new one; leaving that field empty also continues without a key. The key is stored in the config entry and is never logged.

Spot price forecasts

Enable forecasts in the integration options to create forecasts_spotprice_vat and forecasts_spotprice_ex_vat. The VAT-exclusive sensor is disabled by default; enable it in the entity settings if needed.

Like the existing forecast sensors, their state is the last successful update time. Their prices attribute contains intervals with price, start, and end. Here, price is the electricity spot price in DKK/kWh, including or excluding VAT. Tariffs, taxes, and supplier surcharges are excluded.

The sensors use the same forecast periods as forecasts_vat and forecasts_ex_vat, starting the day after tomorrow. An empty forecast produces an empty prices list.

For an EMHASS price list, use the VAT-exclusive sensor's price values:

{{ state_attr('sensor.stromligning_forecasts_spotprice_ex_vat', 'prices')
   | map(attribute='price') | list }}

Replace the entity ID with the one from your installation and select the periods required by your EMHASS configuration.

Sale prices for surplus production

Enable "Include sale prices for surplus production" in the integration options to create production_price_vat and production_price_ex_vat, for example for solar panels. The VAT-exclusive sensor is disabled by default.

The state is the current sale price: the spot price, which carries no VAT, less the production tariffs from Energinet and your grid supplier. In production_price_vat the deducted tariffs include VAT; in production_price_ex_vat they do not. The prices attribute lists today's periods in the selected resolution. Prices come from the API's /prices/production endpoint for the grid supplier at Home Assistant's home location, which is one extra request per update. The setting is off by default. If sale prices are temporarily unavailable, the integration retries them and continues updating consumption prices. The sale price sensors use cached values only while they cover the current period.

Use the custom template to show the next x cheapest hours

Copy the custom_templates/FindCheapestPeriod.jinja to the custom_templates directory in your config folder (if it doesn't exist then create the folder) Reload Home Assistant and use the Jinja template by inserting the example below in a template sensor helper

{% from 'FindCheapestPeriod.jinja' import FindCheapestPeriod%}
{% set earliestStartTime = now() %}
{% set latestStartTime = now() + timedelta(days=2) %}
{% set periodLength = timedelta(hours=3) %}
{{ FindCheapestPeriod(earliestStartTime , latestStartTime , periodLength, false) }}

This will result in a sensor showing the cheapest 3 hours within the known prices

Fixed-price agreements

Fixed-price products have an extra setup step for your agreed electricity price in kr/kWh including VAT. Enter only the electricity price, without grid tariffs, taxes or subscription fees. The API calculates tariffs and taxes separately.

The integration does not use the product's current advertised price as your agreement price. Change the saved price under the integration's Configure settings when your agreement changes. Selecting another fixed-price product requires entering its price; selecting a variable product removes the saved fixed price.

Existing fixed-price entries without a saved price show a repair notification with instructions for entering it under Configure.

About

Home Assistant integration for the Strømligning API

Topics

Resources

Stars

61 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages