Any good ideas are welcome. Nordpool Energy Price per hour

Any idea how one could print all the values in a list, not just a single value? Trying to merge this with @thunderstorm77’s statistics sensor above, so that the price level is not just compared to the average of the previous 72 hours, but also future hours with known price. In other words, I want to print a list of the last 72 hours + the future 24 hours, and calculate levels out of that list.

1 Like

Hi, I am a beginner … I find a lot of information about complicated presentations and cards but how do I do if I only want to see the field “average” in the sensor?

Hi, If you use the Entity card you could select the attribute “average” in the UI.

Graphical mode here:

YAML code here:

type: entity
entity: sensor.nordpool_kwh_trheim_nok_3_10_025
attribute: average
name: Nordpool average today
unit: øre

Replace entity and name to your own information.

Thanks, works perfect :slight_smile:

Works well here as well, but here it has 16 decimals.

Right now it is “0.48791666666666667”

That seems a bit excessive, is there some command that sets it to round to 2 decimals, and also, how did you get it to show it like like you did.

Mine would ideally say “48.79” instead of that long number.

Hello! Anybody integrated nordpool to the Energy. To calculate the price.

Have you set up Nordpool via the UI or YAML?
I set it up with the UI and defined precision as 3 and to show price in cents, which seem to be “øre”.

This is a bit “hacky”, but if you go into “.storage/core.config_entries” and search for Nordpool you can compare with my details. If you make any changes, make sure that you have your backups sorted.
Please ignore the additional costs entry as the uses some of my own template sensors.

            {
                "entry_id": "06d6f13d2339de15fe6fb831f5fb2275",
                "version": 1,
                "domain": "nordpool",
                "title": "Nordpool",
                "data": {
                    "region": "Tr.heim",
                    "currency": "NOK",
                    "VAT": true,
                    "precision": 3,
                    "low_price_cutoff": 1.0,
                    "price_in_cents": true,
                    "price_type": "kWh",
                    "additional_costs": "{{ ((states('sensor.tariff_price_excl_mva')|float)-(states('input_number.rabatt_pr_kwh')|float) | round(3)) /100 }}"
                },
                "options": {},
                "pref_disable_new_entities": false,
                "pref_disable_polling": false,
                "source": "user",
                "unique_id": null,
                "disabled_by": null
            },

Did you solve this? Would it not help if you used median instead of average?

The median is the middle number in a data set. To find the median, list your data points in ascending order and then find the middle number. The middle number in this set is 28 as there are 4 numbers below it and 4 numbers above:
23, 24, 26, 26, 28, 29, 30, 31, 33

Note*: If you have an even set of numbers, average the middle two to find the median. For example, the median of this set of numbers is 28.5 (28 + 29 / 2).
23, 24, 26, 26, 28, 29, 30, 31, 33, 34

One more question regarding this. How do I do then I want to reduce the decimals to 3?

Using the built in command prompt i can not seem to find the .storage folder.

I do know basic linux commands, but i am unable to find that directory ?

I am trying to create a custom list of hourly prices from nordpool data, but I am stuck with list item updates/creating a custom list.

My air/water heat pump does not accomplish much in an hour, as first priority is always DHW production. And price fluctuations do not make sence for me to look at only 1 hour prices. Also rounding the prices makes sence, as I do not really care if price is 71,73,74 - 70 would do better for average/median price calculations.

The idea is to sum 00-01 and 01-02 hourly prices together, creating a list of bi-hourly items with same start, end and hourly price attribute values like in nordpool sensor raw data. Hourly price value would be average of the two hours’ prices for the bi-hour values.

Then I would mround the prices and take median price - to get a price level eliminating high peaks for allowing normal operation of heat pump or stopping it. Also I would like to set a low price level to boost the air/water pump operation when price is low - most probably “below average” would be sufficient.

{% set l=state_attr('sensor.nordpool_kwh_ee_eur_4_095_02', 'raw_today')|sort(attribute='value') %}

{{ l[(11)].value*100 }} value at 12
{{ l[(12)].value*100 }} value at 13
{% set a=(l[(12)].value + l[(11)].value)/2 %}
Mean 24h is : {{ a }}

{##% set l[(12)].value= l[(13)].value %##}
{{ l[(12)].value*100 }} new value at 12

In the above, the line I have commented out does not work. I cannot set a new value to list at 12 like this. What could be wrong or what do you suggest as a solution?

1 Like

Please be aware that you may destroy things by editing directly in that file. You could consider reinstalling the Integration via UI and try to define accuracy and units there.

If you want to go the “hacky” route, this is what I use:
I am using the “Studio Code Server” add-on to browse and edit files directly in the browser.
You could also use the “File Editor”. It’s a bit crude and frustrating to use on the phone, but OK on a computer.

The “.” in front of the folder name defines this folder as a hidden folder. I am not so familiar with Linux yet, but I guess there should be an option to show hidden files and folders.
Some relevant info may possibly be found here.

Got the graph working, I’ve used the Apex.Graph, looks nice :slight_smile:
But the sensor and graph are showing wrong prices.
Wonder what I have done wrong?

you can change currency and country in configuration.yaml file

I would like to have a calculation based on my own real usage to show how much I would save/loose on either fix or nord-pool market price contract.

Does anyone have a solution for calculating the daily/monthly cost using nordpool data? I know I can enter the NP sensor current price to HA-Energy conf. tab, but this is not suiting my needs as I cannot extract the cost from there (I think). I would like to have a custom “cost-meter” where I can manipulate the price better.

a) For power coming from NP price grid - one calculation with NP price as current price cost entity x my consumed energy.
b) For power coming from a fixed price grid - another calculation with fixed price tariffs (day/night) x my consumed energy
c) and then a third calculation showing the difference (profit/loss) either daily/monthly or similar.

