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
Attributes
- tempo_day : RED/WHITE/BLUE
- ecowatt : Information Dictionary
- power_Data: Data
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: Data 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 Data in power_Data attribute
- async_refresh Return None - Refresh power_Data , tempo_day and ecowatt attributes.
Timezone
Enedis/RTE APIs return naive timestamps that represent local wall-clock time. This library needs to know which timezone that is in order to compute things like off-peak hours or hourly statistics correctly.
By default it falls back to the timezone of the host machine running the code
(/etc/localtime), but that has no reason to match the timezone your
application is actually configured for (e.g. Home Assistant's
hass.config.time_zone). Pass it explicitly to avoid a fixed-offset shift in
the reported times:
api = EnedisByPDL(token=TOKEN, pdl=PDL, timezone=ZoneInfo("Europe/Paris"))
Alternatively, set it once globally for every instance:
from myelectricaldatapy import set_local_timezone
set_local_timezone(ZoneInfo("Europe/Paris"))
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()
Data = await api.async_get_details_consumption(start,end)
print(Data)
analytics = EnedisAnalytics(Data)
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_Data attribute)
await api.async_load()
print(api.power_Data)
# and refresh Data load.
await api.async_refresh()
# Analytics data convert
resultat = analytics.get_data_analytics(
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.
Release files for myelectricaldatapy 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| myelectricaldatapy-2.3.1.tar.gz | 106.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myelectricaldatapy-2.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 134.6 kB
Release files / myelectricaldatapy-2.3.1.tar.gz
| Download URL | myelectricaldatapy-2.3.1.tar.gz |
|---|---|
| Size | 106.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70401542e84dca7d1164b558f6aeffc76eff09dc98d851c785dc52e91cbf0f1b
|
|
BLAKE2b-256 checksum How to use checksums |
6a74c0634dae3379fb6cd714edb5d8278f836e829ef17c329d55e39e3d442fed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency logRelease files / myelectricaldatapy-2.3.1-py3-none-any.whl
| Download URL | myelectricaldatapy-2.3.1-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
857a256ec52c0a6b595c71816f37a49728c2e4e2c83d788effe22ef687050078
|
|
BLAKE2b-256 checksum How to use checksums |
0bdbf26d056462dd8cccb5fa42597d6119cd81cb9bcdbbcac56c1911cb824c7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency log