/nordpool

nordpool sensor for ha.

Primary LanguagePython

Nordpool integration for Home Assistant

Donate "Buy Me A Coffee"

Nord Pool is a service provider that operates an electricity market and power system services, including the exchange of electricity on a spot market Nordics and Baltic countries.

This integration provides the spot market (hourly) electricity prices for the Nordic, Baltic and part of Western Europe.

The Nordpool sensor provides the current price with today's and tomorrow's prices as attributes. prices become available around 13:00.

EpaxCharts frontend is recommended for visualization of the data.

Table of Contents

Installation
Usage
Other
Troubleshooting

Getting started

Installation

Option 1: HACS

  • Go to HACS -> Integrations,
  • select +,
  • search for nordpool and install it,
  • Restart Home Assistant

Option 2: Manual

From the latest release

cd YOUR_HASS_CONFIG_DIRECTORY    # same place as configuration.yaml
mkdir -p custom_components/nordpool
cd custom_components/nordpool
unzip nordpool-X.Y.Z.zip
mv nordpool-X.Y.Z/custom_components/nordpool/* .  

Usage

Configuration Variables

Configuration Required Description
Region yes Country/region to get the energy prices for. See Country/region codes below for details.
Currency no Default: local currency
Currency used to fetch the prices from the API.
Include VAT no Default: true
Add Value Added Taxes (VAT) or not.
Precision no Default: 3 Rounding number of digits.
Low Price Cutoff no Default: 1
Percentage of average price to set the low price attribute.
IF hour_price < average * low_price_cutoff
THEN low_price = True
ELSE low_price = False
Price in cents no Default: false
Display price in sents in stead of, for example Euros.
Price type no Default: kWh
Price displayed for MWh, kWh or Wh.
Additional Cost no default {{0.0|float}}
Template to specify additional cost to be added.See Additional Costs for more details.

Option 1: UI

  • Go to Settings -> Devices & Services
  • Select + Add Integration
  • search for nordpool and select it
  • Fill in the required values and press Submit

Option 2: YAML

Set up the sensor using the webui or use a yaml.

The sensors tries to set some sane default so a minimal setup can be

sensor:
  - platform: nordpool
    region: "Kr.sand" # This can be skipped if you want Kr.sand

in configuration.yaml

nordpool:

sensor:
  - platform: nordpool

    # Should the prices include vat? Default True
    VAT: True

    # What currency the api fetches the prices in
    # this is only need if you want a sensor in a non local currency
    currency: "EUR"
    
    # Option to show prices in cents (or the equivalent in local currency)
    price_in_cents: false

    # Helper so you can set your "low" price
    # low_price = hour_price < average * low_price_cutoff
    low_price_cutoff: 0.95

    # What power regions your are interested in.
    # Possible values: "DK1", "DK2", "FI", "LT", "LV", "Oslo", "Kr.sand", "Bergen", "Molde", "Tr.heim", "Tromsø", "SE1", "SE2", "SE3","SE4", "SYS", "EE"
    region: "Kr.sand"

    # How many decimals to use in the display of the price
    precision: 3

    # What the price should be displayed in default
    # Possible values: MWh, kWh and Wh
    # default: kWh
    price_type: kWh

    # This option allows the usage of a template to add a tariff.
    # now() always refers start of the hour of that price.
    # this way we can calculate the correct costs add that to graphs etc.
    # The price result of the additional_costs template expects this additional cost to be in kWh and not cents as a float
    # default {{0.0|float}}
    additional_costs: "{{0.0|float}}"

Additional costs

The idea behind a addition_costs is to allow the users to add costs related to the official price from Nordpool.

  • Add simple or complex tariffs
  • Calculate VAT

There are two special special arguments in that can be used in the template (in addition to all default from Homeassistant):

  • now()- this always refer to the current hour of the price
  • current_price Price for the current hour. This can be used for example be used to calculate your own VAT or add overhead cost.

Note: When configuring nordpool using the UI, things like VAT and additional costs cannot be changes. If your energy supplier or region changes the cost or rules on a semi-regular basis, the YAML configuration might be better for you.

Example 1: Percentage (VAT)

Add 19 % VAT of the current hour's price

{{current_price * 0.19}}

Example 1: Overhead per kWh

Add 1,3 cents per kWh overhead cost to the current hour's price

{{current_price + 0.013}}

Tariff example
{% set s = {
    "hourly_fixed_cost": 0.5352,
    "winter_night": 0.265,
    "winter_day": 0.465,
    "summer_day": 0.284,
    "summer_night": 0.246,
    "cert": 0.01
}
%}
{% if now().month >= 5 and now().month <11 %}
    {% if now().hour >=6 and now().hour <23 %}
        {{s.summer_day+s.hourly_fixed_cost+s.cert|float}}
    {% else %}
        {{s.summer_night+s.hourly_fixed_cost+s.cert|float}}
    {% endif %}
{% else %}
    {% if now().hour >=6 and now().hour <23 %}
        {{s.winter_day+s.hourly_fixed_cost+s.cert|float}}
    {%else%}
        {{s.winter_night+s.hourly_fixed_cost+s.cert|float}}
    {% endif %}
{% endif %}

Other

A sensor per hour

By default, one sensor is created with the current energy price. The prices for other hours are stored in the attriutes of this sensor. Most example code you will find use the default one sensor option, but you can create a sensor for every hour if you want.

run the create_template script if you want one sensors for each hour.

See the help options with python create_template --help you can run the script anyhere python is installed. (install the required packages pyyaml and click using pip install packagename)

Troubleshooting

Debug logging

Add this to your configuration.yaml to debug the component.

logger:
  default: info
  logs:
    nordpool: debug
    custom_components.nordpool: debug
    custom_components.nordpool.sensor: debug
    custom_components.nordpool.aio_price: debug