# myelectricaldatapy
Fetch date Enedis Linky from myelectricaldata.fr (enedisgateway.tech)
## Install
Use the PIP package manager
```bash
$ pip install myelectricaldatapy
```
Or manually download and install the last version from github
```bash
$ 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.
## Get started
```python
# 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](https://github.com/cyr-ius/myelectricaldatapy/blob/master/example.py) for a more complete overview.
Raw data
{
"_id": null,
"home_page": null,
"name": "myelectricaldatapy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10.0",
"maintainer_email": null,
"keywords": "enedis, linky, async, myelectricaldata",
"author": null,
"author_email": "Cyr-ius <cyr-ius@ipocus.net>",
"download_url": "https://files.pythonhosted.org/packages/f1/62/270059d99458a845bfd05ff9b68e41015e28ee379e34dcb008ef339c2556/myelectricaldatapy-2.2.4.tar.gz",
"platform": null,
"description": "# myelectricaldatapy\n\nFetch date Enedis Linky from myelectricaldata.fr (enedisgateway.tech)\n\n## Install\n\nUse the PIP package manager\n\n```bash\n$ pip install myelectricaldatapy\n```\n\nOr manually download and install the last version from github\n\n```bash\n$ git clone https://github.com/cyr-ius/myelectricaldatapy.git\n$ python setup.py install\n```\n\n## Attributes\n\n- tempo_day : RED/WHITE/BLUE\n- ecowatt : Information Dictionary\n- power_Data: Data\n\n## Methods\n\n- async_get_max_power (start: datetime, end: datetime) Return: max power\n- async_get_details_production (start: datetime, end: datetime) Return: details production (max 7days)\n- async_get_details_consumption (start: datetime, end: datetime) Return: details consumption (max 7days)\n- async_get_daily_production (day: datetime, end: datetime) Return: production (max 1095 days)\n- async_get_daily_consumption (start: datetime, end: datetime) Return: consumption (max 1095 days)\n- async_get_identity Return: Data identity\n- async_check_offpeak (start: datetime) : check if datetime in range offpeak\n- async_has_offpeak Return boolean if offpeak detected\n- async_get_ecowatt Return: ecowatt information\n- async_get_tempoday Return: Tempo day (RED/WHITE/BLUE)\n- async_get_address Return address\n- async_get_contract Return contact\n- async_valid_access Return information access from mylelectricaldata\n- async_load (start: datetime, end: datetime) Return None - Load Data in power_Data attribute\n- async_refresh Return None - Refresh power_Data , tempo_day and ecowatt attributes.\n\n## Get started\n\n```python\n# Import the myelectricaldatapy package.\nfrom myelectricaldatapy import EnedisByPDL,EnedisAnalytics\n\nTOKEN=\"012345\"\nPDL=\"012345012345\"\n\nasync def main():\n api = EnedisByPDL(token=TOKEN, pdl=PDL)\n\n print(await api.async_get_contract())\n print(await api.async_get_address())\n\n start = datetime.now() - timedelta(days=7)\n end = datetime.now()\n Data = await api.async_get_details_consumption(start,end)\n print(Data)\n\n analytics = EnedisAnalytics(Data)\n offpeak_intervals = [(dt.strptime(\"08H00\", \"%HH%M\"), dt.strptime(\"12H00\", \"%HH%M\"))]\n\n # it is possible to load detailed production and consumption data within the object (in the power_Data attribute)\n await api.async_load()\n print(api.power_Data)\n # and refresh Data load.\n await api.async_refresh()\n\n # Analytics data convert\n resultat = analytics.get_data_analytics(\n convertKwh=True,\n convertUTC=True,\n intervals=offpeak_intervals,\n groupby=\"date\",\n summary=True,\n )\n\n offpeak = analytics.set_price(resultat[0], 0.1641, True)\n normal = analytics.set_price(resultat[1], 0.18, True)\n\n print(offpeak)\n print(normal)\n\n\n\n await api.async_close()\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n\nHave a look at the [example.py](https://github.com/cyr-ius/myelectricaldatapy/blob/master/example.py) for a more complete overview.\n",
"bugtrack_url": null,
"license": "GPL-3",
"summary": "Fetch Linky data from myelectricaldata.fr",
"version": "2.2.4",
"project_urls": {
"Homepage": "https://github.com/cyr-ius/myelectricaldatapy"
},
"split_keywords": [
"enedis",
" linky",
" async",
" myelectricaldata"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b97a1d2f84c1f59007c7b6d2255e203ee296758a54120acd695278f3a71b7896",
"md5": "ef5eaea9252a3d3ea0735b6249640fbf",
"sha256": "7961fa1a98f11181830fecd1dca0b679db28346d18d3177b9b8cf0c87ed2b107"
},
"downloads": -1,
"filename": "myelectricaldatapy-2.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ef5eaea9252a3d3ea0735b6249640fbf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10.0",
"size": 24477,
"upload_time": "2024-12-11T09:26:24",
"upload_time_iso_8601": "2024-12-11T09:26:24.462379Z",
"url": "https://files.pythonhosted.org/packages/b9/7a/1d2f84c1f59007c7b6d2255e203ee296758a54120acd695278f3a71b7896/myelectricaldatapy-2.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f162270059d99458a845bfd05ff9b68e41015e28ee379e34dcb008ef339c2556",
"md5": "f0f610020ef6d5d13245d682a3507709",
"sha256": "762d9630b20869e7d0ab9fecbb5d69f8864d16f002d9c8c69f52a26cc6cdcf26"
},
"downloads": -1,
"filename": "myelectricaldatapy-2.2.4.tar.gz",
"has_sig": false,
"md5_digest": "f0f610020ef6d5d13245d682a3507709",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10.0",
"size": 35960,
"upload_time": "2024-12-11T09:26:26",
"upload_time_iso_8601": "2024-12-11T09:26:26.977445Z",
"url": "https://files.pythonhosted.org/packages/f1/62/270059d99458a845bfd05ff9b68e41015e28ee379e34dcb008ef339c2556/myelectricaldatapy-2.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 09:26:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cyr-ius",
"github_project": "myelectricaldatapy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
">=",
"3.8.1"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"2.0.2"
]
]
},
{
"name": "voluptuous",
"specs": [
[
">=",
"0.13.1"
]
]
}
],
"lcname": "myelectricaldatapy"
}