Any good ideas are welcome. Nordpool Energy Price per hour

This is very interesting.
Any idea on how to turn this around and select the two most expensive hours before and after midd day (12:00)?
I am tryin to do some peak shaving, and want to turn off some of the the equipment during the most expensive hours. Since we normally see a morning peak and an afternoon peak I want a sensor that goes high in the peak hours.

Hi

Love the idea of getting this integrated, but i am a terrible noob, that can only right now do integration for stuff already in the HASS “store”

My dream scenario would be to be able to pull data like “Current price” and “tendency”

If i could do this, i could do some IFTTT integration to say “Start washing machine if price is below X and the tendency is falling ot stable”

This to be able to do washing and tumbling of clothes when the price is the lowest


Would be great to save a bit of money on electricity, while at the same time use electricity when there is most surplus.

In summer it’s the other way around, i have solar panels and a battery pack, so there i will want to start the machine if production is above a certain wattage, and the battery pack is atleast 50% full, to maximise the own-use of electricity that i produce.

Here i get paid for what i produce right now, and pay for what i use right nok, and the difference is that i get 1/6 for what i sell, compared to what i must pay, so it is a very good deal to use my own power when i make it, because it will only cost about 1/6 of what i must pay if i have to buy the electricity to run the machines

1 Like

Comparing current price with future average/media/lowpass values would seem to be a good indicator. You problably need to modify the nordpool custom component, or make a separate script/component to which you feed the nordpool raw data and do the processing.

Yeah, i am nowhere near bright enough to do that.

I will just have to hope someone else, with enough intelligence needs these figures and makes this integration.

I can do basic linux stuff, and all of the automated stuff.

I also have a Roth Touchline controller that i wanted to integrate, but i can not even get that to work, so i am pretty “useless” unless someone else does the genious stuff, and i can just “copy” or install it.

I use the code below to use Nordpool prices to calculate a price level indicator (same as Tibber), just replaced the text output with numeric values for simple use in automations (level 1-5, 5 most expensive). This works very well and allows me to for ex. set a savings program when price level is 5. The code only calculates the current price level. It would be very useful to calculate this value for all values in the Nordpool sensor, both today and tomorrow.

This could be developed further to indicate how long a level 5 savings program will be active etc, and eventually users could input the max length the program should be active and normal program should be re-instated.

Any idea how the future price levels can be calculated?

Code for average price last 72 hours:

sensor:
  - platform: nordpool
    region: "Oslo"
  - platform: statistics
    name: "Strompris_3d_snitt"
    entity_id: sensor.nordpool_kwh_oslo_nok_3_10_025
    precision: 4
    sampling_size: 144
    max_age:
      hours: 72

Code to set price level:

  - platform: template
    sensors:
      pricelevel2:
        friendly_name: "StrÞmprisnivÄ"
        unit_of_measurement: 'Level'
        value_template: >-
            {% if states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float(0.5) >= states('sensor.strompris_3d_snitt')|float(0.5) *0.9
                and states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float(0.5) < states('sensor.strompris_3d_snitt')|float(0.5) *1.15 %}
                {{3}}
            {% elif states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float >= states('sensor.strompris_3d_snitt')|float *0.6
                and states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float < states('sensor.strompris_3d_snitt')|float *0.9 %}
                {{2}}
            {% elif states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float < states('sensor.strompris_3d_snitt')|float *0.6 %}
                {{1}}
            {% elif states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float >= states('sensor.strompris_3d_snitt')|float *1.15
                and states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float < states('sensor.strompris_3d_snitt')|float *1.4 %}
                {{4}}
            {% elif states('sensor.nordpool_kwh_oslo_nok_3_10_025')|float >= states('sensor.strompris_3d_snitt')|float *1.4 %}
                {{5}}
            {% endif %}
4 Likes

Hi!
I use this:

alias: Boiler börsihinnaga tunnipÔhiselt tööpÀevadel
description: ''
trigger:
  - platform: state
    entity_id: sensor.nordpool_kwh_ee_eur_3_10_02
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ ([(state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[0]
              |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[1] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[2] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[3] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[4] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[5] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[6] |
                              float(default=0)),
                              (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[7] |
                              float(default=0))] | sort)[4] >=
                              state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','current_price') | float }}
          - condition: time
            after: '00:00'
            before: '08:00'
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.boiler
      - conditions:
          - condition: template
            value_template: |2-
                {{ ([
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[14] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[15] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[16] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[17] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[18] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[19] |
                                float(default=0))] | sort)[1] >=
                                state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','current_price') | float }}
          - condition: time
            after: '15:00'
            before: '20:00'
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.boiler
      - conditions:
          - condition: template
            value_template: |2-
               {{ ([
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[0] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[1] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[2] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[3] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[4] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[5] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[6] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[7] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[8] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[9] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[10] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[11] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[12] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[13] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[14] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[15] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[16] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[17] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[18] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[19] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[20] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[21] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[22] |
                                float(default=0)),
                                (state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','today')[23] |
                                float(default=0))] | sort)[20] >=
                                state_attr('sensor.nordpool_kwh_ee_eur_3_10_02','current_price') | float }}
          - condition: time
            after: '00:01'
            before: '23:59'
            weekday:
              - sat
              - sun
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.boiler
    default:
      - service: switch.turn_off
        target:
          entity_id: switch.boiler
mode: single

1 Like

Hi

I have configured my nordpool integration, it works good and as a graph is very convenient. Although I am experiencing one problem that is ruining all the fun.

The prices displayed seem to all be offset by one hour. For example if I look at the current price shown in HA it’s showing the price of what’s shown to be last hours on Nordpools website. Is there a fix for this or have I done something wrong?

Seems like you guys are a lot smarter than me, i would not know where to start with this “manual” integration.

I dont know how hard it is, but would it be possible for someone to make this an “official” integration, that was loadable via the “shop” in HA itself.

Would really love to have this, for future “If this then that” integration to know when to trigger my washing machine to start, to get the power at the cheapest price

1 Like

So in the end i got it working.

Installed HACS and got it installed that way.

Made a card (Found the code needed on another site)

And now i have this

Seems to work okay.

When i made the sensor with HACS all of the info that it needed, about what location, what prices and so on, was presented to me as a setup option. I selected the right settings from drop down boxes, and it was all set up.

Only “problem” now, is that i actually wanted to fiddle around with the settings, but it does not seem, that the settings are saved inside the configuration.yaml file.

Does anyone here know where these settings are actually saved, i have looked everywhere and not found them in any files

This is nice, I have been working on something similar. Can you share the code? Assume it’s calculating the 10 most expensive hours in a day?

I created three sensors to keep track of when the price is cheapest:

template:
  - sensor:
      - name: 'cheapest price'
        state: "{% set prices=states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_today + states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_tomorrow -%}
{%set list = namespace(prices=[]) -%}
{% for price in prices -%}
{%- if price.end > now() -%}{% set list.prices = list.prices + [price] -%}{%- endif -%}
{% endfor -%}
{% set cheapest = list.prices | sort(attribute='value') -%}
{{cheapest[0].value}}"
  - sensor:
      - name: 'cheapest price start'
        state: "{% set prices=states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_today + states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_tomorrow -%}
{%set list = namespace(prices=[]) -%}
{% for price in prices -%}
{%- if price.end > now() -%}{% set list.prices = list.prices + [price] -%}{%- endif -%}
{% endfor -%}
{% set cheapest = list.prices | sort(attribute='value') -%}
{{as_timestamp(cheapest[0].start) | timestamp_custom('%H')}}"
  - sensor:
      - name: 'cheapest price end'
        state: "{% set prices=states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_today + states.sensor.nordpool_kwh_se4_sek_2_095_025.attributes.raw_tomorrow -%}
{%set list = namespace(prices=[]) -%}
{% for price in prices -%}
{%- if price.end > now() -%}{% set list.prices = list.prices + [price] -%}{%- endif -%}
{% endfor -%}
{% set cheapest = list.prices | sort(attribute='value') -%}
{{as_timestamp(cheapest[0].end) | timestamp_custom('%H')}}"

I use them in a script to be able to ask google about when the cheapest price is.

Any suggestions to how it coud be optimized is appreciated.

4 Likes

Really nice! Could you share the code please? :slight_smile:

Hi

This is the code, but please understand that this is some code that i found elsewhere, so i am not the author and i have very limited capabilities to answer questions about it.

The “offset” variable is set to +1 for “tomorrow”, if you remove that line, you get prices for “today”

Entity
Insert nordpool sensor here 
 This is where you paste the name of your nordpool sensor.

The color part in the bottom, is where you define what you would consider Cheap (green) medium (Yellow) and expensive (red) this needs to be set, depending on what currency is used
Mine is Danish Crowns, and i just set it to something, i might change it later.

Last but not least. You need to install hacs, to get the apexcharts working.

type: custom:apexcharts-card
experimental:
  color_threshold: true
graph_span: 24h
header:
  title: Electricity Price Tomorrow
  show: true
span:
  start: day
  offset: +1d
now:
  show: true
  label: Now
series:
  - entity: (Insert your nordpool sensor here)
    type: column
    data_generator: |
      return entity.attributes.raw_tomorrow.map((start, index) => {
        return [new Date(start["start"]).getTime(), entity.attributes.raw_tomorrow[index]["value"]];
      });
    color_threshold:
      - value: 0
        color: green
        opacity: 1
      - value: 0.5
        color: yellow
      - value: 1
        color: red
1 Like

Thank you very much for sharing!

Ok sÄ the values that changes the colors are fixed? That is not ideal, but maybe its not possible to have them percentual
 maybe this can be a feature request. :slight_smile:

Anyway, thanks for sharing! I will try this later today!

No no, you just adjust the numbers in the script to match your desired currency

Yea that was what I meant
 :slight_smile: Its fixed values in the configuration. I would like something like this:

 color_threshold:
      - value: 0%
        color: green
      - value: 50%
        color: yellow
      - value: 80%
        color: red

I have made a Feature request on github for this.

Hi,
I don’t understand the sensor code. I:e I want to have data from sensor SE4 so I type “sensor.nordpool_kwh_se4_???”

What are the numbers in the question marks and how do I get them?

You must to enter your nordpool entity_id

image

Yes but this is not my entity_id. Do you know how I find my entity_id? Then I look at Norpool it only says “SE4” but not the number after.

I find it!! Thanks anyway.