Package: oligo
python-oligo[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):fromoligoimportIberconnection=Iber()connection.login("user","password")watt=connection.watthourmeter()print(watt)Consultar consumo actual (ASync):importasynciofromoligo.asyncioimportAsyncIberasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")watt=awaitconnection.watthourmeter()print(watt)awaitconnection.close()asyncio.run(main())Consultar estado ICP interno (Sync):fromoligoimportIberconnection=Iber()connection.login("user","password")status=connection.icpstatus()print(status)Consultar estado ICP interno (ASync):importasynciofromoligo.asyncioimportAsyncIberasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")status=awaitconnection.icpstatus()print(status)asyncio.run(main())Obtener el consumo horario durante un periodo (Sync)fromoligoimportIberfromdatetimeimportdate,timedeltaconnection=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)importasynciofromoligo.asyncioimportAsyncIberfromdatetimeimportdate,timedeltaasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")from_date=date.today()-timedelta(days=7)until_date=date.today()-timedelta(days=1)consumo=awaitconnection.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 oligoExample:Obtain current consumption (Sync):fromoligoimportIberconnection=Iber()connection.login("user","password")watt=connection.watthourmeter()print(watt)Obtain current consumption (ASync):importasynciofromoligo.asyncioimportAsyncIberasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")watt=awaitconnection.watthourmeter()print(watt)asyncio.run(main())Get ICP status (Sync):fromoligoimportIberconnection=Iber()connection.login("user","password")status=connection.icpstatus()print(status)Get ICP status (ASync):importasynciofromoligo.asyncioimportAsyncIberasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")status=awaitconnection.icpstatus()print(status)asyncio.run(main())Retrieve the hourly consumption during a time period (Sync)fromoligoimportIberfromdatetimeimportdate,timedeltaconnection=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)importasynciofromoligo.asyncioimportAsyncIberfromdatetimeimportdate,timedeltaasyncdefmain():connection=AsyncIber()awaitconnection.login("user","password")from_date=date.today()-timedelta(days=7)until_date=date.today()-timedelta(days=1)consumo=awaitconnection.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.