I do not need this to be possible on historical data.

Is there some readymade solution for this? Or can I adapt utility meter or some other solution? I would not want to build a custom solution for NP price calculation using hourly meters and multiplying the hourly usage with previous hour’s price.

1 Like

This seems a little bit off. I’m looking at SE4 and the integration is giving me 0.2 SEK/kWh (15:00-16:00) but if I look at Nordpool on the same time it gives me 15,05 EUR/MWh. 15,05 euro to sek = 159,52 / 1000 (to get kWh) = 0.15952. So I guess that would be 0.16SEK/kWh? Or am I missing something?

I try to change font-size and numbers of decimals for attribute “average” in “Entity”. Shall I do that in config or Card_mod and pleace help me with code.

I am hoping to be able to display the previous, current and the 2 next hours prices in my dashboard.
Is there a way to create sensors for these?

Yes, but needs a bit of coding

  • Current - you have it from NP data
  • For previous - update the sensor or input number value so that it is written to be current price at each hour, 59 minutes 55 seconds for instance, this is easiest.
  • Next 2 hours - you have to access the raw prices list and do calculations there, a bit more tricky. Get current hour, find it from the list, take the next 2 elements from list…

Complety neewbie here, but I’m not the only one I can see :slight_smile:

I want to get this running: https://github.com/custom-components/nordpool

It works fine, but what I cannot get to work is the additional_costs (by using a constant it works fine) But I need to change the value at 17 to 20 clock everydya, and that I cannot get to work, can anybody point me in direction on what I do wrong?

This is my configuration.yaml

########################################
# Configure a default setup of Home Assistant (frontend, api, etc)
########################################
default_config:
########################################
# THEMES SETUP
########################################
frontend:
  themes: !include_dir_merge_named themes
  
########################################
# Text to speech SETUP
########################################
tts:
  - platform: google_translate

########################################
# includes
########################################
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#sensor: !include sensor.yaml

########################################
# DANFOSS VENTILATION SETUP
########################################
danfoss_air:
  host: 192.168.86.36
  
########################################
# KNX SETUP
########################################
knx:
  light:
    - name: "Kontor"
      address: "0/1/20"
  switch:
    - name: "Cooper_pluged_in"
      address: "15/1/0"     
#sensor:


########################################
# NORDPOOL SETUP
# konstant_net_tariff = 0.17,
# Elselskab_tariff = 0, -- changed to vindstød, they do not charge extra
# Stat_nedsat_tariff = 0.15,
# Stat_ikke_nedsat_tariff = 0.28,
# Konstant_ekstra_tariff_17_20 = 0.18,
########################################
sensor:
  - platform: nordpool
    VAT: True
    currency: "DKK"
    low_price_cutoff: 0.95
    region: "DK1"
    precision: 3 
    price_type: kWh
    friendly_name: "Strøm Priser"
#    additional_costs: "{{0.6|float}}"
    additional_costs: '{% set s = {
      "konstant_net_tariff": 0.17,
      "konstant_rush_hour_17_20": 0.18,
      "elselskab_tariff": 0.0,
      "stat_nedsat_tariff: 0.15,
      "stat_ikke_nedsat_tariff": 0.28}
      %}
      {% if now().hour >= 17 and now().hour <= 19 %} 
        {{s.konstant_net_tariff + s.elselskab_tariff + s.stat_nedsat_tariff + s.stat_ikke_nedsat_tariff + konstant_rush_hour_17_20|float}}
      {% else %}
        {{s.konstant_net_tariff + s.elselskab_tariff + s.stat_nedsat_tariff + s.stat_ikke_nedsat_tariff|float}}
        {% endif %}'
  
########################################
# Ford Mustang Mach - E SETUP
########################################
  - platform: template
    sensors:
      ford_hv_battery_percent:
        friendly_name: "Batteriniveau"
        value_template: "{{ state_attr('sensor.fordpass_elveh', 'Battery Fill Level') }}"
        unit_of_measurement: "%"
        icon_template: mdi:map-marker-distance            
        device_class: battery
        
      ford_12v_battery:
        friendly_name: "12V batteri spænding"
        value_template: "{{ state_attr('sensor.fordpass_battery', 'Battery Voltage') }}"
        unit_of_measurement: "Volt"
        device_class: battery
              
      ford_distance_to_empty_template:
        friendly_name: "Afstand til tom"
        value_template: "{{ (state_attr('sensor.fordpass_elveh', 'elVehDTE')) | round(0) }}"
        unit_of_measurement: "Km"
        icon_template: mdi:map-marker-distance            
        device_class: battery
      
      ford_plug_status:
        friendly_name: "Tilsluttet lader"
        icon_template: mdi:ev-plug-ccs2
        value_template: >-
          {% if is_state_attr('sensor.fordpass_elveh', 'Plug Status', 0) %}
            Unplugged
          {% elif is_state_attr('sensor.fordpass_elveh', 'Plug Status', 1) %}
            Plugged In
          {% else %}
          {% endif %}