myelectricaldatapy 2.4.3__tar.gz → 2.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/PKG-INFO +1 -1
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/mypdl.py +5 -12
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/types.py +10 -1
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/PKG-INFO +1 -1
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/scm_version.json +2 -2
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/test_analytics.py +7 -2
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/test_load_data.py +10 -10
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.devcontainer/devcontainer-lock.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.devcontainer/devcontainer.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.github/dependabot.yml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.github/workflows/auto-approve.yml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.github/workflows/python-lint.yml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.github/workflows/python-publish.yml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.github/workflows/release.yml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.gitignore +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.pre-commit-config.yaml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/.vscode/settings.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/LICENSE +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/README.md +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/_secrets.yaml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/example.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/__init__.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/analytics.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/api.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/auth.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/const.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/exceptions.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/py.typed +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy/tz.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/SOURCES.txt +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/dependency_links.txt +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/requires.txt +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/scm_file_list.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/top_level.txt +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/pyproject.toml +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/setup.cfg +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/__init__.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/conftest.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/consts.py +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/access.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/address.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/contract.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/daily.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/detail.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/ecowatt.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/identity.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/invalid_access.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/tests/fixtures/tempo.json +0 -0
- {myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/uv.lock +0 -0
|
@@ -17,21 +17,16 @@ from .const import (
|
|
|
17
17
|
ATTR_CUM_VALUE,
|
|
18
18
|
ATTR_END,
|
|
19
19
|
ATTR_FN,
|
|
20
|
-
ATTR_HPHC,
|
|
21
20
|
ATTR_INTERVALS,
|
|
22
21
|
ATTR_PRICE,
|
|
23
22
|
ATTR_PRICES,
|
|
24
23
|
ATTR_PROD,
|
|
25
|
-
ATTR_STANDARD,
|
|
26
24
|
ATTR_START,
|
|
27
|
-
ATTR_TEMPO,
|
|
28
25
|
CONF_VALUE,
|
|
29
26
|
DAILY_CONSUM,
|
|
30
27
|
DAILY_PROD,
|
|
31
|
-
DEFAULT_SUBSCRIPTION,
|
|
32
28
|
DETAIL_CONSUM,
|
|
33
29
|
DETAIL_PROD,
|
|
34
|
-
SUBSCRIPTIONS,
|
|
35
30
|
)
|
|
36
31
|
from .exceptions import EnedisException, LimitReached
|
|
37
32
|
from .types import (
|
|
@@ -74,7 +69,7 @@ class EnedisByPDL:
|
|
|
74
69
|
self,
|
|
75
70
|
pdl: str,
|
|
76
71
|
token: str,
|
|
77
|
-
subscription: Subscription =
|
|
72
|
+
subscription: Subscription = Subscription.STANDARD,
|
|
78
73
|
session: ClientSession | None = None,
|
|
79
74
|
timeout: int = 30,
|
|
80
75
|
timezone: _tzinfo | None = None,
|
|
@@ -94,9 +89,7 @@ class EnedisByPDL:
|
|
|
94
89
|
self._ecowatt_subs: bool = False
|
|
95
90
|
self._maxpower_subs: bool = False
|
|
96
91
|
self._params: dict[Mode, dict[str, Any]] = {}
|
|
97
|
-
self.
|
|
98
|
-
subscription if subscription in SUBSCRIPTIONS else DEFAULT_SUBSCRIPTION
|
|
99
|
-
)
|
|
92
|
+
self.subscription: Subscription = subscription
|
|
100
93
|
self.access: AccessResponse | None = None
|
|
101
94
|
self.address: UsagePoint | None = None
|
|
102
95
|
self.contract: Contract | None = None
|
|
@@ -128,17 +121,17 @@ class EnedisByPDL:
|
|
|
128
121
|
@property
|
|
129
122
|
def has_tempo_subscription(self) -> bool:
|
|
130
123
|
"""Tempo subscription status."""
|
|
131
|
-
return self.
|
|
124
|
+
return self.subscription == Subscription.TEMPO
|
|
132
125
|
|
|
133
126
|
@property
|
|
134
127
|
def has_offpeak_hours_subscription(self) -> bool:
|
|
135
128
|
"""Offpeak hours subscription status."""
|
|
136
|
-
return self.
|
|
129
|
+
return self.subscription == Subscription.HPHC
|
|
137
130
|
|
|
138
131
|
@property
|
|
139
132
|
def has_standard_subscription(self) -> bool:
|
|
140
133
|
"""Offpeak hours subscription status."""
|
|
141
|
-
return self.
|
|
134
|
+
return self.subscription == Subscription.STANDARD
|
|
142
135
|
|
|
143
136
|
@property
|
|
144
137
|
def has_ecowatt_subscription(self) -> bool:
|
|
@@ -10,11 +10,12 @@ payloads coming from the API::
|
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from datetime import datetime
|
|
13
|
+
from enum import IntFlag
|
|
13
14
|
from typing import Annotated, Any, Literal
|
|
14
15
|
|
|
15
16
|
from pydantic import AfterValidator, BaseModel, ConfigDict, TypeAdapter, model_validator
|
|
16
17
|
|
|
17
|
-
type Subscription = Literal["hphc", "tempo", "standard"]
|
|
18
|
+
# type Subscription = Literal["hphc", "tempo", "standard"]
|
|
18
19
|
type ProductionCollect = Literal["production_load_curve", "daily_production"]
|
|
19
20
|
type ConsumptionCollect = Literal["consumption_load_curve", "daily_consumption"]
|
|
20
21
|
type EnergyCollect = ProductionCollect | ConsumptionCollect
|
|
@@ -226,6 +227,14 @@ class TempoDays(_ApiModel):
|
|
|
226
227
|
red: int = 0
|
|
227
228
|
|
|
228
229
|
|
|
230
|
+
class Subscription(IntFlag):
|
|
231
|
+
"""Subscription."""
|
|
232
|
+
|
|
233
|
+
STANDARD = 1
|
|
234
|
+
HPHC = 2
|
|
235
|
+
TEMPO = 4
|
|
236
|
+
|
|
237
|
+
|
|
229
238
|
def _check_iso_date(value: str) -> str:
|
|
230
239
|
"""Ensure a mapping key is a real, zero-padded ``YYYY-MM-DD`` calendar date."""
|
|
231
240
|
try:
|
|
@@ -14,6 +14,7 @@ from myelectricaldatapy import (
|
|
|
14
14
|
DETAIL_CONSUM,
|
|
15
15
|
EnedisByPDL,
|
|
16
16
|
LimitReached,
|
|
17
|
+
Subscription,
|
|
17
18
|
)
|
|
18
19
|
from myelectricaldatapy.tz import LOCAL_TIMEZONE
|
|
19
20
|
|
|
@@ -235,7 +236,9 @@ async def test_hphc_cumsum_range(mock_enedis: Mock, session) -> None: # pylint:
|
|
|
235
236
|
@freeze_time("2023-3-1")
|
|
236
237
|
async def test_tempo_detail_comsumption(mock_enedis: Mock, session) -> None:
|
|
237
238
|
"""Test tempo pricings."""
|
|
238
|
-
api = EnedisByPDL(
|
|
239
|
+
api = EnedisByPDL(
|
|
240
|
+
pdl=PDL, token=TOKEN, session=session, subscription=Subscription.TEMPO
|
|
241
|
+
)
|
|
239
242
|
api.set_data_fetch(
|
|
240
243
|
DETAIL_CONSUM,
|
|
241
244
|
intervals=OFFPEAK_INTERVALS,
|
|
@@ -255,7 +258,9 @@ async def test_tempo_detail_comsumption(mock_enedis: Mock, session) -> None:
|
|
|
255
258
|
@freeze_time("2023-3-1")
|
|
256
259
|
async def test_tempo_detail_comsumption_with_price(mock_enedis: Mock, session) -> None:
|
|
257
260
|
"""Test tempo pricings."""
|
|
258
|
-
api = EnedisByPDL(
|
|
261
|
+
api = EnedisByPDL(
|
|
262
|
+
pdl=PDL, token=TOKEN, session=session, subscription=Subscription.TEMPO
|
|
263
|
+
)
|
|
259
264
|
api.set_data_fetch(
|
|
260
265
|
DETAIL_CONSUM,
|
|
261
266
|
prices=TEMPO_PRICE,
|
|
@@ -15,6 +15,7 @@ from myelectricaldatapy import (
|
|
|
15
15
|
EnedisByPDL,
|
|
16
16
|
EnedisException,
|
|
17
17
|
LimitReached,
|
|
18
|
+
Subscription,
|
|
18
19
|
)
|
|
19
20
|
from myelectricaldatapy.tz import LOCAL_TIMEZONE
|
|
20
21
|
|
|
@@ -24,17 +25,12 @@ from .consts import PDL, TOKEN
|
|
|
24
25
|
@freeze_time("2023-01-23")
|
|
25
26
|
async def test_subscription(mock_enedis: Mock, session) -> None:
|
|
26
27
|
"""Test subscription compute."""
|
|
27
|
-
api = EnedisByPDL(
|
|
28
|
+
api = EnedisByPDL(
|
|
29
|
+
pdl=PDL, token=TOKEN, session=session, subscription=Subscription.HPHC
|
|
30
|
+
)
|
|
28
31
|
assert api.has_offpeak_hours_subscription is True
|
|
29
32
|
|
|
30
33
|
|
|
31
|
-
@freeze_time("2023-01-23")
|
|
32
|
-
async def test_subscription_error(mock_enedis: Mock, session) -> None:
|
|
33
|
-
"""Test subscription msiconfiguration value."""
|
|
34
|
-
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="toto")
|
|
35
|
-
assert api.has_standard_subscription is True
|
|
36
|
-
|
|
37
|
-
|
|
38
34
|
@freeze_time("2023-01-23")
|
|
39
35
|
async def test_address(mock_enedis: Mock, session) -> None:
|
|
40
36
|
"""Test subscription compute."""
|
|
@@ -92,7 +88,9 @@ async def test_tempoday(mock_enedis: Mock, session) -> None:
|
|
|
92
88
|
resultat = await api.async_get_tempo()
|
|
93
89
|
assert resultat["2023-03-01"] == "blue"
|
|
94
90
|
|
|
95
|
-
mypdl = EnedisByPDL(
|
|
91
|
+
mypdl = EnedisByPDL(
|
|
92
|
+
pdl=PDL, token=TOKEN, session=session, subscription=Subscription.TEMPO
|
|
93
|
+
)
|
|
96
94
|
mypdl.set_data_fetch(DETAIL_CONSUM)
|
|
97
95
|
await mypdl.async_update()
|
|
98
96
|
resultat = mypdl.stats["consumption"]
|
|
@@ -102,7 +100,9 @@ async def test_tempoday(mock_enedis: Mock, session) -> None:
|
|
|
102
100
|
@freeze_time("2023-3-3")
|
|
103
101
|
async def test_tempo_infos(mock_enedis: Mock, session) -> None:
|
|
104
102
|
"""Test get tempo day."""
|
|
105
|
-
api = EnedisByPDL(
|
|
103
|
+
api = EnedisByPDL(
|
|
104
|
+
pdl=PDL, token=TOKEN, session=session, subscription=Subscription.TEMPO
|
|
105
|
+
)
|
|
106
106
|
await api.async_update()
|
|
107
107
|
assert api.tempo_days.red == 5
|
|
108
108
|
assert api.tempo_prices.standard.blue == 0.1654
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/requires.txt
RENAMED
|
File without changes
|
{myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
{myelectricaldatapy-2.4.3 → myelectricaldatapy-2.4.4}/myelectricaldatapy.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|