Any good ideas are welcome. Nordpool Energy Price per hour

Thank you, i will follow that.
I just have no idea how you use that template. :slight_smile:

I have it like that in configutarion.yaml (under sensor)

  - platform: template
    sensors:
      el_tariff:
        friendly_name: "Elektri tariifid"
        unit_of_measurement: '€/kWh'
        value_template: >-
          {% macro calc(v) -%}
           {%set d = {"operator_margin": 0.001,
                      "electricity_tariff": 0.00447,
                      "renewable_tariff": 0.0104,
                      "nw_fee_night": 0.0246,
                      "nw_fee_day": 0.0423
           } %}
          {%set day_price = v + ((d.operator_margin + d.renewable_tariff + d.electricity_tariff + d.nw_fee_day) * 1.2 | float ) | round(4)%}
          {%set night_price = v + ((d.operator_margin + d.renewable_tariff + d.electricity_tariff + d.nw_fee_night) * 1.2 | float ) | round(4)%}
          {% if now().timetuple().tm_isdst == 1%}
           {% if now().hour > 8 %}
           {{day_price}}
           {% else %}
             {{night_price}}
           {% endif %}
          {% else %}
            {% if now().hour >= 7 and now().hour < 23%}
              {{day_price}}
            {% else %}
              {{night_price}}
            {% endif %}
          {% endif %}
          {%- endmacro %}

          {{calc(0)}}     

I only calculate tariff here but you could include your base price already to formulas.

I have the exact same question, how to show those today/tomorrow values in a graph…

I’m splitting out the values to 2 sensors, but can’t find anything that will actually draw it out based on those values, i was thinking in overlaying today/tommorow’s values but no go at it atm.

- platform: template
    sensors: 
      norpool_values_today:
        friendly_name: "Norpool today"
        value_template: "{{state_attr('sensor.elspot_kwhse4sek210', 'today') }}"
       
      norpool_values_tomorrow:
        friendly_name: "Norpool tomorrow"
        value_template: "{{state_attr('sensor.elspot_kwhse4sek210', 'tomorrow') }}"

Running hassio btw.

1 Like

I still have no idea how to make graphs, that would be very nice, but so far i managed to calculate total cost of electricity like this, thanks to wjaceh for idea:

  sahko_siirtohinta:
    friendly_name: "SähkÜ siirtohinta"
    unit_of_measurement: '€/kWh'
    icon_template: mdi:flash
    entity_id: sensor.elspot_kwhfieur410
    value_template: >-
      {% macro calc(v) -%}
      {%set day_price = v + (0.0475 | float )%}
      {%set night_price = v + (0.0304 | float )%}
      {% if now().timetuple().tm_isdst == 1%}
       {% if now().hour > 8 %}
       {{day_price}}
       {% else %}
         {{night_price}}
       {% endif %}
      {% else %}
        {% if now().hour >= 7 and now().hour < 22%}
          {{day_price}}
        {% else %}
          {{night_price}}
        {% endif %}
      {% endif %}
      {%- endmacro %}

      {{calc(0)}}

  sahko_kok_hinta:
    friendly_name: "SähkÜn kokonaishinta"
    icon_template: mdi:flash
    unit_of_measurement: '€/kWh'
    value_template: "{{ states('sensor.elspot_kwhfieur410') | float + states('sensor.sahko_siirtohinta') | float }}"

I did include electric company fee in beginning. And last i calculate all together.

Has anyone figured out how to put these today and tomorrow values in graph?

Nordpool is my first custom component to tacle with and I have a problem.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 346, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/nordpool/__init__.py", line 6, in <module>
    import pendulum
ModuleNotFoundError: No module named 'pendulum'

Thats the log file and below is the component.

I copied the custom_components to config file and copied this to config.yaml

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 currecy
    currency: "EUR"

    # 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: "FI"

    # 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 W
    # default: kWh
    price_type: kWh

    friendly_name: "Power"

Is there something else I need to do…?

You are basically missing the required dependency “pendulum”.

But instead of installing that by yourself you should install HACS instead and then install nordpool using HACS. HACS will install all dependencies etc. You can find info about HACS here: https://hacs.xyz

1 Like

Thanks for the help. I managed with HACS and custom component from there. Now I´m hoping for the same graph as the others :slight_smile: :grinning:

1 Like

It appears, that just Keggis post did not catch much attention. That is not good, since it points to a good solution for data on electricity prices all over Europe.

For us who want to charge a BEV (Battery Electric Vehicle) at night during the cheapest hours, it is not sufficient to know which single hour is the cheapest, we need a list of hours price and pick a group of hours - contiguous or not - to charge.

I have written a php-program which displays the list of hour prices fetched by API from entsoe.eu and can pick what I want manually. But I am not capable (yet) to feed this information into HASSIO since both HASS and Python are very new to me and sending a webhook from the php-code to HASS requires to open ports in my home router which I do not like.

And forget about Nordpool: either you have to use it illegally or pay for access. entsoe.eu is free and they explicitly state some place something like (my wording from memory and understanding): You are allowed to fetch the data even if the entity which supplies the data to us [i.e. nordpool] does not allow you to fetch the data there.

My program: https://haffner.no/API-tools/elprice-web.php

The url to the API for Oslo and one of these days: https://transparency.entsoe.eu/api?documentType=A44&in_Domain=10YNO-1--------2&out_Domain=10YNO-1--------2&periodStart=202001190000&periodEnd=202001192300&securityToken=MY_API_KEY

Is somebody interested to take this further?

2 Likes

What makes you think you need to pay for access to Nordpool prices?

https://www.nordpoolgroup.com/services/power-market-data-services/

See prices at the bottom

i cant find pendulum on hacs?
Can someone help a noob like me! :smiley:

You don’t have to install pendulum when installing nordpool through HACS. Pendulum is just a dependency and will be auto installed.
So just find nordpool in HACS, install it and you are done.

Thank you!
Can you please explain how to use this? :stuck_out_tongue:
"Run the create_template script if you want one sensors for each hour. See the help options with python create_template --help"

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

2 Likes

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.

1 Like

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