Fetch Linky data from myelectricaldata.fr
Project description
myelectricaldatapy
Fetch date Enedis Linky from myelectricaldata.fr (enedisgateway.tech)
Install
Use the PIP package manager
$ pip install myelectricaldatapy
Or manually download and install the last version from github
$ git clone https://github.com/cyr-ius/myelectricaldatapy.git
$ python setup.py install
Attributs
- tempo_day : RED/WHITE/BLUE
- ecowatt : Information Dictionary
- power_datas: Datas
Methods
- async_get_max_power (start: datetime, end: datetime) Return: max power
- async_get_details_production (start: datetime, end: datetime) Return: details production (max 7days)
- async_get_details_consumption (start: datetime, end: datetime) Return: details consumption (max 7days)
- async_get_daily_production (day: datetime, end: datetime) Return: production (max 1095 days)
- async_get_daily_consumption (start: datetime, end: datetime) Return: consumption (max 1095 days)
- async_get_identity Return: datas identity
- async_check_offpeak (start: datetime) : check if datetime in range offpeak
- async_has_offpeak Return boolean if offpeak detected
- async_get_ecowatt Return: ecowatt information
- async_get_tempoday Return: Tempo day (RED/WHITE/BLUE)
- async_get_address Return address
- async_get_contract Return contact
- async_valid_access Return information access from mylelectricaldata
- async_load (start: datetime, end: datetime) Return None - Load datas in power_datas attribut
- async_refresh Return None - Refresh power_datas , tempo_day and ecowatt attributs.
Get started
# Import the myelectricaldatapy package.
from myelectricaldatapy import EnedisByPDL,EnedisAnalytics
TOKEN="012345"
PDL="012345012345"
async def main():
api = EnedisByPDL(token=TOKEN, pdl=PDL)
print(await api.async_get_contract())
print(await api.async_get_address())
start = datetime.now() - timedelta(days=7)
end = datetime.now()
datas = await api.async_get_details_consumption(start,end)
print(datas)
analytics = EnedisAnalytics(datas)
offpeak_intervals = [(dt.strptime("08H00", "%HH%M"), dt.strptime("12H00", "%HH%M"))]
# it is possible to load detailed production and consumption data within the object (in the power_datas attribute)
await api.async_load()
print(api.power_datas)
# and refresh datas load.
await api.async_refresh()
# Analytics data convert
resultat = analytics.get_data_analytcis(
convertKwh=True,
convertUTC=True,
intervals=offpeak_intervals,
groupby="date",
summary=True,
)
offpeak = analytics.set_price(resultat[0], 0.1641, True)
normal = analytics.set_price(resultat[1], 0.18, True)
print(offpeak)
print(normal)
await api.async_close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Have a look at the example.py for a more complete overview.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
myelectricaldatapy-1.3.6.tar.gz
(23.5 kB
view details)
Built Distribution
File details
Details for the file myelectricaldatapy-1.3.6.tar.gz
.
File metadata
- Download URL: myelectricaldatapy-1.3.6.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edfef466eaa78a7d95817448c1327fa6f6a0ebd1ec2d83a7aa219296af2cf3d2 |
|
MD5 | f96f0fe2bb34131a59ac8e4386857b86 |
|
BLAKE2b-256 | 3a241d459f6d038f388d99b0d0930f2de1061efa073ca1e09bfaad46861b50e4 |
File details
Details for the file myelectricaldatapy-1.3.6-py3-none-any.whl
.
File metadata
- Download URL: myelectricaldatapy-1.3.6-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb972d06741e2940da7d388d531f732a6e713a7eabdb6a5744f16a4b0b78ce8c |
|
MD5 | 37b3f7fda3fbf98e5df98db6ddbeb118 |
|
BLAKE2b-256 | b999f6f0aaa3394b02ab8efe71ba329e6b5947391b1e4d51a42ae1cb64d10537 |