Any good ideas are welcome. Nordpool Energy Price per hour

There is free access to the Nordpol API here:
https://www.energidataservice.dk/tso-electricity/elspotprices

1 Like

Hello!

How do you pull the information, what runs under that, i am in estonia also looking for the nordpool information for homeassistant.
Thanks ahead.

Hi.
I’m not sure that I understand your question.
Nordpool prices come from nordpool add-on.
The script in question assigns value to sensor named “el_tariff” as defined in the script.

Hi!
Thanks for the quick repsonse. I am unable to get the addon to work. I have tried the yaml configurations and so on, but no outcome. I am confused the about the create template line. As i am quite newbie in this matter, could you guide mie please. I have added the addon from the HACS, but i am unable to create the sensor…
Thanks

It’s been some time when I last had to configure it.
I believe now it should be configured graphically over UI not yaml.
nordpool prices and tariffs are two different items which you combine later in your automations.

Thank you for your repsonse. I am fiddling with yaml, as i am unable to find the graphical side for the nordpool. I do understand that the tariffs and prices are two different items. I am unable to make the sensor work, the tariff part is way ahead for me for now. My plan is to automate the air heat pump to work automatically, when the prices are low and to switch off when they are above my price level (at least this is the idea, why i am dealing with this.)
I am unable to make the sensor work. i am missingi something, but cannot figufre out…
Thank you

Hello!
I got the sensor working, i added ocnf in configuratin.yaml and then also made changes to lovlace and sensor files, and at least i see now something…
Now to define everythin… If you can direct me foward, i would be most thankful

Wjaceh! You were correct. It is now possible over UI. Got the sensor to work. Thanks

