Any good ideas are welcome. Nordpool Energy Price per hour

It’s used in the value template:

        value_template: >
          {{average((state_attr('sensor.nordpool_kwh_se4_sek_3_095_025', 'today') | sort(reverse=true))[int(states('input_select.poolpump_avstangd'))-1],
                    (state_attr('sensor.nordpool_kwh_se4_sek_3_095_025', 'today') | sort(reverse=true))[int(states('input_select.poolpump_avstangd'))]) | 
            round(3) }}

If set to 12: The device will run the 12 cheapest hours (24-12), ie. median
If set to 6: The device will run the 18 cheapest hours (24-6)
If set to 4: The device will run the 20 cheapest hours (24-4)
If set to 2: The device will run the 22 cheapest hours (24-2)

My pool needs at minimum 12 hrs circulation.

You can obviously set your helper to your needs. I do recommend to use even values between 2 and 22, else you may need to change the template.

HTH/Marcus

3 Likes

Hello
If I want to use this, should I enter it as a template?

I copied your code to my configuration.yaml and replaced sensor.nordpool_kwh_se3_sek_3_10_025 with my sensor.nordpool_kwh_fi, however, template sensors remain unvailable, i.e. do not produce any value. My sensor.nordpool_kwh_fi is working and showing correct values.

What I am missing?

Isn’t the Nordpool sensor for Finland called sensor.nordpool_kwh_fi_eur_3_10_024?

I’ve changed that to shorter format for easier use. As I said, it shows correct values. I’ll try to change that back to default and will report the outcome.

EDIT: Changing the sensor name to default did not solve the problem. Unfortunately HA does not give any information why the sensors are unavailable…

I tried using the FI region and it works, but when trying that I noticed that there are two line break errors in my posted code. I updated my script here, but if you want to fix directly in your config file, look around line 10-11 and you’ll see that the lines break in the middle of the Nordpool sensor name.

Yes, I noticed those line breaks and fixed them when tried your code first time.

Interestingly your code works now, it seems like it started to produce values when Nordpool released prices for tomorrow…

Sure I use all templates outside config in templates.yaml and use this code:

- sensor:
  - name: Dagen Timpris SE3 fem billigaste timmarna
    state: >
        {% set x = states("sensor.time") %}
        {% set l=state_attr('sensor.nordpool_kwh_se3_sek_3_10_025_med_moms', 'raw_today')|sort(attribute='value') %}
        {{ (now() >= l[0].start and now() <= l[0].end)
        or (now() >= l[1].start and now() <= l[1].end)
        or (now() >= l[2].start and now() <= l[2].end)
        or (now() >= l[3].start and now() <= l[3].end)
        or (now() >= l[4].start and now() <= l[4].end) }}
1 Like

Hi and thanks
Do you know if it is possible to show the next hour price in a sensor?

Hm no sorry!

1 Like

It seems like the code works only when both today’s and tomorrow’s prices are available. I wonder what the heck is wrong with the code.

How would I do if I want the montly average price?

Hi,

I really need someone way smarter than me :wink:

Since nordpool updates the prices around lunch here in Sweden I try to create a sensor that will show the cheapest X hours today and tomorrow for the next 24 hours.
Lets say I trigger the sensor to update every day at 13:55.
I would then like to combine and sort:
raw_today: Cheapest prices between 14:00-00:00
raw_tomorrow: Cheapest prices 00:00-14:00
Once the cheapest hours are identified and sorted in order I could then automate stuff to run on those X hours for the next 24 hours and the process will repeat next time the sensor updates at 13:55.

I played around in dev tolls with the template editor but I’m way to novice with the templates to figure it out.
Here is a dummy example that is totally just to illustrate what I want:

          {% set l=state_attr('sensor.nordpool_kwh_se4_sek_3_10_025', 'raw_today') .start.strftime >=14:00 end.strftime<=00:00 and state_attr('sensor.nordpool_kwh_se4_sek_3_10_025', 'raw_tomorrow') .start.strftime >=00:00 end.strftime<=14:00 |sort(attribute='value') %}
          {{l[0].value}} / {{l[0].start.strftime("%H:%M")}} - {{ l[0].end.strftime("%H:%M")}}
          {{l[1].value}} / {{l[1].start.strftime("%H:%M")}} - {{ l[1].end.strftime("%H:%M")}}
          {{l[2].value}} / {{l[2].start.strftime("%H:%M")}} - {{ l[2].end.strftime("%H:%M")}}
          {{l[3].value}} / {{l[3].start.strftime("%H:%M")}} - {{ l[3].end.strftime("%H:%M")}}
          {{l[4].value}} / {{l[4].start.strftime("%H:%M")}} - {{ l[4].end.strftime("%H:%M")}}
2 Likes

Hi! I have solar panels and nordpool addon.
In the energy tab, I have exported enegy+nordpool (floating price)
So I see how much I get when exporting the energy.
Now I want this in a card? It can’t be hard, but I have tried everything for a week, and I’m stuck.

Was also thinking of making an automation, so I get a notification every evening how much I have sold.

Hi. How have you solved the issue that Nordpool prices are in CET timezone and not in your HA timezone?

Im a total beginner, both regarding HA and codingand hope I can ask for some guidance to solve this thing. I usually get by reading forum posts and putting pieces of the puzzle together but this proved to be too much.

The main reason for me to start using HA was to try to create a notification/widget based on future prices. What I am trying to do is to get a notification (and hopefully a “widget”) that tells me with how many hours of delay I should start any household appliance that supports delayed timers. The widget would ideally keep up with current time and update itself, rounding off to the nearest half hour.

The widget would basically say: Delay your appliances by X hours (in order to hit the 3 cheapest, consecutive hours - or something like that)

I use Tibber but realised that they dont include future prices anywhere so I managed to install Hacs and the Nordpool sensor which is basically the same data I need to determine any period of lower prices. I see @sepahewe s post about future prices and all but I really have no idea where to start here.

Well, I thought I could at least ask so here it is…

I think this tutorial teaches you what you need to know about loops: https://www.youtube.com/watch?v=g01tJiL-hkk&t=69s. I don’t know exactly how to do this myself, but I hope this gets you started. Smart Home Makers has a bunch of nice tutorials.

Could someone explain to me the attributes Peak, Off Peak 1 and Off Peak 2 ? What are these and what do it give me? What I understand they give the avg price on certain hours a day. But do that give you and how do you use that information?

These are different tariffs, usually based on time of day and/or day of week. You don’t need them if your tariff is always the same.

Hm ok thank you! I dont think we have this in Sweden. Have to look it up first :slight_smile: