mampfes / ha_epex_spot Goto Github PK
View Code? Open in Web Editor NEWAdds EPEX Spot data to Home Assistant.
License: MIT License
Adds EPEX Spot data to Home Assistant.
License: MIT License
I'm aware of the history function, but I'd like to have a graph in apex charts, like the one you have on the README, for the past two days until tomorrow (if available).
I do this whith offset: '-2d'
but that still doesn't show yesterday or the day before.
I've figured out it has to do with the data_generator
portion
data_generator: >
return entity.attributes.data.map((entry, index) => { return [new
Date(entry.start_time).getTime(), entry.price_eur_per_mwh]; });
i'm using this one for the awattar prices
data_generator: >
return entity.attributes.data.map((entry, index) => { return [new
Date(entry.start_time).getTime(), entry.price_ct_per_kwh * 1.03 * 1.2 ];
});
If I remove this block, It does show me data from the past - but only the past.
Any idea how to fix this ?
Today around 09:00 CET the integration stopped working (all sensors Unavailable
).
Downgrade to 1.1.2 fixes this issue.
Is there any kind of debugging in this integration?
I added custom_components.epex_spot: debug
to the logger, but there is no output.
Beim Versuch die Integration meiner HA Installation hinzuzufügen kommt die Meldung:
Repository mampfes/ha_epex_spot not found
Hi,
I've installed the integration with HACS, all good.
But I only get one new entity from it:
update.epex_spot_update
Any idea why I don't get the expected sensor? Do I need to configure something first?
Thanks!
Hi !
Would it be possible somehow to create a graph based on the available prices for the next 24h that could be shown then in HA ?
Hi,
thanks for this integration. In order to add automations it would be great to have sensors that show the most expensive hour(s), the cheapest hour(s) and also the average / median price of the day.
There is already a solution in the following discussion - but it would be great having that included in your integration.
https://community.home-assistant.io/t/problem-in-building-a-json-list-of-data/171736/32
Thanks.
Hi!
Thanks for creating this module.
I'm currently pulling the data via Awattar API using Node-Red but am not able to get the prices for all upcoming next 24 hours.
From my knowledge, Awattar only publishes the data something about 14:00 UTC+1.
Did you find a way to receive the prices for the upcoming 24hrs, no matter at which time you pull them?
In the sensor data, I can only see the prices for today.
Thanks
Hi!
I use the current service a los to automatically start charging my car at the lowest hout a day.
Unfortunately, for my seconc car i need the second lowest hour to set the scheduler.
Searing for "duration: 2:00:00" does not seem to be a good solution!
The two hours do not need to be near!!
Currently I monitor the "rank" value, but setting it when rank=1 is to unflexible and sometimes too late.
maybe something like "min_rank", "min_net_price" or even "but not start time" would be very nice.
Or do you have a better idea?
I cannot charge two cars at the same time as my grid is limited to 20A, and earch car charges with 16A.
Hi,
I just updated to 2.0.0. When I run the "Get lowest price interval" service from the Developer/Services menu with a duration of 2h, it will give me following answer:
start: "2023-10-09T01:00:00+00:00"
end: "2023-10-09T03:00:00+00:00"
price_eur_per_mwh: 152.4
price_ct_per_kwh: 15.24
net_price_ct_per_kwh: 22.081919999999997
However, when you look at the attached raw data, the cheapest 2h interval is 2:00 - 4:00, not 1:00-3:00. Also, the price should be 12.114, not 15,24ct/kWh.
I am using ha 2023.9.2.
Regards
derbadewaschl
Just a question:
Does your integration also provide future market price values for the next day?
https://www.smartenergy.at/ wrote on their website:
" Wir verraten dir bereits heute die stündlichen Preise für den nächsten Tag. Somit kannst du einschalten, wann immer der Strom am günstigsten für dich ist."
("We will already reveal to you the hourly prices for the next day today. This way, you can turn on whenever the electricity is cheapest for you.")
So I assume it would be helpful to get those future values also?
Without future values, how could your addon https://github.com/mampfes/ha_epex_spot_sensor predict the best time window for switching the device on?
Hi!
I cant find any information how to configure your addon. I have installed it manually and it loads during HA startup but there is no sensor being created. Can you please add further information to your documentation?
Thank you!
ps. thank you for the effort to create this addon!
Hi mampfes,
would you considder creating a similar sensor to "Net Market Price Sensor".
This sensor is used for import net prices.
I would like to have natively a "Net Market export Price Sensor"
This is in most situation having other parameters for calculation the net export price than the net import price.
Net import Price = Market Price + import Surcharges + Tax
versus
Net export Price = Market Price + export Surcharges
Hi,
When energy prices drop below 0, tax and additional fees are calculated on top, which would mean that when i pay 20% tax at -500€/Mwh i would get 600€/Mwh but actually it should be 400€ right? So there seems to be something abnor al when prices are below 0, calculation is wrong then.
Hello,
i came already often about this issue:
Prices for the next day are usually loaded in the early afternoon, displayed and working as expected. As well my template sensor made a service call for the cheapest hour of the next day and the returned result for the next day fine. Right now, there is not any Net Price Date for tomorrow anymore, it simply ends at midnight. Reloading the integration resolves the issue immediately.
Any idea whats going on here?
Thank you!
When using AWATTAR (at or de) as provider, the data array in the attributes of the sensor start at 00:00 UTC.
I assume, the intention is providing the whole range of 24 (or 48 if already available) hours.
So the query should start at midnight local time.
Otherwise the first slot is missing. Or even two slots during daylight saving time.
As smartEnergy in Austria has a good pricing "compared" to others, it would be nice to have it added to the addon.
They also over an API
https://www.smartenergy.at/api-schnittstellen
and the other costs can be found here
https://www.smartenergy.at/smarttimes
Perhaps interesting ?!
Hi, in the example script is a typo in line 16 Date(entry.start_time).getTime(), entry.price_eur_per_mwh; }).slice(0,24);
correct is: Date(entry.start_time).getTime(), entry.price_eur_per_mwh]; }).slice(0,24);
It would be nice when you can write it down, that example 4 needs the sensor from point 3 that it can work.
Here is also a example for AT and ct/kWh, how i modified your example from readme.cmd
Code:
type: custom:apexcharts-card
header:
show: true
title: Awattar Strom
all_series_config:
stroke_width: 3
type: line
unit: ct/kWh
graph_span: 48h
span:
start: day
now:
show: true
label: Now
color_list:
- var(--primary-color)
series:
- entity: sensor.epex_spot_at_price
yaxis_id: uurprijs
float_precision: 2
type: line
curve: stepline
extend_to: false
show:
extremas: true
data_generator: >
return entity.attributes.data.map((entry, index) => { return [new
Date(entry.start_time).getTime(), entry.price_ct_per_kwh]; }).slice(0,24);
color_threshold:
- value: 2
color: '#186ddc'
- value: 5
color: '#04822e'
- value: 8
color: '#12A141'
- value: 10
color: '#79B92C'
- value: 12
color: '#C4D81D'
- value: 15
color: '#F3DC0C'
- value: 18
color: red
- value: 20
color: magenta
- entity: sensor.epex_spot_at_price
yaxis_id: uurprijs
float_precision: 2
type: line
curve: stepline
extend_to: end
show:
extremas: true
data_generator: >
return entity.attributes.data.map((entry, index) => { return [new
Date(entry.start_time).getTime(),
entry.price_ct_per_kwh];}).slice(23,47);
color_threshold:
- value: 2
color: '#186ddc'
- value: 5
color: '#04822e'
- value: 8
color: '#12A141'
- value: 10
color: '#79B92C'
- value: 12
color: '#C4D81D'
- value: 15
color: '#F3DC0C'
- value: 18
color: red
- value: 20
color: magenta
- entity: sensor.epex_spot_at_price
yaxis_id: uurprijs
color: '#7EBAB5'
float_precision: 2
type: area
curve: stepline
extend_to: false
data_generator: >
return entity.attributes.data.map((entry, index) => { return [new
Date(entry.start_time).getTime(),
entry.price_ct_per_kwh];}).slice(parseInt(hass.states['sensor.epex_start_low_period'].state.substring(0,2)),parseInt(hass.states['sensor.epex_start_low_period'].state.substring(0,2))+4);
experimental:
color_threshold: true
yaxis:
- id: uurprijs
min: 0.1
max: 20
decimals: 2
apex_config:
title:
text: ct/kWh
tickAmount: 4
apex_config:
legend:
show: false
tooltip:
x:
show: true
format: HH:00 - HH:59
How can I start an automation from the sensor value (time when the Energy is the cheapest)
EPEX spot integration failed to setup: Cannot connect to host www.epexspot.com:443 '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')))
Hi, I'm trying to iplement battery charge at night and discharge only on few hours a day at the highest price (because of charge/discharge losses it doe'sn make sense to use the battery whole day)
So for this I'm looking for lowest price (1h duration is enough for me):
- trigger:
- platform: time_pattern
hours: "15"
action:
- service: epex_spot.get_lowest_price_interval
data:
earliest_start: "14:00:00"
latest_end: "13:59:00"
duration:
hours: 1
minutes: 0
response_variable: resp
sensor:
- name: Lowest energy price
device_class: timestamp
state: "{{ resp.start is defined and resp.start }}"
Then two "highest prices"
- trigger:
- platform: time_pattern
hours: "15"
action:
- service: epex_spot.get_highest_price_interval
data:
earliest_start: "00:00:00"
latest_end: "11:59:00"
duration:
hours: 3
minutes: 0
response_variable: resp
sensor:
- name: Highest energy price 1
device_class: timestamp
state: "{{ resp.start is defined and resp.start }}"
- trigger:
- platform: time_pattern
hours: "15"
action:
- service: epex_spot.get_highest_price_interval
data:
earliest_start: "12:00:00"
latest_end: "23:59:00"
duration:
hours: 3
minutes: 0
response_variable: resp
sensor:
- name: Highest energy price 2
device_class: timestamp
state: "{{ resp.start is defined and resp.start }}"
epex_spot_data_net_price:
state_class: measurement
data:
- start_time: '2023-12-21T23:00:00+00:00'
end_time: '2023-12-22T00:00:00+00:00'
price_ct_per_kwh: 15.542589999999999
- start_time: '2023-12-22T00:00:00+00:00'
end_time: '2023-12-22T01:00:00+00:00'
price_ct_per_kwh: 15.5295
- start_time: '2023-12-22T01:00:00+00:00'
end_time: '2023-12-22T02:00:00+00:00'
price_ct_per_kwh: 15.53307
- start_time: '2023-12-22T02:00:00+00:00'
end_time: '2023-12-22T03:00:00+00:00'
price_ct_per_kwh: 15.519979999999999
- start_time: '2023-12-22T03:00:00+00:00'
end_time: '2023-12-22T04:00:00+00:00'
price_ct_per_kwh: 15.51165
- start_time: '2023-12-22T04:00:00+00:00'
end_time: '2023-12-22T05:00:00+00:00'
price_ct_per_kwh: 15.531880000000001
- start_time: '2023-12-22T05:00:00+00:00'
end_time: '2023-12-22T06:00:00+00:00'
price_ct_per_kwh: 15.637789999999999
- start_time: '2023-12-22T06:00:00+00:00'
end_time: '2023-12-22T07:00:00+00:00'
price_ct_per_kwh: 19.311320000000002
- start_time: '2023-12-22T07:00:00+00:00'
end_time: '2023-12-22T08:00:00+00:00'
price_ct_per_kwh: 20.269270000000002
- start_time: '2023-12-22T08:00:00+00:00'
end_time: '2023-12-22T09:00:00+00:00'
price_ct_per_kwh: 19.78256
- start_time: '2023-12-22T09:00:00+00:00'
end_time: '2023-12-22T10:00:00+00:00'
price_ct_per_kwh: 18.68895
- start_time: '2023-12-22T10:00:00+00:00'
end_time: '2023-12-22T11:00:00+00:00'
price_ct_per_kwh: 18.66277
- start_time: '2023-12-22T11:00:00+00:00'
end_time: '2023-12-22T12:00:00+00:00'
price_ct_per_kwh: 18.722269999999998
- start_time: '2023-12-22T12:00:00+00:00'
end_time: '2023-12-22T13:00:00+00:00'
price_ct_per_kwh: 18.5521
- start_time: '2023-12-22T13:00:00+00:00'
end_time: '2023-12-22T14:00:00+00:00'
price_ct_per_kwh: 18.975740000000002
- start_time: '2023-12-22T14:00:00+00:00'
end_time: '2023-12-22T15:00:00+00:00'
price_ct_per_kwh: 19.60763
- start_time: '2023-12-22T15:00:00+00:00'
end_time: '2023-12-22T16:00:00+00:00'
price_ct_per_kwh: 20.58819
- start_time: '2023-12-22T16:00:00+00:00'
end_time: '2023-12-22T17:00:00+00:00'
price_ct_per_kwh: 20.652449999999998
- start_time: '2023-12-22T17:00:00+00:00'
end_time: '2023-12-22T18:00:00+00:00'
price_ct_per_kwh: 21.53424
- start_time: '2023-12-22T18:00:00+00:00'
end_time: '2023-12-22T19:00:00+00:00'
price_ct_per_kwh: 20.35971
- start_time: '2023-12-22T19:00:00+00:00'
end_time: '2023-12-22T20:00:00+00:00'
price_ct_per_kwh: 18.475939999999998
- start_time: '2023-12-22T20:00:00+00:00'
end_time: '2023-12-22T21:00:00+00:00'
price_ct_per_kwh: 18.579469999999997
- start_time: '2023-12-22T21:00:00+00:00'
end_time: '2023-12-22T22:00:00+00:00'
price_ct_per_kwh: 19.160189999999997
- start_time: '2023-12-22T22:00:00+00:00'
end_time: '2023-12-22T23:00:00+00:00'
price_ct_per_kwh: 16.9694
- start_time: '2023-12-22T23:00:00+00:00'
end_time: '2023-12-23T00:00:00+00:00'
price_ct_per_kwh: 15.546159999999999
- start_time: '2023-12-23T00:00:00+00:00'
end_time: '2023-12-23T01:00:00+00:00'
price_ct_per_kwh: 15.54021
- start_time: '2023-12-23T01:00:00+00:00'
end_time: '2023-12-23T02:00:00+00:00'
price_ct_per_kwh: 15.54021
- start_time: '2023-12-23T02:00:00+00:00'
end_time: '2023-12-23T03:00:00+00:00'
price_ct_per_kwh: 15.539019999999999
- start_time: '2023-12-23T03:00:00+00:00'
end_time: '2023-12-23T04:00:00+00:00'
price_ct_per_kwh: 15.54021
- start_time: '2023-12-23T04:00:00+00:00'
end_time: '2023-12-23T05:00:00+00:00'
price_ct_per_kwh: 15.5414
- start_time: '2023-12-23T05:00:00+00:00'
end_time: '2023-12-23T06:00:00+00:00'
price_ct_per_kwh: 15.5533
- start_time: '2023-12-23T06:00:00+00:00'
end_time: '2023-12-23T07:00:00+00:00'
price_ct_per_kwh: 16.42557
- start_time: '2023-12-23T07:00:00+00:00'
end_time: '2023-12-23T08:00:00+00:00'
price_ct_per_kwh: 17.9214
- start_time: '2023-12-23T08:00:00+00:00'
end_time: '2023-12-23T09:00:00+00:00'
price_ct_per_kwh: 20.54892
- start_time: '2023-12-23T09:00:00+00:00'
end_time: '2023-12-23T10:00:00+00:00'
price_ct_per_kwh: 20.49656
- start_time: '2023-12-23T10:00:00+00:00'
end_time: '2023-12-23T11:00:00+00:00'
price_ct_per_kwh: 21.0035
- start_time: '2023-12-23T11:00:00+00:00'
end_time: '2023-12-23T12:00:00+00:00'
price_ct_per_kwh: 21.177239999999998
- start_time: '2023-12-23T12:00:00+00:00'
end_time: '2023-12-23T13:00:00+00:00'
price_ct_per_kwh: 21.46879
- start_time: '2023-12-23T13:00:00+00:00'
end_time: '2023-12-23T14:00:00+00:00'
price_ct_per_kwh: 21.765099999999997
- start_time: '2023-12-23T14:00:00+00:00'
end_time: '2023-12-23T15:00:00+00:00'
price_ct_per_kwh: 21.94003
- start_time: '2023-12-23T15:00:00+00:00'
end_time: '2023-12-23T16:00:00+00:00'
price_ct_per_kwh: 22.449350000000003
- start_time: '2023-12-23T16:00:00+00:00'
end_time: '2023-12-23T17:00:00+00:00'
price_ct_per_kwh: 23.647679999999998
- start_time: '2023-12-23T17:00:00+00:00'
end_time: '2023-12-23T18:00:00+00:00'
price_ct_per_kwh: 23.44895
- start_time: '2023-12-23T18:00:00+00:00'
end_time: '2023-12-23T19:00:00+00:00'
price_ct_per_kwh: 22.86585
- start_time: '2023-12-23T19:00:00+00:00'
end_time: '2023-12-23T20:00:00+00:00'
price_ct_per_kwh: 21.9317
- start_time: '2023-12-23T20:00:00+00:00'
end_time: '2023-12-23T21:00:00+00:00'
price_ct_per_kwh: 20.48704
- start_time: '2023-12-23T21:00:00+00:00'
end_time: '2023-12-23T22:00:00+00:00'
price_ct_per_kwh: 17.95591
- start_time: '2023-12-23T22:00:00+00:00'
end_time: '2023-12-23T23:00:00+00:00'
price_ct_per_kwh: 16.46246
unit_of_measurement: ct/kWh
icon: mdi:currency-eur
friendly_name: Aktueller Strompreis
Now, my expectain is:
Lowest price in the future:
- start_time: '2023-12-23T02:00:00+00:00'
end_time: '2023-12-23T03:00:00+00:00'
price_ct_per_kwh: 15.539019999999999
But the first highes Price shows me the time in the past:
Screenshot was made on 22.12 at 15:30
How can I achieve, that my Highest Price 1 will look in the future and will get 3h on 23th?
- start_time: '2023-12-23T09:00:00+00:00'
end_time: '2023-12-23T10:00:00+00:00'
price_ct_per_kwh: 20.49656
- start_time: '2023-12-23T10:00:00+00:00'
end_time: '2023-12-23T11:00:00+00:00'
price_ct_per_kwh: 21.0035
- start_time: '2023-12-23T11:00:00+00:00'
end_time: '2023-12-23T12:00:00+00:00'
price_ct_per_kwh: 21.177239999999998
Hi!
Thanks for creating this module.
I'm currently pulling the data via Awattar API using Node-Red but am not able to get the prices for all upcoming next 24 hours.
From my knowledge, Awattar only publishes the data something about 14:00 UTC+1.
Did you find a way to receive the prices for the upcoming 24hrs, no matter at which time you pull them?
In the sensor data, I can only see the prices for today.
Thanks
HI, thanks for dthis nice HASS integration of awattar. After installing it I do not get any data from the sensors. I am sure it is a very stupid mistake as this is my first HACS integration
Cheers
Hi,
I just tried to configure the integration. But regardless if I try awattar or epex web scraper, I always receive these errors in the logs instead of an entity:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/epex_spot/init.py", line 25, in async_setup_entry
shell.add_entry(entry)
File "/config/custom_components/epex_spot/init.py", line 63, in add_entry
self._hass, self._fetch_callback, timedelta(hour=1)
TypeError: 'hour' is an invalid keyword argument for new()
Home assistant is running the tatest version 2022.12.9.
Any idea what I could have done wrong?
I was trying to modify the proposed template so that it will also activate the heating when no epex data is available.
I tried the following:
sensor:
- name: "EPEX Start 24h Low Period"
device_class: timestamp
state: "{{ resp.start if resp.start is defined else (today_at("03:00") + timedelta(days=1)) }}"
But home-assistant does not buy it. The error message does not help. What did I make wrong? I can't figure it out.
Hi,
I'm using your integration with smard.de data source for region AT and relized that the sensor is 'unvailable' on synday afternoon.
After some debugging I found out, that the timestamps always show data from Sunday till Sunday midnight.
an example:
we get all timestamps from this url:
https://www.smard.de/app/chart_data/4170/DE/index_hour.json
the latest timestamp as of now is: 1696197600000, Oct 1, 2023, 10:00:00 PM UTC ( 00:00 in CEST )
results in this series url:
https://www.smard.de/app/chart_data/4170/DE/4170_DE_hour_1696197600000.json
which gives us data from 1696197600000 ( Oct 1, 2023, 10:00:00 PM ) till 1696798800000 ( Oct 8, 2023, 9:00:00 PM).
and that's why the check for marketdata_now
fails:
tl;dr:
on Sunday noon a new series for the net week is released, after which the service becomes unavailable.
I think the right solution would be to not just use the latest timestamp
we could choose the one that includes datetime.now(), or always get the last 2 and filter out "old" data before return.
let me now what you think, and I'll create a pull request
Some utility companies calculate the current month's price based on the previous month's average price. So a sensor that returns the average of the previous calendar month would be useful.
I find your addition to EPEX Spot usefull and looking forward to use it.
Issues with Latest End Time setting smaller than earliest start time.
Sorry, wrong code repo. I can 't delete this issue reported.
Hi,
i just noticed that either the unit or the calculation for net price is wrong by factor 10.
as an example:
current price: 10.46EUR/MWh == 1046 ct/MWh == 1,046 ct/kWh
so either the unit of the sensor should be changed to ct/kWh or the the price has to be multiplied by 10.
I think ct/kWh has been done on purpose here:
so it would be the easiest to just change the unit here:
With the latest version (2.2.0) the example of the apex charts including the lowest period is broken.
https://github.com/mampfes/ha_epex_spot#3-i-want-to-combine-and-view-everything
The cause seems to be sensor.epex_start_low_period that no longer exists.
Is there any way to achieve an indication of the lowest hours of the day using the price_rank sensor or the low period service? I'm trying to visually indicate on a chart when some appliances would start.
Hi,
first of all thanks for the wonderful integration, I love it. After the update 2 days ago, I see now for the Awattar (at) sensor the actual day, and after 14pm the data for tomorrow (so far so good). BUT now, additionally I always see the last day also. Is this what you want? I have to change my diagrams now because I then need the slices 25-48 for today and 49-72 for tomorrow (because slice 1-24 is now yesterday).
I also deleted awattar sensor and set it up newly, the same situation.
e.g: today is 4.2.2024 10am, and I see all data from 3.2.2024 and todays data. After 14pm I will see also tomorrows data, but yesterdays data won't dissapear.
I realized that there are some differences on all the data values between the integrations
at 17.01.24 08:00
web scraper: data from 2024-01-17T00:00:00+01:00 till 2024-01-17T23:00:00+01:00
smart energy: data from 2024-01-17T00:00:00+01:00 till 2024-01-17T23:00:00+01:00
smard.de: data from 2024-01-15T00:00:00+01:00
till 2024-01-17T23:00:00+01:00
this leads to issues when you want to draw charts with different colors per day.
For example I tried to make a line chart with "orange" for today and "blue" for tomorrow.
in the morning "todays data" is at [48:72] but in the afternoon "todays data" is at [24:48]
I'll create a pull request, so that all 3 integrations show the same timeframe of data
Can we please uptate epex_spot_at_lowest_price or add an epex_spot_at_lowest__next_price when the time os over?
It does't help to see an lowest price from the day before.
hi !
would it be possible to show also the prices per kwh ?
I'm currently using the awattar configuration.
I got the following exception at midnight, which breaks the update timer and does not do any future updates until HASS is restarted:
Error doing job: Exception in callback async_track_point_in_utc_time.<locals>.run_action(<Job HassJobT...7f84cb97dbd0>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1310
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1325, in run_action
hass.async_run_hass_job(job, utc_point_in_time)
File "/usr/src/homeassistant/homeassistant/core.py", line 590, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1553, in pattern_time_change_listener
hass.async_run_hass_job(job, dt_util.as_local(now) if local else now)
File "/usr/src/homeassistant/homeassistant/core.py", line 590, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/epex_spot/__init__.py", line 189, in _on_hour_change
source.update_time()
File "/config/custom_components/epex_spot/__init__.py", line 94, in update_time
self._marketdata_now = next(
StopIteration
It does not happen every night, but it did happen at least three times in the last two weeks.
I want to get the cheapest three hours from now to 7AM tomorrow.
I understood I need to populate earliest_start
in order to make latest_end
work as tomorrow's time. However, this call creates an error (at least when executed before 14:00 when there are no values for tomorrow present):
service: epex_spot.get_lowest_price_interval
data:
earliest_start: "09:07:00"
latest_end: "07:00:00"
duration:
hours: 3
minutes: 0
seconds: 0
device_id: MYDEVICEID
It would be great if the service calculates the best times even if no prices are available yet for tomorrow morning.
Error:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/__init__.py", line 104, in get_lowest_price_interval
return _find_extreme_price_interval(call, lambda a, b: a < b)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/__init__.py", line 126, in _find_extreme_price_interval
return coordinator.source.find_extreme_price_interval(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/SourceShell.py", line 152, in find_extreme_price_interval
result = find_extreme_price_interval(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/extreme_price_interval.py", line 79, in find_extreme_price_interval
ip = _calc_interval_price(marketdata, start_time, duration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/extreme_price_interval.py", line 24, in _calc_interval_price
if mp.end_time > stop_time:
^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'end_time'
Traceback (most recent call last):
File "/config/custom_components/epex_spot/SourceShell.py", line 90, in fetch
await self._source.fetch()
File "/config/custom_components/epex_spot/EPEXSpot/EPEXSpotWeb/__init__.py", line 133, in fetch
self._marketdata = await self._fetch_day(delivery_date) + await self._fetch_day(
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/EPEXSpot/EPEXSpotWeb/__init__.py", line 138, in _fetch_day
data = await self._fetch_data(delivery_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/epex_spot/EPEXSpot/EPEXSpotWeb/__init__.py", line 188, in _fetch_data
resp.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://www.epexspot.com/en/market-data?market_area=DE-LU&trading_date=2024-01-04&delivery_date=2024-01-05&modality=Auction&sub_modality=DayAhead&product=60&data_mode=table&ajax_form=1')
Hi,
I had look today at the new Net-Price Sensor.
The Epex Spot Price was € 9,37/MWh on my test
If I set Supercharge and Tax to Zero, the Net Price sensor Reports 1ct/KWh - i assume it should be 0,937ct/KWh. Or do I understand that wrong?
Br and have a nice Weekend
Hi,
in #82 rank was implemented. That is very cool! Thank you!
I'm trying to implement smart battery charge/discharge to for dynamic electricity prices.
I' already using rank to do it and if works mostly perfect.
But here we see edge case:
Let's assume it is 12. January 12:00, the highest price for "today" is already gone (8:00-10:00) but I still have some kWh in the battery.
So, if I have the rank for the next 24h, I could discharge also at 17:00-19:00, because highest ranks would be at 17:00 and 18:00
Another case:
at the morning of the next day it's more expensive because it more expensive as todays evening.
I know, the next day prices maybe not available an one moment, so the ranks should be given for Future available hours and than recalculated if new prices are available.
I’m' still not sure if "all future prices" or "next 24h future prices" (maybe both?)
Let's assume it is now 7. Jan 16:00, future prices are known.
With both possibilities + solar forecast I could decide if the battery should be discharged at 8:00-10:00 at 8. Jan (24h case and solar can produce some kWhs for later hours) or at 17:00-19:00 on 8. Jan, because no solar production will be available on this day.
Or are there any tricks how to achieve it?
Hi,
thank you for your great component.
I just want to suggest, that you do not need the EPEX Spot Web Scraper anymore. Instead you could use the SMARD Plattform published by the Bundesnetzagentur. There you get all the data from official sources for free and via API.
SMARD is the information platform of the Federal Network Agency about the German electricity market. All users can access visually and tabularly prepared data at www.smard.de. The API documented here provides access to the electricity market data of the Federal Network Agency.
https://github.com/bundesAPI/smard-api
I hope it helps.
Best regards,
Tobias
Version 2.2.0
I am in timezone GMT+1
In attributes the first value is the value for 1 o'clock and the last value for 23pm is missing, so the list only covers 23 hours. The total list is shifted by one hour.
Example for today:
It would be great, if the sensors provided by this integration would support long-term statistics to display them in the statistics-graph
Good afternoon,
it seems that your formula is not correctly applicable for aWATTar. I also contacted the aWATTar service hotline to get a clarification. The fix offset/absolute surcharge (net usage, taxes, fees, etc.) is already gross price including VAT. The same is true for the basic monthly fee (not included in your formula). The EPEX is net price, so we need to apply the percentage surcharge and VAT to it:
Net Price = ((Market Price * 1.03) + 12ct) * 1.19
from the documentation should be
Net Price = ((Market Price * 1.03 * 1.19) + 12ct)
Example from aWATTar page: 2024-01-23, slot 1700h-1800h
8.16 ct/kWh net without any VAT == 9.71 ct/kWh gross incl. 19% VAT
17.34 ct/kWh fix offset (for my location)
aWATTar grid price incl. VAT = 17.34 ct/kWh + 8.16 ct/kWh * 1.2257 = 17.34 ct/kWh + 9.71 ct/kWh * 1.03 = 27.34 ct/kWh
So, combining the aWATTar 3% surcharge with 19% VAT is a 22.57% surcharge in total. I would also like to propose a small adjustment in the documentation to mitigate confusions with the terms "net" and "market":
GrossGridPrice == EPEXNetPrice * PercentageSurcharge * VAT + GrossAbsoluteSurcharge
Hi!
When reading the docs it states (https://github.com/mampfes/ha_epex_spot#response):
The response contains the calculated start and end-time and the average price per MWh/KWh.
But when looking at the values returned they were much higher than expected. Digging around I found:
where it seems like the returned value is not the average, but the sum of the price which does not seem to be of any particular help.
thanks!
andreas
Hi,
the documentation for the epex_spot.get_lowest_price_interval service says
The response contains the calculated start and end-time and the AVERAGE price per MWh/KWh for the whole duration.
However, when I call the service with a duration of 2 hours, the price_eur_per_mwh and price_ct_per_kwh seems to be the sum of the 2 resulting hours - not the average value:
service: epex_spot.get_lowest_price_interval
data:
earliest_start: '01:00:00'
earliest_start_post: 1
latest_end: '07:00:00'
latest_end_post: 1
duration:
hours: 2
Result:
start: "2023-10-30T00:00:00+00:00"
end: "2023-10-30T02:00:00+00:00"
price_eur_per_mwh: 16.75
price_ct_per_kwh: 1.675
net_price_ct_per_kwh: 8.586
When querying it for the duration of 1 hour, the result is:
start: "2023-10-30T01:00:00+00:00"
end: "2023-10-30T02:00:00+00:00"
price_eur_per_mwh: 8.36
price_ct_per_kwh: 0.836
net_price_ct_per_kwh: 7.5792
The epex_spot_net_price for the time in question is:
- start_time: '2023-10-30T00:00:00+00:00'
end_time: '2023-10-30T01:00:00+00:00'
price_ct_per_kwh: 7.582800000000001
- start_time: '2023-10-30T01:00:00+00:00'
end_time: '2023-10-30T02:00:00+00:00'
price_ct_per_kwh: 7.5792
The epex_spot_price for the time in question is:
- start_time: '2023-10-30T00:00:00+00:00'
end_time: '2023-10-30T01:00:00+00:00'
price_eur_per_mwh: 8.39
price_ct_per_kwh: 0.8390000000000001
- start_time: '2023-10-30T01:00:00+00:00'
end_time: '2023-10-30T02:00:00+00:00'
price_eur_per_mwh: 8.36
price_ct_per_kwh: 0.836
So the price_eur_per_mwh seems to be 8.39+8.36=16.75 which is the sum, not the average.
Same for price_ct_per_kwh: 0.839+0.836=1.675.
net_price_ct_per_kwh for 1 hour returns 7.5792, which matches with the price_ct_per_kwh from epex_spot_net_price
net_price_ct_per_kwh for 2 hours returns 8.586, which is neither sum nor average of 7.5828 and 7.5792 .. so how is this calculated?
So is the behavior returning the sum the expected one, and the documentation does not match, or vice versa - or is the implementation going to change (soon)? ... Or do I misunderstand something entirely?
I need the average price in the resulting time period for my automation, so I have to divide by the amount of hours to get the average price - but if the implementation will change in the future, I have to know - because I have to adjust my calculations then.
BTW .. I am using the release 2.1.0
Thanks.
Hello,
do you think it would be possible to have the rank for future hours added as attribute to the rank sensor, similar as it is for the net price? Right now the rank is just visible for the past hours. So it would be possible to see, in which hours a device will be turned on/off, when triggering that by an automation using the rank as condition.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.