azogue / aiopvpc

Simple aio library to download Spanish electricity hourly prices (PVPC) from esios.ree.es
MIT License
41 stars 10 forks source link

Add gas compensation cost #45

Closed MiguelAngelLV closed 1 year ago

MiguelAngelLV commented 2 years ago

Could the cost of gas compensation be added? Some marketers are thinking of adding it to the price of the injection and it would be interesting to have both data in order to obtain the total price of the injection.

MiguelAngelLV commented 2 years ago

The data is in this link:

https://www.esios.ree.es/es/analisis/1900

r-jordan commented 2 years ago

Hi, now there are two new fields in the json downloaded from esios (https://api.esios.ree.es/archives/70/download_json) named EDCGASPCB and EDCGASCYM. Each field is for the two tariffs PCB and CYM. These data would be valuable to be published in Homeassistant as another sensor the same way the energy price is published, with the prices of the whole day as attributes.

MiguelAngelLV commented 2 years ago

The tokened API has the compensation values:

https://api.esios.ree.es/indicators/1900

MiguelAngelLV commented 2 years ago

I create a modified component using (https://github.com/azogue/aiopvpc/issues/9#issuecomment-968049577)[this] as base that add Gas Compensation sensor

Maybe could be interesting add a sensor with injection and gas sum. I tried it, but the complete day prices in attributes is a little complex without dirty code when you don't program with python.

https://github.com/MiguelAngelLV/homeassistant-pvpc-gas-compensation/commit/5233e80b9ac4e73a1801ffa072fb891435c69425

MiguelAngelLV commented 2 years ago

Hi.

I update (a rename) the component.

Now have a new sensor with Injection + Gas

https://github.com/MiguelAngelLV/esios_gas

azogue commented 1 year ago

Hi there 👋

Sorry about the lack of feedback these last months 🙏

I'm finally going to update the library to support the ESIOS API token, opening the access for more price sensors, like the inyection price, the gas-tax, and the omie price.

In the next few days I expect to:

  1. Make changes in this external library, to solve open issues, and implement the token-access for multiple sensors, also refactoring the PVPCData object from here, for better integration with the DataUpdateCoordinator from Home Assistant
  2. Adapt the Home Assistant integration to use the new version, ask for an ESIOS token, and declare more price sensors, making them work with the HA system to enable/disable entities from the integration view 🤩
  3. Make a PR in HA-core with the changes
  4. Make a PR in HA-docs with the explanation of the ESIOS token usage and how to get one.

When (1) and (2) are done, I'll try to upload a 'custom_component' to be able to beta-test it, while the review-and-publish process is being done.

As the ha-esios custom component which ~already works with the token (and people tend to mismatch with the official integration), I suspect it won't work with the token header change announced by ESIOS for the 17th, unless manually edited

azogue commented 1 year ago

✨ The new version v4 has support for this new sensor, closing this issue.

For beta-testing it, follow instructions in https://github.com/azogue/aiopvpc/pull/47#issuecomment-1376937590