# 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/20/39/7a5025f7e4670dbf2766672ab0ec23e790e28eec48be83cfa09b037fcaa5/myelectricaldatapy-2.2.3.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.3",
"project_urls": null,
"split_keywords": [
"enedis",
" linky",
" async",
" myelectricaldata"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0ee01bdc1bb29dddbd29f85b7cd66e70a5bfa7366e1946d77ad3d12a3bce6367",
"md5": "65fdec873a56096faa3f69a70d818efb",
"sha256": "c29bdeb9136885804170159de59e8de32c8b1ae02c0a9c8f2738acd7de03c683"
},
"downloads": -1,
"filename": "myelectricaldatapy-2.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65fdec873a56096faa3f69a70d818efb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10.0",
"size": 24028,
"upload_time": "2024-06-03T06:39:55",
"upload_time_iso_8601": "2024-06-03T06:39:55.474829Z",
"url": "https://files.pythonhosted.org/packages/0e/e0/1bdc1bb29dddbd29f85b7cd66e70a5bfa7366e1946d77ad3d12a3bce6367/myelectricaldatapy-2.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20397a5025f7e4670dbf2766672ab0ec23e790e28eec48be83cfa09b037fcaa5",
"md5": "fcf3cff05b31cc98daa13393360c1d24",
"sha256": "ff73d7ffe4ccab942a6b328f2482ab571ab298d3e274cdbe8e6a21e3daf25854"
},
"downloads": -1,
"filename": "myelectricaldatapy-2.2.3.tar.gz",
"has_sig": false,
"md5_digest": "fcf3cff05b31cc98daa13393360c1d24",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10.0",
"size": 35274,
"upload_time": "2024-06-03T06:39:58",
"upload_time_iso_8601": "2024-06-03T06:39:58.689692Z",
"url": "https://files.pythonhosted.org/packages/20/39/7a5025f7e4670dbf2766672ab0ec23e790e28eec48be83cfa09b037fcaa5/myelectricaldatapy-2.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-03 06:39:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "myelectricaldatapy"
}