Releases: azogue/aiopvpc
🐛 Fix unsorted prices in composed sensor 'INDEXED'
✨ Add new composed sensor for Indexed tariff
- ✨ Add new price sensors: Market adjustment (from ESIOS API indicator 2108), and Indexed tariff (as composed price sensor calculated as
PVPC - ADJUSTMENT
), from first-time contributor @MiguelAngelLV in #69 🍻, and some adjustments in #70 - 🎨 pre-commit updates and change to
ruff
+ruff-format
instead ofblack
andisort
- 🚀 Bump minor version and update deps and CHANGELOG.md
♻️ Remove python upper limit
Fix injection price sensor attributes (2)
- 🐛 Fix one-line conditional matching for 'not None' instead of positive value 🙈
- ✅ tests: Add unit test for price sensor attributes
Fix injection price sensor attributes
- 🐛 Fix attributes 'max_price_at' and 'min_price_at' for injection price sensor (were swapped)
- 📦️ Bump minor version and update deps
- 📝 Fix usage example in README.md and links in CHANGELOG.md
- 🎨 pre-commit autoupdate and swap
flake8
forruff
Adapt to 403 unauthorized error
- 🐛 Process 403 error from server like '401 unauthorized', raising
BadApiTokenAuthError
to signal HA for reauth-config for both status codes, when API token is enabled (#51)
Minor fixes
- ✏️ Fix typo on 'injection' keyword (was badly typed as spanglish 'inyection' 😅)
- 🐛 Fix unit for price sensors attributes (from €/MWh to €/kWh)
Implement ESIOS API Token support
-
✨ Implement support to access the extended ESIOS API with a personal token
(you must request yours by mailing to [email protected]),
with initial support for the existent PVPC price sensor (ESIOS indicator code: 1001), and 3 new ones 🤩:- Inyection price sensor (ESIOS indicator code: 1739),
name: "Precio de la energía excedentaria del autoconsumo para el mecanismo de compensación simplificada" - MAG price sensor (ESIOS indicator code: 1900),
name: "Desglose peaje por defecto 2.0TD excedente o déficit de la liquidación del mecanismo de ajuste de costes de producción" - OMIE price sensor (ESIOS indicator code: 10211),
name: "Precio medio horario final suma de componentes"
- Inyection price sensor (ESIOS indicator code: 1739),
-
💥 Remove 'apidatos' support as alternative data-source, leaving only public and private paths for https://api.esios.ree.es
-
✨ Signal bad auth for esios token calls with a custom exception, to handle 'reauth' flow in Home-Assistant
-
✨ Add helper methods for HA integration to manage unique ids for each sensor, to update the enabled sensors to download, and to check the API token
-
♻️ Use dataclasses for
EsiosApiData
andEsiosResponse
data containers, instead of typed dicts -
✅ tests: Update fixtures for esios sensors and adapt tests to the new interface and the multiple-sensors behaviour
-
📦️ Bump mayor version to v4 and lighten dev-env, removing pre-commit related modules and adding python-dotenv
-
📦️ Remove
holidays
dependency to evaluate special days under 'P3' period and fix tests (from #46)
Change data source to apidatos.ree.es
🔥 BREAKING-CHANGE: this release removes support for the old PVPC tariffs (prices < 2021-06-01), and the extra methods to use this library as a dataloader (.download_prices_for_range(...)
), leaving only the code to support the HA Core integration.
Motivated by recent successful attempts to kick us out from api.esios.ree.es
, we are changing the data source to another server, at apidatos.ree.es
.
👏 As suggested by @lazynoda in this comment, REE has another public and documented API (REData API) with the same information as the current one, available without authentication 👌, so it may deserve a chance 🤞.
This release implements the new data-source, but also maintains the legacy one.
- Initial configuration is set with a new
data_source
parameter, with the new source as default. - If a 403 status-code is received, the data source is switched (new to legacy / legacy to new), no retry is done (and the User-Agent loop trick is only used for the legacy data source)
Changes in #39
Decrease API refresh rate and try to avoid user-agent banning
v2.3.0 - Decrease API refresh rate and try to avoid banning (2021-12-01)
Quick-Fix motivated by the last change in the ESIOS server (on 2021-11-30 😱), which is now apparently banning HomeAssistant requests, filtering us out because of the 'User-Agent' headers data 😤 (the server is returning a 403 status code error for a PUBLIC url 🤷).
So, until future moves to authenticated endpoints, or alternative data sources, let's continue playing 🐈 and 🐁 with the ESIOS webadmins 🤣🤣
[Serious note for those webadmins]: I'm just a volunteer, and I'm an email away for contact, so please, if you are reading this, give me a call before filtering us all out 🤝🥺
Changes:
-
⚡ Substantially decrease the number of API requests to ESIOS, avoiding unnecessary calls to refresh data for the same electricity prices.
Before, when used from thepvpc_hourly_pricing
HA Core integration, the ESIOS API was called 2 times/hour from 0h to 20h, and 4 times/hour in the evening, from 20h to 0h, retrieving today + tomorrow prices.
This makes a total of ~56 requests/day, which is not a lot 😅, but it seems the aggregated total for the HA user base (🔥 >30k requests/day just counting users pushing HA analytics) is being some kind of a problem for ESIOS,
as it looks like they're trying to bane us 🥺😭
Now, the API handler avoids calls to retrieve already available prices, cutting down the number of requests to just 1-2 requests/day 🤩 -
🐛 Set standard
User-Agent
header info, to try to avoid server-side banning 🙈, and rotate it if banning is detected, using common User-Agent browser identifiers. -
♻️ Minor code refactor to prepare for future library changes, in order to move to authenticated API endpoints in future versions.