You can use a markdown card for that.
Just change the nordpool sensor and the time.
(cheapest hour today)
{% set priceList = state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'today')[8:22] %}
{% set dateList = state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'raw_today')[8:22] %}
{% set minPrice = min(priceList) %}
{% set minIndex = priceList.index(minPrice) %}
{% set minDateTimeStr= dateList[minIndex].start | string %}
{% set minDateTime= strptime(minDateTimeStr[0:19], '%Y-%m-%d %H:%M:%S') %}
Billigaste priset idag mellan 07-22 och är {{ minPrice }} EUR/kWh och startar kl {{ minDateTime.hour }}:00
(cheapest hour tomorrow)
{% set priceList = state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'tomorrow')[8:22] %}
{% set dateList = state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'raw_tomorrow')[8:22] %}
{% set minPrice = min(priceList) %}
{% set minIndex = priceList.index(minPrice) %}
{% set minDateTimeStr= dateList[minIndex].start | string %}
{% set minDateTime= strptime(minDateTimeStr[0:19], '%Y-%m-%d %H:%M:%S') %}
Billigaste priset mellan 07-22 imorgon är {{ minPrice }} EUR/kWh och startar kl {{ minDateTime.hour }}:00
And here is for tomorrow cheapest 2 hours from 00:00-24:00
Just change {% set num_hours = 2 | int %} to whatever you want.
{% 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 = 2 | int %}
{% set nordpoolentity = 'sensor.nordpool_kwh_fi_eur_3_10_024' %}
{% 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 -%}
De billigaste {{num_hours}}-timmarna startar {% if (timelowest.hr < 24)
%}idag{% else %}imorgon{% endif %} kl {{timemapper[timelowest.hr]}}, då
snittpriset är {{"%.2f"|format(lowestiter.kr/num_hours)}} cent/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)}} cent/kWh