GithubHelp home page GithubHelp logo

jaccor / hass-entso-e Goto Github PK

View Code? Open in Web Editor NEW
154.0 25.0 23.0 116 KB

Integration for Home Assistant to fetch day ahead energy prices from European countries via ENTSO-e Transparency Platform

Python 100.00%
energy homeassistant electricity-market electricity-prices energy-prices entso-e entsoe hacs home-assistant home-automation

hass-entso-e's People

Contributors

blowk avatar bnordli avatar davzan avatar evading avatar jaccor avatar jyrkih avatar martin3000 avatar moorgrove avatar scop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hass-entso-e's Issues

No matching data

I got this error. Not sure what the reason is, but my country is Norway and we have 5 or 6 different price regions. But I could not set region in the configuration, only country.

2022-10-03 09:51:22.201 ERROR (MainThread) [custom_components.entsoe.coordinator] Unexpected error fetching ENTSO-e coordinator data: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/entsoe/coordinator.py", line 42, in _async_update_data data_today = await self.fetch_prices(today, tomorrow) File "/config/custom_components/entsoe/coordinator.py", line 50, in fetch_prices resp = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/entsoe/coordinator.py", line 63, in api_update return client.query_day_ahead_prices(self.country, start=start_date, end=end_date) File "/usr/local/lib/python3.10/site-packages/entsoe/decorators.py", line 106, in year_wrapper raise NoMatchingDataError entsoe.exceptions.NoMatchingDataError

Question: update interval

Currently the update interval for the integration is set to 15 minutes.
However, entsoe only publishes new data on 13:00 after which the next days hour prices are static.
Wouldn't it be better if the integration were to update less frequently (thereby creating less load on the entsoe API if usage of this integration takes of).
Or are there any (currently not seen by me) reasons why a more frequent update interval is desirable?

Original entity id's were based on the entity name

The 0.1.0 release changes the entity id from it's description.name to the description.key value.
Thereby, causing issues for keeping the original entity names (and history)
In order to achieve (what i believe you wanted to achieve) you should set _attr_unique_id to the original description.key value and self.entity_id to description.name.
Since before my PR (for supporting multiple integrations) the entity_id property was not set by the integration.
Thereby, causing HA to infer the description.name value as the entity id.

Anybody upgrading now will not have working dashboards / history afterwards due to the key property != the name property.

Feature request: lowest prices within a range

A flexible hourly contract usually is interesting when you consume a lot of electricity, like charging a car. This is usually done over a span of several hours. It would be nice to have this integration calculate the cheapest prices within a specific frame. For example: the cheapest 5 hours between 7pm and 7am

Feature Request: Handle no data error

Entso-e didn't have prices for "Norway NO2" zone today 25.10.2022 and that makes this integration fail with an error

`Logger: custom_components.entsoe.coordinator
Source: custom_components/entsoe/coordinator.py:121
Integration: ENTSO-e Transparency Platform (documentation, issues)
First occurred: 07:08:24 (4 occurrences)
Last logged: 07:09:31

Unexpected error fetching ENTSO-e coordinator data:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/entsoe/coordinator.py", line 93, in _async_update_data
data = await self.fetch_prices(today, tomorrow)
File "/config/custom_components/entsoe/coordinator.py", line 109, in fetch_prices
resp = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/entsoe/coordinator.py", line 121, in api_update
return client.query_day_ahead_prices(
File "/usr/local/lib/python3.10/site-packages/entsoe/decorators.py", line 106, in year_wrapper
raise NoMatchingDataError
entsoe.exceptions.NoMatchingDataError
`

Enhancement: Number of decimals

Is it possible to have as many decimals as entso-e provide? When rounded of to 3 decimals, we get prices like

0.001, 0, 0, 0, 0, 0.001, 0.021, 0.051, 0.06, 0.043, 0.038, 0.009, 0.006, 0.004, 0.004, 0.015, 0.018, 0.024, 0.041, 0.045, 0.044, 0.041, 0.036, 0.027

Which are not correct as the prices are not zero

Feature request: country drop down menu in config

For now, the country is configured as plain text. This is prone to errors, so ideally you would want a drop down where you can select a country out of a selection of countries. When a country is selected, the countries name should be converted to the correct country code which can then be fed to the ENTSO-e API.

VAT tariff, unable to enter a single digit %

I re-added the new version and want to opt for the added VAT tariff.
For Belgium this is marked as the standard 21%, but as already mentioned it is temporarily lowered to 6%.

When changing the tariff form 0.21 to 0.06 it seems impossible to enter the 0.06 value.
When entering a 0 behind the decimal (0.0), the decimal disappears and just takes the 6 as the vat-value (600%)

Workaround is to enter 0.21, change to 0.26 and then change to 0.06, but there must be another solution :D

ENTSO-e not showing as integration

I've added the repository via HACS, downloaded the component to custom_components, restarted HomeAssistant, but can't find the integration when trying to add it.

Is it possible to configure this integration via the UI?

"message":"Invalid handler specified

Hi, Maybe it's a typical amateur error..... But... I get the following message and it won't install the integration.

"message":"Invalid handler specified

Foutmelding

Unavailable entities

Hi all,

I'm currently experiencing issues with all entities in this Integration. Reloading or renewing integration doesn't seem to do anything. This problem is there since a couple days. Seems to be internal server error 500.

entso-e data not updating

I'm getting "can't multiply sequence by non-int of type 'float'" in the integration tile. No data for today or tomorrow

< 2022-11-06 14:14:38.950 ERROR (MainThread) [custom_components.entsoe.coordinator] Unexpected error fetching ENTSO-e coordinator data: can't multiply sequence by non-int of type 'float'
File "/config/custom_components/entsoe/coordinator.py", line 100, in _async_update_data
File "/config/custom_components/entsoe/coordinator.py", line 85, in parse_hourprices
File "/config/custom_components/entsoe/coordinator.py", line 79, in calc_price
2022-11-06 14:14:38.962 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Day Ahead Prices' for entsoe integration not ready yet: can't multiply sequence by non-int of type 'float'; Retrying in background
2022-11-06 14:14:45.878 ERROR (MainThread) [custom_components.entsoe.coordinator] Unexpected error fetching ENTSO-e coordinator data: can't multiply sequence by non-int of type 'float'
File "/config/custom_components/entsoe/coordinator.py", line 100, in _async_update_data
File "/config/custom_components/entsoe/coordinator.py", line 85, in parse_hourprices
File "/config/custom_components/entsoe/coordinator.py", line 79, in calc_price >

No attributes in current electricity market price

After most recent update Attributes are lost from Current electricity market price entity after most recent 0.1.2 update
attributes are still exist in Average electricity price today, so those are reachable still as well as using v0.1.1

Optimizing electricity use with hourly prices

Hi, you have built a great integration. Thanks for that.
I have an electric car and heat pumps as heating solution. No gas anymore.
On colder days in winter the heat pumps (2) regularly use some 150 kWh per day and let's say the Tesla on average will need some 40 kWh after it has been used. And apart from that I use some 50 kWh per day on lights, pumps, cooking, washing etc.
So I'll really want to optimise electricity use to the hours with lowest price as published by entsoe to profit from the heat pump and EV investment.
Now I was thinking at 15.00 the prices of next day become available and say at 15.01 hass could run an optimisation program to calculate the best hours to use electricity for the coming 33 hours, taking into account the necessary forecasted kWh and the typical use per device. Ofcourse the next day at 15.00 hours the first 9 hours will be replanned together with the prices of the day ahead prices of the day after that. The prices could go up so the 9 hours of the running day could become more interesting.
My problem is that I don't have much use for the sensors, that are available now, since they are not stating the time and averages do not bring me much.
I would rather have an ordered list of hour-prices, so that I can just take the beginning of the list to plan my use up and until the forecasted kWh's are reached and then the actual order of the hours will be kicking in again. I'm assuming I can buffer heat as much as necessary within a day and the car does not have to be fully charged every morning. This assumption will not be always valid, but as a working assumption it's ok.
How can I get at the ordered list for the next 33 hours at or around 15.00 hrs the easiest do you think? If I have my optimiser I will make a PR for the interested or a separate integration/automation if that should be better.

Feature request: retaining entered integration info

After set up of the integration (without using the template for additional costs) I would like to make use of the additional costs template.
However when I go into the integration the API key and location is not retained. I have to reenter them.

Is it possible to retain this info in some way?

Feature request: Stop updating prices at midnight

Please note that this is about the prices attribute. Not prices_today and prices_tomorrow

I wonder if it is possible to stop updating the prices attribute at midnight. I see no good reason for deleting half of the data at that time. The reason it makes things difficult is that I want to have the cheapest hours between 18:00 and 06:00 next day. But when prices updates at midnight and the previous day is deleted from the list, it is impossible to find the cheapest hours anymore. The history is gone and from midnight I can only find the cheapest hours from 00:00 to 06:00.

The template below works as expected from 18:00 to midnight, but at midnight the prices attribute changes and I get a new set of 6 cheapest hours. At the worst, I could have the 6 cheapest hours between 18:00 and 06:00 before midnight and get new 6 hours after midnight so that I get 12 hour in total.

I see no good reason to delete data from the prices attribute at midnight. A lot of automation happens at night, too, and changing this list when there is no changes in the data it contains, makes building templates a lot more difficult than it has to be. In fact, I dont know how to solve the problem in a template alone and has to use python scripting instead. I can handle that, but users with no experience in programming will struggle with making python scripts.

  • platform: template
    sensors:
    cheapest_hours_between_18_and_06:
    value_template: >-
    {% set l=state_attr('sensor.current_electricity_market_price', 'prices')[18:30]|sort(attribute='price') %}
    {{ (now() >= as_datetime(l[0].time) and now() <= as_datetime(l[0].time) + timedelta(hours = 1))
    or (now() >= as_datetime(l[1].time) and now() <= as_datetime(l[1].time) + timedelta(hours = 1))
    or (now() >= as_datetime(l[2].time) and now() <= as_datetime(l[2].time) + timedelta(hours = 1))
    or (now() >= as_datetime(l[3].time) and now() <= as_datetime(l[3].time) + timedelta(hours = 1))
    or (now() >= as_datetime(l[4].time) and now() <= as_datetime(l[4].time) + timedelta(hours = 1))
    or (now() >= as_datetime(l[5].time) and now() <= as_datetime(l[5].time) + timedelta(hours = 1)) }}

No graph in apex chart with data_generator anymore

Strange, everything in order yesterday. Today I wanted to check out how the 48 hour view looked prior to the 15:00 hour information threshold for the next day.
Surprisingly the apex chart is empty... not even error, just empty chart.

If I remove the 'data_generator' part everything seems oke.
As updated for I believe the HA-core, this hassentso-e and I believe the apexcharts have been installed and I only know how to revert the core update, I have no idea where to start looking for the error.

anyone else experiencing this? and a pointer in the right direction?

image

Feature request: Opt-in for long-term statistics

Hi, thanks for the great component! It's helping me a lot with trying to get the best out of my dynamic energy contract.

To perform some data analysis on historic pricing, energy cost, etc., it may be beneficial to opt-in the "current price" exposed by this integration for long-term statistics as described here. This should be a pretty small change, and would allow Hass to collect aggregate data for longer than the 10-day default period.

Thanks again for your work on this!

Wrong calculation of VAT Belgium when using a template

It seems to be the VAT is calculated after the price is modified by the template. In Belgium all additional costs are excluded from tax so it is:
price x VAT + costs; but the integration calculates it as (price + costs) x VAT.

This might be different in other countries and I can imagine a mix of costs is also possible for example (price + costs ) x VAT + tax_free_costs. So I guess a second option apart from {{current price}} is needed?

Bug: High, Min, Max and avg (etc) today values are updated at next day data available time

The entities containing today's high, low etc points are updated with today's data when tomorrow's data becomes available.
This causes these entities to calculate today's x value when the day is halfway past over.
Causing (for example) lowest and highest cost to contain data in the past when they are calculated.
It would be better to either calculate them at 00:01 or (my preference) calculate them with all available future data.

However, the 2nd option would require new entities or changing the purpose of existing entities.
So for backwards compatibility option 1 is preferable.

Help needed: VAT of all countries

I am currently working on getting VAT and conversion rates in the integration. I made a dictionary with all countries and its data:

AREA_INFO = {"AT":{"code":"AT", "name":"Austria", "VAT":0.22, "Currency":"EUR"},
             "BE":{"code":"BE", "name":"Belgium", "VAT":0.06, "Currency":"EUR"},
             "BG":{"code":"BG", "name":"Bulgaria", "VAT":0.21, "Currency":"EUR"},
             "HR":{"code":"HR", "name":"Croatia", "VAT":0.21, "Currency":"EUR"},
             "CZ":{"code":"CZ", "name":"Czech Republic", "VAT":0.21, "Currency":"EUR"},
             "DK_1":{"code":"DK_1", "name":"Denmark Eastern (DK1)", "VAT":0.21, "Currency":"EUR"},
             "DK_2":{"code":"DK_2", "name":"Denmark Western (DK2)", "VAT":0.21, "Currency":"EUR"},
             "EE":{"code":"EE", "name":"Estonia", "VAT":0.21, "Currency":"EUR"},
             "FI":{"code":"FI", "name":"Finland", "VAT":0.24, "Currency":"EUR"},
             "FR":{"code":"FR", "name":"France", "VAT":0.21, "Currency":"EUR"},
             "LU":{"code":"DE_LU", "name":"Luxembourg", "VAT":0.21, "Currency":"EUR"},
             "DE":{"code":"DE_LU", "name":"Germany", "VAT":0.21, "Currency":"EUR"},
             "GR":{"code":"GR", "name":"Greece", "VAT":0.21, "Currency":"EUR"},
             "HU":{"code":"HU", "name":"Hungary", "VAT":0.21, "Currency":"EUR"},
             "IT_CNOR":{"code":"IT_CNOR", "name":"Italy Centre North", "VAT":0.21, "Currency":"EUR"},
             "IT_CSUD":{"code":"IT_CSUD", "name":"Italy Centre South", "VAT":0.21, "Currency":"EUR"},
             "IT_NORD":{"code":"IT_NORD", "name":"Italy North", "VAT":0.21, "Currency":"EUR"},
             "IT_SUD":{"code":"IT_SUD", "name":"Italy South", "VAT":0.21, "Currency":"EUR"},
             "IT_SICI":{"code":"IT_SICI", "name":"Italy Sicilia", "VAT":0.21, "Currency":"EUR"},
             "IT_SARD":{"code":"IT_SARD", "name":"Italy Sardinia", "VAT":0.21, "Currency":"EUR"},
             "LV":{"code":"LV", "name":"Latvia", "VAT":0.21, "Currency":"EUR"},
             "LT":{"code":"LT", "name":"Lithuania", "VAT":0.21, "Currency":"EUR"},
             "NL":{"code":"NL", "name":"Netherlands", "VAT":0.21, "Currency":"EUR"},
             "NO_1":{"code":"NO_1", "name":"Norway Oslo (NO1)", "VAT":0.25, "Currency":"EUR"},
             "NO_2":{"code":"NO_2", "name":"Norway Kr.Sand (NO2)", "VAT":0.25, "Currency":"EUR"},
             "NO_3":{"code":"NO_3", "name":"Norway Tr.heim (NO3)", "VAT":0.25, "Currency":"EUR"},
             "NO_4":{"code":"NO_4", "name":"Norway Tromsø (NO4)", "VAT":0, "Currency":"EUR"},
             "NO_5":{"code":"NO_5", "name":"Norway Bergen (NO5)", "VAT":0.25, "Currency":"EUR"},
             "PL":{"code":"PL", "name":"Poland", "VAT":0.21, "Currency":"EUR"},
             "PT":{"code":"PT", "name":"Portugal", "VAT":0.21, "Currency":"EUR"},
             "RO":{"code":"RO", "name":"Romania", "VAT":0.21, "Currency":"EUR"},
             "RS":{"code":"RS", "name":"Serbia", "VAT":0.21, "Currency":"EUR"},
             "SK":{"code":"SK", "name":"Slovakia", "VAT":0.21, "Currency":"EUR"},
             "SI":{"code":"SI", "name":"Slovenia", "VAT":0.21, "Currency":"EUR"},
             "ES":{"code":"ES", "name":"Spain", "VAT":0.21, "Currency":"EUR"},
             "SE_1":{"code":"SE_1", "name":"Sweden Luleå (SE1)", "VAT":0.25, "Currency":"EUR"},
             "SE_2":{"code":"SE_2", "name":"Sweden Sundsvall (SE2)", "VAT":0.25, "Currency":"EUR"},
             "SE_3":{"code":"SE_3", "name":"Sweden Stockholm (SE3)", "VAT":0.25, "Currency":"EUR"},
             "SE_4":{"code":"SE_4", "name":"Sweden Malmö (SE4)", "VAT":0.25, "Currency":"EUR"},
             "CH":{"code":"CH", "name":"Switzerland", "VAT":0.21, "Currency":"EUR"},
            #  "UK":{"code":"UK", "name":"United Kingdom", "VAT":0.21, "Currency":"EUR"},
            #  "AL":{"code":"AL", "name":"Albania", "VAT":0.21, "Currency":"EUR"},
            #  "BA":{"code":"BA", "name":"Bosnia and Herz.", "VAT":0.21, "Currency":"EUR"},
            #  "CY":{"code":"CY", "name":"Cyprus", "VAT":0.21, "Currency":"EUR"},
            #  "GE":{"code":"GE", "name":"Georgia", "VAT":0.21, "Currency":"EUR"},
            #  "IE":{"code":"IE", "name":"Ireland", "VAT":0.21, "Currency":"EUR"},
            #  "XK":{"code":"XK", "name":"Kosovo", "VAT":0.21, "Currency":"EUR"},
            #  "MT":{"code":"MT", "name":"Malta", "VAT":0.21, "Currency":"EUR"},
            #  "MD":{"code":"MD", "name":"Moldova", "VAT":0.21, "Currency":"EUR"},
            #  "ME":{"code":"ME", "name":"Montenegro", "VAT":0.21, "Currency":"EUR"},
            #  "MK":{"code":"MK", "name":"North Macedonia", "VAT":0.21, "Currency":"EUR"},
            #  "TR":{"code":"TR", "name":"Turkey", "VAT":0.21, "Currency":"EUR"},
            #  "UA":{"code":"UA", "name":"Ukraine", "VAT":0.21, "Currency":"EUR"},
            }

For now, all VAT values an Currency values are set to dummy values. Would greatly appreciate some help with it, as it is not easy to find the correct VAT values in some countries!

Feature request: Multiple currency support

I only get "Current Day-Ahead Electricity Price" and "Next Hour Day-Ahead Electricity Price" in Euro. Is this correct? I use Norway Kr. Sand (NO2) in Area. I want to have the prices in NOK.

image

Home Assistant 2022.9.7

async_update_data changes

I changed async_update_data to what is shown below. I am still testing!!
(I know I should create a pull request for this, but that is not possible at this time and the computer I have available)

I know this will fail when going from summer- to winter time as one day will have 25 hours (or 23 in the spring, when changing from winter- to summer time)

`

async def _async_update_data(self) -> dict:
"""Get the latest data from ENTSO-e"""
self.logger.debug("Fetching ENTSO-e data")
self.logger.debug(self.area)

    time_zone = dt.now().tzinfo
    # We request data for yesterday up until tomorrow.
    yesterday = pd.Timestamp.now(tz=str(time_zone)).replace(hour=0, minute=0, second=0) - pd.Timedelta(days = 1)
    tomorrow = yesterday + pd.Timedelta(hours = 71)

    data = await self.fetch_prices(yesterday, tomorrow)

    parsed_data = self.parse_hourprices(data)
    data_all = parsed_data[-49:].to_dict()
    if parsed_data.size > 48:
        data_today = parsed_data[-49:-24].to_dict()
        data_tomorrow = parsed_data[-24:].to_dict()
    else:
        data_today = parsed_data[-24:].to_dict()
        data_tomorrow = {}

    return {
        "data": data_all,
        "dataToday": data_today,
        "dataTomorrow": data_tomorrow,
    }

`

More info how to obtain api key

Maybe add the following to readme file for future users how to obtain api key.

To request access to the Restful API, please register on the Transparency Platform and send an email to [email protected] with “Restful API access” in the subject line. Indicate the email address you entered during registration in the email body. The ENTSO-E Helpdesk will make their best efforts to respond to your request within 3 working days.

Switch DK1 and DK2 labeling

Currently the two DK regions are labelled as this:

         "DK_1":{"code":"DK_1", "name":"Denmark Eastern (DK1)", "VAT":0.21, "Currency":"EUR"},
         "DK_2":{"code":"DK_2", "name":"Denmark Western (DK2)", "VAT":0.21, "Currency":"EUR"},

However, this is wrong. DK1 is west and DK2 is east.

https://www.google.com/search?q=dk1+dk2&client=firefox-b-d&sxsrf=ALiCzsaIaoY3syOTaDiNfjiF4nTpG80sBQ:1669292783473&source=lnms&tbm=isch&sa=X&ved=2ahUKEwi69Imb6Mb7AhViQfEDHWQGCAEQ_AUoAXoECAEQAw&biw=2560&bih=1315&dpr=1.5

Error in commit b550a58

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/entsoe/__init__.py", line 21, in async_setup_entry
    area = entry.options[CONF_AREA]
KeyError: 'area'

Charting issue (ApexCharts)

Hello, for some reason today ApexCharts example stopped working. As far as I can see data is updated and provided correctly, however the chart isn't reflecting the values.

Any thoughts?

Screenshot_2022-11-19-13-01-12-53_c3a231c25ed346e59462e84656a70e50
Screenshot_2022-11-19-13-01-38-20_c3a231c25ed346e59462e84656a70e50
Screenshot_2022-11-19-13-03-14-93_c3a231c25ed346e59462e84656a70e50

Can't connect to ENTSO-E platform due to IP-Block

Is it possible to change the source of the price information?

Weirdly, I'm not allowed to access the transparency platform from my residential internet connection. It is from a reputable ISP but the ip-block I'm is secondhand and occasionally I run into issues. This has probably to do with so-called ip reputation services and I'm not alone in this.

My energy provider does provide an API with day-ahead-pricing in JSON format. This I can access.

Question: why so many updates on one day?

I see, that the integration fills the database with many sensor updates during the day, whereas it is only updated once a day. Around 15.00, when the prices of the next day are added.
Why is this?

Feature request: Time-shifting energy consumption

It would be great if this integration could aid users when trying to time-shift energy consumption towards the cheapest hours of the day.
Maybe even let uers tailor a template they can use in automations.

This can be a complex matter, because the end-users needs are very different, based on household, geography, personal preference and such, but I have an idea on how to let users easily get going..

Say I wanna try to shift the times when my water boiler consumes energy. I estimate that my water boiler needs to have access to energy at least 13 hours of the day, to make sure we don't get any nasty bugs in the water. So, if this integration can provide a binary sensor that allows the user to give it a name and define the amount of hours needed (X), it could evaluate to true only during the X amount of hours that are the cheapest. It would be easy to use directly in time-shifting consumption for the water boiler.

I also have an EV. On any regular day I would not need more than 5 or 6 hours of access to energy to charge the car. I could define a new binary sensor that is only true during the 5 (or 6) cheapest hours.

Of course, people are starting to really invest in solar panels, and that propably further complicates things, but lets tackle one problem at the time. Right now, I cannot see any easy way to get started with (more or less) intelligently time-shifting energy consumption... This would be a huge deal!

Apexcharts series labels showing the wrong value

When you have multiple sensors on the one apexcharts graph series sames are added at the bottom toghether with the current value. Since moving the atrributes to the everage price today entitry the value shown is the last value of the series and not the value at the current time.

Using the code from the readme example and adding a second entity I get this:

image

The circled values ar those from the last bar.

I'm not 100% sure this is an ENTSO-E issue or an apexcharts one, but this integration has changed most recently, so I'm betting on this one.

Code:

type: custom:apexcharts-card
graph_span: 24h
span:
  start: day
now:
  show: true
  label: Now
header:
  show: true
  title: Electriciteitsprijzen Vandaag (€/kwh)
series:
  # This is the entity ID with no name configured.
  # When a name is configured it will be sensor.<name>_average_electricity_price_today.
  - entity: sensor.average_electricity_price_today
    stroke_width: 2
    float_precision: 3
    type: column
    opacity: 1
    color: ''
    data_generator: |
      return entity.attributes.prices_today.map((record, index) => {
        return [record.time, record.price];
      });
  - entity: sensor.injectie_average_electricity_price_today
    stroke_width: 2
    float_precision: 3
    type: column
    opacity: 1
    color: ''
    data_generator: |
      return entity.attributes.prices_today.map((record, index) => {
        return [record.time, record.price];
      });

Feature request: Additional costs

In Norway, and probably other countries as well, we dont pay for the energy alone. We also have to pay a local company for grid connection. Some of this additional costs are fixed monthly costs, but some are also energy costs added to the price entso-e are providing. And these additional costs are variable based on weekday and time of day.

The Nordpool integration, https://github.com/custom-components/nordpool , handles this quite elegantly by overriding the now() function. Look at the documentation and also on line 265 in https://github.com/custom-components/nordpool/blob/master/custom_components/nordpool/sensor.py on how this is implemented. Also note that all prices the Nordpool integration provides, has these additional costs added, also the list of future prices.
My own configuration is like this:

`
additional_costs: >-

 {% set s = {

    "hourly_fixed_cost": 0.0,

    "night": 0.5426,

    "day": 0.6676,

    "cert": 0.01

    }

  %}

    {% if now().isoweekday() >= 1 and now().isoweekday() <= 5 %}

      {% if now().hour >=6 and now().hour <22 %}

        {{(s.day+s.hourly_fixed_cost+s.cert)|float(0)}}

      {% else %}

        {{(s.night+s.hourly_fixed_cost+s.cert)|float(0)}}

      {% endif %}

    {% else %}

      {{(s.night+s.hourly_fixed_cost+s.cert)|float(0)}}

    {% endif %}`

No data if internet is down

So my roomba tried to eat the power cable for the fiber converter tonight, and the second the connection went down the data from the integration dissapeared. This is a major issue considering this data may be used to control critical things like heating. Not sure why it would need an internet connection other than when fetching prices at 1400 anyways? The nordpool integration had no issues.

Log:

Logger: custom_components.entsoe.coordinator
Source: helpers/update_coordinator.py:151
Integration: ENTSO-e Transparency Platform (documentation, issues)
First occurred: 04:31:45 (2 occurrences)
Last logged: 04:31:46

Error fetching ENTSO-e coordinator data: Unexcpected error when fetching ENTSO-e prices: HTTPSConnectionPool(host='web-api.tp.entsoe.eu', port=443): Max retries exceeded with url: /api?documentType=A44&in_Domain=10YNO-3--------J&out_Domain=10YNO-3--------J&securityToken=xxx&periodStart=202212012300&periodEnd=202212062200 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x9dd66340>: Failed to establish a new connection: [Errno -3] Try again'))
Error fetching ENTSO-e coordinator data: Unexcpected error when fetching ENTSO-e prices: HTTPSConnectionPool(host='web-api.tp.entsoe.eu', port=443): Max retries exceeded with url: /api?documentType=A44&in_Domain=10YNO-3--------J&out_Domain=10YNO-3--------J&securityToken=xxx&periodStart=202212012300&periodEnd=202212062200 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x9a88d238>: Failed to establish a new connection: [Errno -3] Try `again'))`

Screenshot of the history of a few of the sensors from entso-e, and some of the sensors used to control my water heater and electric heat when I'm not home.
Entsoe network down

Error handling when the ENTSO-E platform is down

When the ENTSO-E transparancy platform is down for some reason all data becomes unavailable even if there is still old data available.
The following error is triggered:

2022-12-07 14:54:29.903 ERROR (MainThread) [custom_components.entsoe.coordinator] Unexpected error fetching ENTSO-e coordinator data: 'NoneType' object has no attribute 'items'Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/entsoe/coordinator.py", line 101, in _async_update_data parsed_data = self.parse_hourprices(data) File "/config/custom_components/entsoe/coordinator.py", line 85, in parse_hourprices for hour, price in hourprices.items(): AttributeError: 'NoneType' object has no attribute 'items'

Suggestion:

  1. catch the error
  2. use old data as long as possible
  3. add a sensor for the ENTSO-E availability (optional, but would be very nice to handle follow up errors)

Feature request: VAT

In many if not most countries, VAT is added on top of electricity price.

This should be an option in the config flow. The default could be country-dependent, but such list may also be hard to maintain because VATs keep changing, e.g. custom-components/nordpool#163 and might also depend on business/private use or even on the part of the country, custom-components/nordpool#170

Alternatively or additionally it could be calculated in the additional_cost template #10 by providing current electricity price to the template.

Feature request: Allow customization of entity id's

Currently some of the entity id's given by this component conflict with another integration I've configured to provide me with all-in hour prices from an energy provider.
Next to that I have the need to monitor 2 different country's hour prices.
Therefore, it would be nice if this component has an prepend option during configuration.
So that users might customize their entity id's (and possibly in the future create multiple instances of this integration).

Feature request: Create release(s) and notes for informing user of changes made to the integration

Currently the integration is maintained by releasing a new version (hacs commit id upgrade) when an new change is merged to the master branch.
The last change that was merged (for #36) contained a breaking change that required users to re-add the integration after upgrading.
It would be nice for end-users if the release notes were to inform them of the required action to get the integration working after upgrade.

So that end-users won't have to search / open issues in order to get everything working again.
Furthermore, this would also allow end users to better determine whether to upgrade at that time and what new features they could try out

time of highest/lowest format not as intended?

Scherm­afbeelding 2022-11-04 om 14 48 22

seems the same issue we had before

also, these are the only 2 mention 'energy' while electricity would bring it in accordance with the other entities?

Time Of Highest Energy Price Today
Time Of Lowest Energy Price Today

just another thought: since this integration is about electricity prices, and electricity only, wouldn't it be more efficient/less redundant to leave 'electricity' out of the name and entity_id completely? its what I do:

Scherm­afbeelding 2022-11-04 om 14 52 21

and thanks for this new version, much better on the attributes! compliments for that.

Feature request: configuration.yaml support

Quoting @jpulakka:

The one-line input textfield isn't exactly optimal for holding a 30+ line template. I wonder what's the HASS philosophy for stuff like this. In the nordpool plugin I used to put everything in configuration.yaml, which is convenient to store in version control and it's clear where the data is.

There should be support for a configuration in yaml. The template for the configuration should look something like this:

sensor:
  - platform: entsoe
    api_key: <YOUR API KEY>
    area: "NL"
    additional_costs: "{{0.0|float}}" #default value

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.