EPEX Spot and Awattar Electricity Prices

I modified the template Sensor, and added my network cost:

template:
  - sensor:
    - name: "Aktueller Strompreis"
      unique_id: epex_spot_price_ct_per_kWh
      unit_of_measurement: "¢"
      availability: '{{ states("sensor.epex_spot_de_price") != "unavailable" }}'
      state: '{{ states("sensor.epex_spot_de_price") | float  / 10 | float + 12.35}}'
     
    

maybe you could add this to your documentation, and look into the fork of the software. looks like some good additions.

1 Like

Could someone help me how the apex card configuration has to look like if I want to see ct/kWh in the chart?

Hi.

I created a sensor:

- platform: template
  sensors:
    epex_spot_price_ct_per_kwh:
      friendly_name: "Aktueller Strompreis"
      unit_of_measurement: "ct/kWh"
      availability_template: '{{ states("sensor.epex_spot_at_price") != "unavailable" }}'
      value_template: '{{ states("sensor.epex_spot_at_price") | float / 10 }}'

My apex card looks like that:

type: custom:apexcharts-card
header:
  show: true
  title: Aktueller Spot Strompreis heute und morgen
graph_span: 48h
span:
  start: day
now:
  show: true
  label: Now
series:
  - entity: sensor.epex_spot_at_price
    name: Aktueller Strompreis ct/kWh
    type: column
    extend_to: end
    unit: ct/kWh
    data_generator: >
      return entity.attributes.data.map((entry, index) => { return [new
      Date(entry.start_time).getTime(), entry.price_ct_per_kwh]; });

if you include “float * 0.1 * 1.03 * 1.2” you should get the actual price from awattar, if I am not mistaken.

how could i get the apexcard more accurately ?

apexchart doesn’t seem to support the “float” directive. I was able to add “* 0.1 * 1.03 * 1.2" to the apex card… but now the price is 17.201412 vs 17.2 in the apex chart, for example

Would it be possible to find the start-hour with the lowest consecutive prices?

I found this example by @Didgeridrew , but I have been struggling to apply it to the way the data is represented in this integration (Two hours minimum template - #2 by Bojkas)

Got it. Example below for 3 lowest hours:

{% set ns = namespace(attr_dict=[]) %}
{% set i = 0 %}
{% for item in (state_attr('sensor.epex_spot_be_price', 'data'))[0:24] %}
  {%- set ns.attr_dict = ns.attr_dict + [(loop.index,item["price_eur_per_mwh"])] %}

{% endfor %}

{%- set price_map = dict(ns.attr_dict) %}
{%- set price_sort = price_map.values()|list %}
{%- set keys_list = price_map.keys()|list %}
{%- set ns = namespace(combo=[]) %}
{%- for p in keys_list %}
  {%- set p = p|int %}
  {%- if p < 23 %}
    {%- set ns.combo = ns.combo + [(p, ((price_sort)[p-1] + (price_sort)[p])|round(2))] %}
  {%- else %}
    {%- set ns.combo = ns.combo + [(24, ((price_sort)[22] + (price_sort)[23] + (price_sort)[0])|round(2))] %}
  {%- endif %}
{%- endfor %}
{%- set mapper = dict(ns.combo) %}
{%- set key = mapper.keys()|list %}
{%- set val = mapper.values()|list %}
{%- set val_min = mapper.values()|min %}
{{ key[val.index(val_min)-1]|string + ":00" }}```
2 Likes

I am currently testing this script but it generates 19:00 for example. At 7 p.m. is the price at the highest rate. Or do I misunderstand it?

The result is the time at which the 3 hours with lowest prices start.
This is particularly helpfull if you want to start something that takes some time to complete (eg. electric boiler, washing machine, dryer,…)

For example, at 14:00 in the graph below prices are at their lowest untill 17:00.

Would it be possible to show the 10 hours with the lowest prices?

Do you know the rank sensor? It gives you the rank of the current hour and can be easily used in automations. Or do you want to have a graph?

You would need to change the example in the repository. This line and everything after {%- if p < 22 %}

we have to fix that because now

Stündliche Preise EPEX Spot ® AT

  • | Stündliche Preise EPEX Spot ® AT | * 0.03 (3%)
  • 1,500 Cent/kWh
  • 20% MwSt.

how can i do that to add 1.5?

Here my updates, I created two sensors, one ct, one Euro based:

##### spot ernergy sensors ###

- platform: template
  sensors:
    epex_spot_price_ct_per_kwh:
      friendly_name: "Aktueller Strompreis"
      unit_of_measurement: "ct/kWh"
      availability_template: '{{ states("sensor.epex_spot_at_price") != "unavailable" }}'
      value_template: '{{ ((states("sensor.epex_spot_at_price") | float * 0.1) + 1.5)* 1.2 }}'
    epex_spot_price_eur_per_kwh:
      friendly_name: "Aktueller Strompreis Euro"
      unit_of_measurement: "eur/kWh"
      availability_template: '{{ states("sensor.epex_spot_at_price") != "unavailable" }}'
      value_template: '{{ ((states("sensor.epex_spot_at_price") | float * 0.001) + 0.015) * 1.2}}'

You can check with the values published on their homepage.

I just switched to smartenergy, because they only add 1,44ct.

2 Likes

can you help me to get the outcome into the chart which you postet above?
i’m new here and i’m trying around…

When you define the sensor as posted and hand it over to the card, it should work.

Usually after defining the sensor via yaml you have to restart home assistant to see the changes.

I have changed now to the following view: data for today, current price and next day (next day usually populates at 2pm).

:confused:

what you mean with “hand it over”?
the actual price in the chart is 10,8 but the sensor works…
image

i’m sorry for thestupid questions :frowning:

1 Like

In the card configuration you use the sensor epex_spot_at_price.

You need to change it to the newly created sensor or use an appropriate card for the sensor.
I will have a look into it in the upcoming days.

1 Like

It is even much easier.

You can specify in the configuration of the EPEX integration the surcharge and tax. If you use this, you get the correct value in sensor.epex_spot_at_net_price.

If you now create a card like that:

type: custom:apexcharts-card
graph_span: 24h
header:
  title: Energy price today (ct/kWh)
  show: true
  show_states: true
span:
  start: day
now:
  show: true
  label: Now
series:
  - entity: sensor.epex_spot_at_net_price
    type: column
    extend_to: end
    unit: ct/kWh
    float_precision: 3
    show:
      in_header: before_now
    data_generator: |
      return entity.attributes.data.map((entry) => {
        return [new Date(entry.start_time), entry.price_ct_per_kwh];
      });

you should get something like this (please be aware that I have another provider with slightly different prices):
image

1 Like

thanks - now everything works fine :slight_smile: