Is there a way to convert my previous data to cents? At the moment i have not “price in cents” ticked when i setup the integration.
I am pretty happy with my Nordpool data based solar battery charging automations at this point, but there are still a few issues.
My main problem is that I can’t seem to get all my fail-safes to work. If the charging process starts due to a bug (today the solcast data didn’t show up after a reboot thus leading to the charging starting although it was not necessary) then it should periodically check if the requirements are met and then stop.
I had hoped this would work since my automation is set to run every hour at 1 Minute past full, but for some Reason it did not adjust itself. I will have to figure out why and see if there is some way to make this more foolproof.
Is there a way to get tomorrows last price for finland (GMT+2). That would be the day after tomorrow 0:00-1:00? Now last value for raw_tomorrow is
- start: '2023-02-02T23:00:00+02:00'
end: '2023-02-03T00:00:00+02:00'
value: 13.746
Hi, smart people.
I want to find the cheapest hours in 2 separate time slots during the day to start my water boiler. For example between 00 and 07, and between 12 and 20.
Any tips?
There was a suggestion in Sep '22, but I found it to fail logically.
I also did a modification of this post but it was too cumbersome. (It had to be split into two sensors which the configuration didn’t like, and it uses up to 5-6 automations just to turn on and off the boiler a couple of times a day).
Why your configuration didn’t liked splitting in two sensors?
This line will return true if you are currently in one of those cheapest hours:
{{ states('sensor.nordpool_kwh_se3_sek_3_10_025') | float(0) in ((state_attr('sensor.nordpool_kwh_se3_sek_3_10_025', 'today') | default([]))[0:7] | sort)[0:1] or states('sensor.nordpool_kwh_se3_sek_3_10_025') | float(0) in ((state_attr('sensor.nordpool_kwh_se3_sek_3_10_025', 'today') | default([]))[19:23] | sort)[0:1] }}
- please remember to replace to your sensor name
- not tested in real conditions
I installed the Nordpool integration and used NL as the region when configuring, but the prices seem off compared to the EPEX prices I find online. It seems to be off “almost” by 21% which is our VAT rate, but it’s not exactly 21%. Anyone else experience this?
This is what I use for my boiler, it is on during the two cheapest hours in three timeslots. Edit it to fit your use case.
template:
- binary_sensor:
- name: Electricity lowest prices segmented
unique_id: electricity_lowest_prices_segmented
state: >-
{% set intervall_1=state_attr('sensor.nordpool_kwh_krsand_nok_3_10_025', 'raw_today')[0:8] | sort(attribute='value') %}
{% set intervall_2=state_attr('sensor.nordpool_kwh_krsand_nok_3_10_025', 'raw_today')[8:16] | sort(attribute='value') %}
{% set intervall_3=state_attr('sensor.nordpool_kwh_krsand_nok_3_10_025', 'raw_today')[16:24] | sort(attribute='value') %}
{{ (now() >= intervall_1[0].start and now() <= intervall_1[0].end)
or (now() >= intervall_1[1].start and now() <= intervall_1[1].end)
or (now() >= intervall_2[0].start and now() <= intervall_2[0].end)
or (now() >= intervall_2[1].start and now() <= intervall_2[1].end)
or (now() >= intervall_3[0].start and now() <= intervall_3[0].end)
or (now() >= intervall_3[1].start and now() <= intervall_3[1].end) }}
Hi! Figured I’d start sharing my stuff to help others. Been using HA since october but I’ve learned alot.
I’ve achieved this recently by using mushroom cards with their template card:
{% if state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'current_price') > (state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'max') - state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'min')) * 0.6 + state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'min') %}
deep-orange
{% elif state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'current_price') < (state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'max') - state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'min')) * 0.4 + state_attr('sensor.nordpool_kwh_se3_sek_0_10_025', 'min') %}
light-green
{% else %}
amber
{% endif %}
In words: it checks the current price from nordpool and compares it to 60% of the difference between highest and lower price. If it’s above 60%, the icon color is deep-orange (representing high price). If it’s below 40% it’s green (representing low price), and of course in between it’s amber (representing between middle-price)
Paste this in the ‘Icon color’ of the mushroom template card and change the sensor to match your own nordpool sensor, as well as the percentages to define what you think is low and high price.
I use the same formula in the ‘Secondary information’ as well to put the colors into words in the card, by replacing the deep-orange, green and amber with ‘high price’, ‘low price’ and ‘middle price’ respectively.
Good luck!
Hi Foxxy!
First off, this is additional costs. Meaning that you don’t have to define the current_price as it already takes it into account. Basically the nordpool integration adds current_price and additional_costs together when it makes the sensor.
Secondly, I think you should just add " | float after the number like this:
{{ 0.013 | float }}
This is the one I use, built on the same example that bentcold references: nordpool/README.md at master · custom-components/nordpool · GitHub
Basically I have hightariff (höglast) during 06:00 - 22:00 between october and april, but not during the weekend.
{% set s = {
"energiskatt": 49,
"låglast": 12,
"höglast": 70,
"cert": 11.75
}
%}
{% if (now().month >= 4 and now().month <= 10) or (now().weekday() >= 5) %}
{{ s.låglast + s.energiskatt + s.cert | float }}
{% else %}
{% if now().hour >= 6 and now().hour < 22 %}
{{ s.höglast + s.energiskatt + s.cert | float }}
{% else %}
{{ s.låglast + s.energiskatt + s.cert | float }}
{% endif %}
{% endif %}
Snälla kan du posta yaml för allt? Vore super snällt
Thanks,
my case was another as in Estonia some kind of compensation to price applies from threshold (now 80€/MWh without taxes). So I solved this like that:
{% if current_price <= 0.08 %}
{% set compensation = 0 %}
{%else%}
{% set compensation = -5 %}
{% endif %}
Here current_price is in €/MWh but compensation in cents. Result is summed with another applying taxes depending on time/day of the week/holiday etc. resulting precise price for every hour
Clumsy, I know, but works OK…
Best, JR
Det är flera olika kort det där, vilket menar du vill ha?
Writing it in English.
This is the markdown card,
Change the “{% set num_hours = 1 | int %}” to get 1 or 5 hours, you choose.
{% set iterativesum = namespace(iter=[]) %}
{% set lowestiter = namespace(kr=2) %}
{% set timelowest = namespace(hr=2) %}
{% set highestiter = namespace(kr=0) %}
{% set timehighest = namespace(hr=0) %}
{% set num_hours = 1 | int %}
{% set nordpoolentity = 'sensor.nordpool_kwh_fi_eur_3_10_01' %}
{% set timemapper = {
0: '00:00',
1 : '01:00',
2 : '02:00',
3 : '03:00',
4 : '04:00',
5 : '05:00',
6 : '06:00',
7 : '07:00',
8 : '08:00',
9 : '09:00',
10 : '10:00',
11 : '11:00',
12 : '12:00',
13 : '13:00',
14 : '14:00',
15 : '15:00',
16 : '16:00',
17 : '17:00',
18 : '18:00',
19 : '19:00',
20 : '20:00',
21 : '21:00',
22 : '22:00',
23 : '23:00',
24: '00:00',
25 : '01:00',
26 : '02:00',
27 : '03:00',
28 : '04:00',
29 : '05:00',
30 : '06:00',
31 : '07:00',
32 : '08:00',
33 : '09:00',
34 : '10:00',
35 : '11:00',
36 : '12:00',
37 : '13:00',
38 : '14:00',
39 : '15:00',
40 : '16:00',
41 : '17:00',
42 : '18:00',
43 : '19:00',
44 : '20:00',
45 : '21:00',
46 : '22:00',
47 : '23:00',
48 : '0:00',
} %}
{% set prices = namespace(price=[]) %}
{% set prices.price = prices.price + state_attr(nordpoolentity, 'today')
%}
{%- if state_attr(nordpoolentity,'tomorrow') | length == 1 -%}
Morgondagens priser ej släppta
{% else %}
{% set prices.price = prices.price + state_attr(nordpoolentity,
'tomorrow') %}
{% endif %}
{%- for n in range(prices.price|length -num_hours +1) -%}
{%- set tempsum= namespace(temp=0) -%}
{%- for i in range(num_hours) -%}
{%- set tempsum.temp = tempsum.temp + prices.price[n+i] -%}
{% endfor -%}
{% set iterativesum.iter = iterativesum.iter + [tempsum.temp] -%}
{% endfor -%}
{% for iter in iterativesum.iter -%}
{%- if loop.index > now().hour -%}
{%- if iter < lowestiter.kr | float -%}
{%- set lowestiter.kr = iter | float -%}
{%- set timelowest.hr = loop.index -1 -%}
{%- endif -%}
{%- if iter > highestiter.kr | float -%}
{%- set highestiter.kr = iter | float -%}
{%- set timehighest.hr = loop.index -1 -%}
{%- endif -%}
{%- endif -%}
{% endfor -%}
Den billigaste {{num_hours}} timmen startar {% if (timelowest.hr < 24)
%}idag{% else %}imorgon{% endif %} kl {{timemapper[timelowest.hr]}}, då
priset är {{"%.2f"|format(lowestiter.kr/num_hours)}} €/kWh
De dyraste {{num_hours}}-timmarna startar {% if (timehighest.hr < 24)
%}idag{% else %}imorgon{% endif %} kl {{timemapper[timehighest.hr]}}, då
snittpriset är {{"%.2f"|format(highestiter.kr/num_hours)}} €/kWh
The second i don’t use, I have it integrated into an apexchart.
type: custom:apexcharts-card
now:
show: true
label: NU
graph_span: 48h
apex_config:
annotations:
position: back
plotOptions:
bar:
borderRadius: 2
yaxis:
align_to: 0
decimalsInFloat: 3
tickAmount: 10
forceNiceScale: false
min: 0
xaxis:
labels:
datetimeFormatter:
hour: HH
all_series_config:
extend_to: false
show:
offset_in_name: true
header:
title: Dagens & morgondagens spotpris
show: true
show_states: true
colorize_states: true
span:
start: day
offset: +0h
series:
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
type: column
color: green
float_precision: 4
stroke_width: 2
name: Dagens timpris
show:
in_header: false
legend_value: false
extremas: true
data_generator: |
return entity.attributes.raw_today.map((start, index) => {
return [new Date(start["start"]).getTime(), entity.attributes.raw_today[index]["value"]];
});
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
type: column
color: yellow
float_precision: 4
stroke_width: 2
name: Morgondagens timpris
show:
in_header: false
legend_value: false
extremas: true
data_generator: |
return entity.attributes.raw_tomorrow.map((start, index) => {
return [new Date(start["start"]).getTime(), entity.attributes.raw_tomorrow[index]["value"]];
});
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
name: Timpris just nu
color: green
type: column
show:
in_chart: false
float_precision: 4
- entity: sensor.nordpool_plus_energiskatt_plus_caruna
name: Timpris med skatt + caruna
color: red
type: column
show:
in_chart: false
float_precision: 4
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
attribute: average
type: column
color: pink
float_precision: 4
stroke_width: 2
name: Dagens snittpris
group_by:
duration: 2d
show:
in_chart: false
legend_value: false
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
attribute: max
type: column
color: orange
float_precision: 4
stroke_width: 2
name: Dagens högsta pris
group_by:
duration: 2d
show:
in_chart: false
legend_value: false
- entity: sensor.nordpool_kwh_fi_eur_3_10_01
attribute: min
type: column
color: green
float_precision: 4
stroke_width: 2
name: Dagens lägsta pris
group_by:
duration: 2d
show:
in_chart: false
legend_value: false
Anyone knows how to get the average spot price that my house have used in 24 hours?
I know I can get the nordpool average, but that is through the whole 24 hours, I want to get the average price that I have used through the whole 24 hours.
Hey everyone,
I have created a table using flex-table-card (GitHub - custom-cards/flex-table-card: Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept) component and wanted to share with you guys. It will only show current and following hours (strict: true).
type: custom:flex-table-card
title: Today Prices
strict: true
entities:
- sensor.nordpool_mwh_lt_eur_3_10_0
columns:
- data: raw_today
name: Date
modify: |
(() => {
const locale = "lt-LT";
const startDate = new Date(x.start);
const endDate = new Date(x.end);
const currentDate = new Date();
const timeString = startDate.toLocaleTimeString(locale)
if (endDate < currentDate) {
return undefined;
}
return timeString;
})();
- data: raw_today
name: EUR/MWh
modify: x.value
I hope it will be useful.
Why your configuration didn’t liked splitting in two sensors?
I don’t know. If I was using one, the other resulted in an error, and vice versa.
But now I have changed my approach according to @Skeletorjus.
Thanks!
Modified code a little, and it seems to work very well.
Hi,
I’m just getting to know this integration and love it so far. Is there an easy way to get the average price for tomorrow.
I got the average price for today just by attribute “average” but not sure how to go about tomorrows price?
Kind regards // J
Try this:
{{ state_attr('sensor.nordpool_kwh_se3_sek_3_10_025', 'tomorrow') | average }}
You probably will have to do some validation (if/then) before so you don’t get an error when tomorrow’s data isn’t available.
Sorry, on phone, so apologies for any formatting issues. This is what I have on a markdown card. I don’t trust the tomorrow_valid flag, so I just assume that tomorrow’s values are available at 13:01 local time:
Complete card code below:
type: markdown
content: >-
Snitt: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'today')|average|round(1)}}
Max: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'today')|max|round(1)}}
Min: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'today')|min|round(1)}}
Nå: {{(states('sensor.nordpool_kwh_trheim_nok_3_095_025')|float|round(1))}}
{% if (now().strftime('%T')) > '13:01:00' %}
I morgen:
Snitt: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'tomorrow')|average|round(1)}}
Max: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'tomorrow')|max|round(1)}}
Min: {{state_attr('sensor.nordpool_kwh_trheim_nok_3_095_025',
'tomorrow')|min|round(1)}}
{%- else %}
Strømpris for i morgen er ikke klar.
{% endif -%}
title: Strømpris