Skip to main content

Lightweight package to consume data from REE (Red Eléctrica de España)

Project description

Ree-connector

A lightweight Python package to consume data from REE (Red Eléctrica de España)

Intro

The development of this package is motivated by the change in the regulated tariff PVPC (Voluntary Price for Small Consumers) of the Spanish electricity market. This allowed small consumers to choose the tariff that best suited their consumption according to their schedules or needs.

Following this change, the three sections into which it was previously divided (general, night, electric vehicle) disappeared. From this moment on, each hourly time slot has a different price, and can be very different from the price of its neighbours. This eliminates the possibility of adjusting your consumption to certain hours, where you know for sure that the price of electricity is cheaper.

Therefore, this package is designed to obtain information about the market and contains a series of methods that will help you to know the best hours to make your heavy consumption, among other things, and of course, integrate it with your Python application to manage home automation systems based on this data.


El desarrollo de este paquete está motivado por el cambio producido en la tarifa regulada PVPC (Precio Voluntario para el Pequeño Consumidor) del mercado eléctrico español. Esto permitía a los pequeños consumidores escoger la tarifa que mas se adaptaba a su consumo en función de sus horarios o necesidades.

Tras este cambio, desaparecieron los tres tramos en los que se dividía anteriormente (general, noche, vehículo eléctrico). A partir de este momento, cada tramo de una hora tiene un precio distinto, y puede ser muy diferente al precio de sus vecinos. Esto elimina la posibilidad de ajustar tu consumo a unos horarios determinados, donde sabes seguro que el precio de la luz es mas barato.

Por ello, este paquete está pensado para obtener la información sobre el mercado y contiene una serie de métodos que te ayudarán a conocer las mejores horas para realizar tu consumo pesado, entre otras cosas, y como no, integrarlo con tu aplicación Python para poder gestionar sistemas domoticos en base a estos datos.


First Steps / Primeros Pasos

Access Token Request / Solicitud Token Acceso

To use this package you need an access token. To request it you must send an email to consultasios@ree.es to ask REE (Red Eléctrica de España) for your access token. They usually reply in less than 24h, in the subject you can put "API access token request".


Para utilizar este paquete necesitas un token de acceso. Para solicitarlo debes enviar un email a consultasios@ree.es para solicitar a REE (Red Eléctrica de España) tu token de acceso. Normalmente suelen responder en menos de 24h, en el asunto puedes poner "Solicitud token acceso API".


Quick Start / Inicio Rápido

```
from datetime import datetime
from ree_connector import markets

# We generate a date as a string with format 'dd-mm-yyyy
date = datetime.now().strftime("%d-%m-%Y")


# We generate a date as a string with format 'dd-mm-yyyy'
# You can do some tests without api key, for production environments
# must request your API token.

market = markets.PvpcMarket(date,"XXXXXXXXXXXXXXXXXXXXXXXXXXXX","PEN")

# Returns all prices for market session
market.get_session_prices()

# Returns min price for market session
market.get_session_min_price()

# Returns max price for market session
market.get_session_max_price()

# Returns avg price for market session
market.get_session_avg_price()

# Returns if price is under session average price or not
market.get_session_prices()[10].is_under_avg()

# Setter method to under_avg attribute
market.get_session_prices()[10].set_under_avg(True)

# Returns the n cheapest prices for market session
market.get_n_cheapest_hours(3)

# Returns if price is cheap or not
market.get_session_prices()[10].is_cheap()

# Setter method to cheap attribute
market.get_session_prices()[10].set_cheap(True)

# Returns the price for Iberian Peninsula and Balearic Islands.
market.get_session_prices()[10].get_pen_price()

# Returns the price for Canary Island and Melilla
market.get_session_prices()[10].get_can_price()

# Returns the session interval
market.get_session_prices()[10].get_raw_hour()

# Atribute with left-hand side datetime
market.get_session_prices()[10].left_hour

# Atribute with right-hand side datetime
market.get_session_prices()[10].right_hour
```

Docs

Documentation

License / Licencia

MIT License

Copyright (c) 2021 Jorge Marín

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors: Jorge Marín - initial Package version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ree-connector-0.1.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ree_connector-0.1.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file ree-connector-0.1.3.tar.gz.

File metadata

  • Download URL: ree-connector-0.1.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.12 Linux/5.11.0-40-generic

File hashes

Hashes for ree-connector-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d80426624107a7d9d16eb6dd282beaa0412f1c87c97559d920a0c13467aa5d3e
MD5 faea049baf739b839d91f3b25bd734a0
BLAKE2b-256 5a94ca6c1666769596f40036594c66d4d2909a515b96e9c553a000cc10a22c6d

See more details on using hashes here.

File details

Details for the file ree_connector-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ree_connector-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.12 Linux/5.11.0-40-generic

File hashes

Hashes for ree_connector-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc42975aa4f979780e74724ea40ce721f4ecdf4e26342608f2ab95becbfe64c1
MD5 0590115382ae3b5180926b6deb18cb8f
BLAKE2b-256 baf9d15d35eabe9b70663b1ca6a40ed8bfcae66a409235ce1a338661788d694f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page