Skip to main content

UNOFFICIAL Python client for i-DE

Project description

python-oligo

Python package

Gitpod ready-to-code

[ES] Cliente Python (NO OFICIAL) para i-DE (Iberdrola distribución).

Instalación:

Requests support:

pip install oligo[requests]

Async support:

pip install oligo[asyncio]

Ejemplos:

Consultar consumo actual (Sync):

from oligo import Iber

connection = Iber()
connection.login("user", "password")

watt = connection.watthourmeter()
print(watt)

Consultar consumo actual (ASync):

import asyncio
from oligo.asyncio import AsyncIber

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")

    watt = await connection.watthourmeter()
    print(watt)
    await connection.close()

asyncio.run(main())

Consultar estado ICP interno (Sync):

from oligo import Iber
connection = Iber()
connection.login("user", "password")
status = connection.icpstatus()
print(status)

Consultar estado ICP interno (ASync):

import asyncio
from oligo.asyncio import AsyncIber

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")
    status = await connection.icpstatus()
    print(status)

asyncio.run(main())

Obtener el consumo horario durante un periodo (Sync)

from oligo import Iber
from datetime import date, timedelta

connection = Iber()
connection.login("user", "password")

from_date = date.today() - timedelta(days=7)
until_date = date.today() - timedelta(days=1)

consumo = connection.consumption(from_date, until_date)

print(consumo[:10])

Obtener el consumo horario durante un periodo (ASync)

import asyncio
from oligo.asyncio import AsyncIber
from datetime import date, timedelta

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")

    from_date = date.today() - timedelta(days=7)
    until_date = date.today() - timedelta(days=1)

    consumo = await connection.consumption(from_date, until_date)

    print(consumo[:10])

asyncio.run(main())

Los datos son el consumo por hora en Watt-horas. En este caso tendremos los dato de una semana, que son 7 por 24, 168 valores. Si sumamos y dividimos por 1000, tenemos el consumo de una semana en kWh.

[EN] Python client (UNOFFICIAL) for i-DE (Iberdrola distribución).

Install:

pip install oligo

Example:

Obtain current consumption (Sync):

from oligo import Iber

connection = Iber()
connection.login("user", "password")

watt = connection.watthourmeter()
print(watt)

Obtain current consumption (ASync):

import asyncio
from oligo.asyncio import AsyncIber

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")

    watt = await connection.watthourmeter()
    print(watt)

asyncio.run(main())

Get ICP status (Sync):

from oligo import Iber
connection = Iber()
connection.login("user", "password")
status = connection.icpstatus()
print(status)

Get ICP status (ASync):

import asyncio
from oligo.asyncio import AsyncIber

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")
    status = await connection.icpstatus()
    print(status)

asyncio.run(main())

Retrieve the hourly consumption during a time period (Sync)

from oligo import Iber
from datetime import date, timedelta

connection = Iber()
connection.login("user", "password")

from_date = date.today() - timedelta(days=7)
until_date = date.today() - timedelta(days=1)

consumo = connection.consumption(from_date, until_date)

print(consumo[:10])

Retrieve the hourly consumption during a time period (Async)

import asyncio
from oligo.asyncio import AsyncIber
from datetime import date, timedelta

async def main():
    connection = AsyncIber()
    await connection.login("user", "password")

    from_date = date.today() - timedelta(days=7)
    until_date = date.today() - timedelta(days=1)

    consumo = await connection.consumption(from_date, until_date)

    print(consumo[:10])

asyncio.run(main())

The values are the consumption in Watt-hours. In this case, we have the data of one week, which are 7 times 24, 168 values. If we sum and divide by 1000, we will have the total consumption from one week in kWh.

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

oligo-2.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

oligo-2.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file oligo-2.1.1.tar.gz.

File metadata

  • Download URL: oligo-2.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for oligo-2.1.1.tar.gz
Algorithm Hash digest
SHA256 d39bf5b437396b0f5de02d090e33757e8d5b207eb8d1a138940a1032fcf8ea05
MD5 53fe28d224306ceb3010dceaaac307c5
BLAKE2b-256 0ed5ed1ecc256082adc2238502398b41151a56113f320355422359767a36524d

See more details on using hashes here.

File details

Details for the file oligo-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: oligo-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for oligo-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f78b6e64f3b8b520f4c0718fda4820d8cce9abf1e4f5b496c9ead5368ab7f88c
MD5 7227be28b089a57ac32510b0fb7d60bc
BLAKE2b-256 db2d5a79b522e47ff4fcc2c010c80f2afa5719a1da705303455f38695061078f

See more details on using hashes here.

Supported by

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