iStehle
(Tobias Stehle)
January 23, 2023, 5:28pm
2
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
magdy
February 12, 2023, 4:29pm
3
Could someone help me how the apex card configuration has to look like if I want to see ct/kWh in the chart?
webwude
(Webwude)
March 9, 2023, 7:28am
4
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]; });
webwude
(Webwude)
March 9, 2023, 9:01am
5
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
gigatexel
(Gigatexel)
April 3, 2023, 8:22am
7
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 )
gigatexel
(Gigatexel)
April 3, 2023, 12:26pm
8
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
netzbus
(Netzbus)
April 3, 2023, 4:15pm
9
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?
gigatexel
(Gigatexel)
April 4, 2023, 6:13am
10
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.
BenVDL
(Ben90)
August 5, 2023, 9:18am
11
Would it be possible to show the 10 hours with the lowest prices?
mampfes
(Steffen Zimmermann)
August 5, 2023, 10:19am
12
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?
gigatexel
(Gigatexel)
August 8, 2023, 8:00am
13
You would need to change the example in the repository. This line and everything after
{%- if p < 22 %}
Presl1983
(Presl1983)
August 15, 2023, 8:28pm
14
webwude:
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?
webwude
(Webwude)
August 15, 2023, 8:38pm
15
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
Presl1983
(Presl1983)
August 15, 2023, 8:41pm
16
can you help me to get the outcome into the chart which you postet above?
i’m new here and i’m trying around…
webwude
(Webwude)
August 15, 2023, 8:58pm
17
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).
Presl1983
(Presl1983)
August 15, 2023, 9:04pm
18
what you mean with “hand it over”?
the actual price in the chart is 10,8 but the sensor works…
i’m sorry for thestupid questions
1 Like
webwude
(Webwude)
August 15, 2023, 10:33pm
19
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
webwude
(Webwude)
August 16, 2023, 1:31pm
20
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):
1 Like
Presl1983
(Presl1983)
August 16, 2023, 5:37pm
21
thanks - now everything works fine