Now it is possible to get the graph for daily electric prices.

  1. Install Apex chart card (https://github.com/RomRider/apexcharts-card)
  2. Add the following configuration to lovelace card.
type: 'custom:apexcharts-card'
graph_span: 1d
span:
  start: day
series:
  - entity: sensor.nordpool_kwh_fi_eur_3_10_024
    data_generator: |
      return entity.attributes.raw_today.map((entry) => {
        return [new Date(entry.start), entry.value];
      });
    type: column

And this will give you this kind of graph of daily prices.

image

6 Likes

How you have changed the EUR to cents?

      return entity.attributes.raw_today.map((entry) => {
        return [new Date(entry.start), entry.value * 100];

or You can of course use series: transform: function :slight_smile:
Best, JR

1 Like

And here it is presented with today and tomorrow in a nice Apex Chart Card (awesome card - must have for everyone)

NOTE: Right now there is something f–ked up, the sensor is presenting prizes in eur or something instead of NOK, this will probably get fixed pretty soon :slight_smile:

          - type: 'custom:apexcharts-card'
            header:
              show: true
              title: Nordpool Prize -> 48 hours
              show_states: false
            graph_span: 2d
            span:
              start: day
            series:
              - entity: sensor.nordpool_kwh_krsand_nok_3_10_025
                name: Today
                data_generator: |
                  return entity.attributes.raw_today.map((entry) => {
                    return [new Date(entry.start), entry.value];
                  });
                type: column
                show:
                  legend_value: false
                  in_header: false
                extend_to_end: false
              - entity: sensor.nordpool_kwh_krsand_nok_3_10_025
                name: Tomorrow
                data_generator: |
                  return entity.attributes.raw_tomorrow.map((entry) => {
                    return [new Date(entry.start), entry.value];
                  });
                type: column
                show:
                  legend_value: false
                  in_header: false

image

5 Likes

You can change the price to to be displayed on the Nordpool component settings.

What could be wrong that I have only today’s values?

Configuration YAML:

  - platform: nordpool
    VAT: True
    currency: "EUR"
    low_price_cutoff: 0.5
    region: "EE"
    precision: 3
    price_type: kWh
    friendly_name: "Power"

Lovelace code:

type: custom:apexcharts-card
header:
  show: true
  title: Nordpool Prize -> 48 hours
  show_states: false
graph_span: 2d
span:
  start: day
series:
  - entity: sensor.nordpool_kwh_ee_eur_3_05_02
    name: Today
    unit: Cent
    data_generator: |
      return entity.attributes.raw_today.map((entry) => {
        return [new Date(entry.start), entry.value * 100];
      });
    type: column
    show:
      legend_value: false
      in_header: false
    extend_to_end: false
  - entity: sensor.nordpool_kwh_ee_eur_3_05_02
    name: Tomorrow
    unit: Cent
    data_generator: |
      return entity.attributes.raw_tomorrow.map((entry) => {
        return [new Date(entry.start), entry.value * 100];
      });
    type: column
    show:
      legend_value: false
      in_header: false

and result:

The Nordpool energy price reporting is sometimes very up and down and quite a few times I have seen that the tomorrow values are being reported late. So give it some time and it will probably pop-up.

I compare your code with mine and could see anything different, so your code is valid.

Thanks. Tomorrows prices are available now.

Is it possible to get this info into the energy section thingy?

I mean here:

Tia

I want to find the min and max values of “tomorrow” to use in some automations. Is this possible?
Min and Max for today have their own attributes, so thats easy, but I’m not good enough to find the same for the “tomorrow price” :thinking: :exploding_head:

1 Like

Hi – I got a Swedish energy spot price sensor built in the following manner:

  1. I used a command_line sensor to get the current hour’s spot price from elen.nu:
- platform: command_line
  name: SE3 Stockholm Electricity Spot Price Text
  command: curl -s 'https://elen.nu/dagens-spotpris/se3-stockholm/' | grep -A 1 "`date +'%Y-%m-%d %H:00'`" | sed  's/,/./g'
  scan_interval: 3600

The command is broken up as:
curl - get the raw HTML of the web page
date - print the current date in YYYY-MM-DD HH:00 format
grep - find the line with that date and time, and then print it and the one line after (-A 1)
sed - replace the , in the price (XXX,XX) with a period.

I really wanted to use a second grep to pull out the value directly, but I couldn’t get the grep in home assistant to do that.

  1. So I use a template_sensor to extract it:
  - name: "SE3 Stockholm Electricity Spot Price"
    unique_id: se3_stockholm_electricity_spot_price
    state: >
      {{ states("sensor.se3_stockholm_electricity_spot_price_text") | regex_findall_index("\d+\.\d\d")|float|multiply(0.01) }}
    unit_of_measurement: 'SEK/kWh'
  1. Then I use another template sensor to compute the approximate total price paid:
  - name: "Electricity Spot Price Total"
    unique_id: electricity_spot_price_total
    state: >
      {{ (states("sensor.se3_stockholm_electricity_spot_price") | float + 0.06 + 0.305 + 0.445) * 1.25 }}
    unit_of_measurement: 'SEK/kWh'
# Energiskatt - 0.445 1 jan 2021 -- https://www.energimarknadsbyran.se/el/dina-avtal-och-kostnader/elrakningen/energiskatt-skattesatser-och-kostnader/
# Vatetnfall överföringsavgift - 0.305 -- https://www.vattenfalleldistribution.se/el-hem-till-dig/elnatspriser/
# Skekraft påslag - 0.06 - https://www.skekraft.se/privat/elavtal/rorligt-elpris/#buypopup
# MOMS 25%

I hope this is helpful!
-David

Sweetness! Such a nice explanation! And it does work on the ‘Energy’-tab?

Is it possible to grab the info from the already known data in the nordpool sensor? (see below)

Current price
82.91
Average
78.045
Off peak 1
51.051
Off peak 2
66.41
Peak
97.682
Min
29.241
Max
120.105
Unit
kWh
Currency
SEK
Country
Sweden
Region
SE3
Low price
false
Tomorrow valid
true
Today
29.575, 29.241, 36.009, 40.558, 53.619, 58.229, 63.376, 97.804, 118.2, 120.105, 117.582, 108.423, 90.438, 88.29, 83.184, 84.035, 89.395, 100.428, 100.58, 98.361, 82.91, 63.376, 60.458, 58.897
Tomorrow
57.47, 57.146, 55.727, 54.308, 48.045, 54.278, 57.217, 58.26, 58.737, 71.009, 81.102, 81.842, 82.116, 79.937, 79.157, 80.312, 91.216, 111.464, 122.733, 122.834, 107.36, 95.797, 81.082, 62.577
Raw today
- start: '2021-09-24T00:00:00+02:00'
end: '2021-09-24T01:00:00+02:00'
value: 29.575
- start: '2021-09-24T01:00:00+02:00'
end: '2021-09-24T02:00:00+02:00'
value: 29.241
- start: '2021-09-24T02:00:00+02:00'
end: '2021-09-24T03:00:00+02:00'
value: 36.009
- start: '2021-09-24T03:00:00+02:00'
end: '2021-09-24T04:00:00+02:00'
value: 40.558
- start: '2021-09-24T04:00:00+02:00'
end: '2021-09-24T05:00:00+02:00'
value: 53.619
- start: '2021-09-24T05:00:00+02:00'
end: '2021-09-24T06:00:00+02:00'
value: 58.229
- start: '2021-09-24T06:00:00+02:00'
end: '2021-09-24T07:00:00+02:00'
value: 63.376
- start: '2021-09-24T07:00:00+02:00'
end: '2021-09-24T08:00:00+02:00'
value: 97.804
- start: '2021-09-24T08:00:00+02:00'
end: '2021-09-24T09:00:00+02:00'
value: 118.2
- start: '2021-09-24T09:00:00+02:00'
end: '2021-09-24T10:00:00+02:00'
value: 120.105
- start: '2021-09-24T10:00:00+02:00'
end: '2021-09-24T11:00:00+02:00'
value: 117.582
- start: '2021-09-24T11:00:00+02:00'
end: '2021-09-24T12:00:00+02:00'
value: 108.423
- start: '2021-09-24T12:00:00+02:00'
end: '2021-09-24T13:00:00+02:00'
value: 90.438
- start: '2021-09-24T13:00:00+02:00'
end: '2021-09-24T14:00:00+02:00'
value: 88.29
- start: '2021-09-24T14:00:00+02:00'
end: '2021-09-24T15:00:00+02:00'
value: 83.184
- start: '2021-09-24T15:00:00+02:00'
end: '2021-09-24T16:00:00+02:00'
value: 84.035
- start: '2021-09-24T16:00:00+02:00'
end: '2021-09-24T17:00:00+02:00'
value: 89.395
- start: '2021-09-24T17:00:00+02:00'
end: '2021-09-24T18:00:00+02:00'
value: 100.428
- start: '2021-09-24T18:00:00+02:00'
end: '2021-09-24T19:00:00+02:00'
value: 100.58
- start: '2021-09-24T19:00:00+02:00'
end: '2021-09-24T20:00:00+02:00'
value: 98.361
- start: '2021-09-24T20:00:00+02:00'
end: '2021-09-24T21:00:00+02:00'
value: 82.91
- start: '2021-09-24T21:00:00+02:00'
end: '2021-09-24T22:00:00+02:00'
value: 63.376
- start: '2021-09-24T22:00:00+02:00'
end: '2021-09-24T23:00:00+02:00'
value: 60.458
- start: '2021-09-24T23:00:00+02:00'
end: '2021-09-25T00:00:00+02:00'
value: 58.897
Raw tomorrow
- start: '2021-09-25T00:00:00+02:00'
end: '2021-09-25T01:00:00+02:00'
value: 57.47
- start: '2021-09-25T01:00:00+02:00'
end: '2021-09-25T02:00:00+02:00'
value: 57.146
- start: '2021-09-25T02:00:00+02:00'
end: '2021-09-25T03:00:00+02:00'
value: 55.727
- start: '2021-09-25T03:00:00+02:00'
end: '2021-09-25T04:00:00+02:00'
value: 54.308
- start: '2021-09-25T04:00:00+02:00'
end: '2021-09-25T05:00:00+02:00'
value: 48.045
- start: '2021-09-25T05:00:00+02:00'
end: '2021-09-25T06:00:00+02:00'
value: 54.278
- start: '2021-09-25T06:00:00+02:00'
end: '2021-09-25T07:00:00+02:00'
value: 57.217
- start: '2021-09-25T07:00:00+02:00'
end: '2021-09-25T08:00:00+02:00'
value: 58.26
- start: '2021-09-25T08:00:00+02:00'
end: '2021-09-25T09:00:00+02:00'
value: 58.737
- start: '2021-09-25T09:00:00+02:00'
end: '2021-09-25T10:00:00+02:00'
value: 71.009
- start: '2021-09-25T10:00:00+02:00'
end: '2021-09-25T11:00:00+02:00'
value: 81.102
- start: '2021-09-25T11:00:00+02:00'
end: '2021-09-25T12:00:00+02:00'
value: 81.842
- start: '2021-09-25T12:00:00+02:00'
end: '2021-09-25T13:00:00+02:00'
value: 82.116
- start: '2021-09-25T13:00:00+02:00'
end: '2021-09-25T14:00:00+02:00'
value: 79.937
- start: '2021-09-25T14:00:00+02:00'
end: '2021-09-25T15:00:00+02:00'
value: 79.157
- start: '2021-09-25T15:00:00+02:00'
end: '2021-09-25T16:00:00+02:00'
value: 80.312
- start: '2021-09-25T16:00:00+02:00'
end: '2021-09-25T17:00:00+02:00'
value: 91.216
- start: '2021-09-25T17:00:00+02:00'
end: '2021-09-25T18:00:00+02:00'
value: 111.464
- start: '2021-09-25T18:00:00+02:00'
end: '2021-09-25T19:00:00+02:00'
value: 122.733
- start: '2021-09-25T19:00:00+02:00'
end: '2021-09-25T20:00:00+02:00'
value: 122.834
- start: '2021-09-25T20:00:00+02:00'
end: '2021-09-25T21:00:00+02:00'
value: 107.36
- start: '2021-09-25T21:00:00+02:00'
end: '2021-09-25T22:00:00+02:00'
value: 95.797
- start: '2021-09-25T22:00:00+02:00'
end: '2021-09-25T23:00:00+02:00'
value: 81.082
- start: '2021-09-25T23:00:00+02:00'
end: '2021-09-26T00:00:00+02:00'
value: 62.577

For now, I’ll just steal your setup straight off. :slight_smile: (still learning a lot).

I have plans for HA to tell me if it’s cheaper to charge car/run washer etc… depending on if selling surplus solar pays less than buying from grid.
Also plans to start/stop charging car calculated on if it’s needed, and if it’s cheap.

Side note, do skekraft have a monthly fee? with my current usage, i would land on 31.40Sek per month and that is cheaper than my monthly fee, but without a markup on the spot price

Lastly " Varför betalas moms på energiskatt?" (translated, why pay vat on energy tax).