myelectricaldatapy 2.4.5__tar.gz → 2.4.7__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.5 → myelectricaldatapy-2.4.7}/PKG-INFO +2 -2
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/README.md +1 -1
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/mypdl.py +37 -17
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/types.py +23 -3
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/PKG-INFO +2 -2
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/scm_version.json +2 -2
- myelectricaldatapy-2.4.7/tests/fixtures/tempo.json +1 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/test_analytics.py +17 -17
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/test_load_data.py +1 -1
- myelectricaldatapy-2.4.5/tests/fixtures/tempo.json +0 -1
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.devcontainer/devcontainer-lock.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.devcontainer/devcontainer.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.github/dependabot.yml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.github/workflows/auto-approve.yml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.github/workflows/python-lint.yml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.github/workflows/python-publish.yml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.github/workflows/release.yml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.gitignore +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.pre-commit-config.yaml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/.vscode/settings.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/LICENSE +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/_secrets.yaml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/example.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/__init__.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/analytics.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/api.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/auth.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/const.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/exceptions.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/py.typed +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy/tz.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/SOURCES.txt +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/dependency_links.txt +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/requires.txt +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/scm_file_list.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/top_level.txt +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/pyproject.toml +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/setup.cfg +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/__init__.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/conftest.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/consts.py +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/access.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/address.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/contract.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/daily.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/detail.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/ecowatt.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/identity.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/tests/fixtures/invalid_access.json +0 -0
- {myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: myelectricaldatapy
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.7
|
|
4
4
|
Summary: Fetch Linky data from myelectricaldata.fr
|
|
5
5
|
Author-email: Cyr-ius <cyr-ius@ipocus.net>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -120,7 +120,7 @@ Workflow:
|
|
|
120
120
|
| `set_ecowatt_subscription(activate=False)` | Enable Ecowatt retrieval |
|
|
121
121
|
| `set_maxpower_subscription(activate=False)` | Enable max power retrieval |
|
|
122
122
|
| `async_update(force_refresh=False)` | Refresh access, contract, address, tempo, ecowatt, collects |
|
|
123
|
-
| `
|
|
123
|
+
| `_async_fetch_data()` | Refresh only the registered collects |
|
|
124
124
|
| `stats` | `dict` keyed by mode (`"consumption"` / `"production"`) with the computed analytics |
|
|
125
125
|
| `access`, `contract`, `address`, `ecowatt`, `max_power`, `tempo`, `tempo_days`, `tempo_prices` | Last fetched models |
|
|
126
126
|
| `is_connected`, `has_intervals`, `has_tempo_subscription`, `has_offpeak_hours_subscription`, `has_standard_subscription`, `has_ecowatt_subscription`, `has_maxpower_subscription` | Boolean state |
|
|
@@ -85,7 +85,7 @@ Workflow:
|
|
|
85
85
|
| `set_ecowatt_subscription(activate=False)` | Enable Ecowatt retrieval |
|
|
86
86
|
| `set_maxpower_subscription(activate=False)` | Enable max power retrieval |
|
|
87
87
|
| `async_update(force_refresh=False)` | Refresh access, contract, address, tempo, ecowatt, collects |
|
|
88
|
-
| `
|
|
88
|
+
| `_async_fetch_data()` | Refresh only the registered collects |
|
|
89
89
|
| `stats` | `dict` keyed by mode (`"consumption"` / `"production"`) with the computed analytics |
|
|
90
90
|
| `access`, `contract`, `address`, `ecowatt`, `max_power`, `tempo`, `tempo_days`, `tempo_prices` | Last fetched models |
|
|
91
91
|
| `is_connected`, `has_intervals`, `has_tempo_subscription`, `has_offpeak_hours_subscription`, `has_standard_subscription`, `has_ecowatt_subscription`, `has_maxpower_subscription` | Boolean state |
|
|
@@ -41,7 +41,6 @@ from .types import (
|
|
|
41
41
|
Prices,
|
|
42
42
|
Subscription,
|
|
43
43
|
TempoDays,
|
|
44
|
-
TempoLabels,
|
|
45
44
|
TempoMapping,
|
|
46
45
|
UsagePoint,
|
|
47
46
|
)
|
|
@@ -61,7 +60,7 @@ class EnedisByPDL:
|
|
|
61
60
|
This class allows you to obtain information specific to a connection point.
|
|
62
61
|
|
|
63
62
|
The "set_collect" function allows you to specify the collection parameters from Enedis
|
|
64
|
-
The "
|
|
63
|
+
The "_async_fetch_data" function allows you to perform the calculations
|
|
65
64
|
The result is displayed in the property: stats
|
|
66
65
|
y"""
|
|
67
66
|
|
|
@@ -88,6 +87,7 @@ class EnedisByPDL:
|
|
|
88
87
|
self._connected: bool = False
|
|
89
88
|
self._ecowatt_subs: bool = False
|
|
90
89
|
self._maxpower_subs: bool = False
|
|
90
|
+
self._convert_kwh: bool = True
|
|
91
91
|
self._params: dict[Mode, dict[str, Any]] = {}
|
|
92
92
|
self.subscription: Subscription = subscription
|
|
93
93
|
self.access: AccessResponse | None = None
|
|
@@ -101,7 +101,7 @@ class EnedisByPDL:
|
|
|
101
101
|
self._update_lock = asyncio.Lock()
|
|
102
102
|
self.last_refresh: date | None = None
|
|
103
103
|
self.max_power: DataCollect | None = None
|
|
104
|
-
self.
|
|
104
|
+
self.tempo_historics: TempoMapping | None = None
|
|
105
105
|
self.tempo_days: TempoDays | None = None
|
|
106
106
|
self.tempo_prices: Prices | None = None
|
|
107
107
|
|
|
@@ -130,7 +130,7 @@ class EnedisByPDL:
|
|
|
130
130
|
|
|
131
131
|
@property
|
|
132
132
|
def has_standard_subscription(self) -> bool:
|
|
133
|
-
"""
|
|
133
|
+
"""Standard subscription status."""
|
|
134
134
|
return self.subscription == Subscription.STANDARD
|
|
135
135
|
|
|
136
136
|
@property
|
|
@@ -150,10 +150,24 @@ class EnedisByPDL:
|
|
|
150
150
|
return self.ecowatt.get(str_date) if self.ecowatt is not None else None
|
|
151
151
|
|
|
152
152
|
@property
|
|
153
|
-
def
|
|
153
|
+
def tempo(self) -> str | None:
|
|
154
154
|
"""Tempo day."""
|
|
155
155
|
str_date = local_now().strftime("%Y-%m-%d")
|
|
156
|
-
return
|
|
156
|
+
return (
|
|
157
|
+
self.tempo_historics.get(str_date)
|
|
158
|
+
if self.tempo_historics is not None
|
|
159
|
+
else None
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def tempo_next(self) -> str | None:
|
|
164
|
+
"""Tempo next days."""
|
|
165
|
+
str_date = (local_now() + timedelta(days=1)).strftime("%Y-%m-%d")
|
|
166
|
+
return (
|
|
167
|
+
self.tempo_historics.get(str_date)
|
|
168
|
+
if self.tempo_historics is not None
|
|
169
|
+
else None
|
|
170
|
+
)
|
|
157
171
|
|
|
158
172
|
@property
|
|
159
173
|
def prod_prices(self) -> Prices | None:
|
|
@@ -173,7 +187,7 @@ class EnedisByPDL:
|
|
|
173
187
|
data = params.get("data", [])
|
|
174
188
|
analytics = EnedisAnalytics(data, timezone=self._timezone)
|
|
175
189
|
resultat = analytics.get_data_analytics(
|
|
176
|
-
convertKwh=
|
|
190
|
+
convertKwh=self._convert_kwh,
|
|
177
191
|
intervals=params.get(ATTR_INTERVALS, []),
|
|
178
192
|
groupby=True,
|
|
179
193
|
summary=True,
|
|
@@ -181,7 +195,7 @@ class EnedisByPDL:
|
|
|
181
195
|
cum_value=_dump(params.get(ATTR_CUM_VALUE)),
|
|
182
196
|
cum_price=_dump(params.get(ATTR_CUM_PRICE)),
|
|
183
197
|
start_date=params.get(ATTR_START),
|
|
184
|
-
tempo=self.
|
|
198
|
+
tempo=self.tempo_historics,
|
|
185
199
|
)
|
|
186
200
|
stats.update({mode: resultat})
|
|
187
201
|
return stats
|
|
@@ -202,6 +216,7 @@ class EnedisByPDL:
|
|
|
202
216
|
self.ecowatt = None
|
|
203
217
|
self.max_power = None
|
|
204
218
|
self.has_collected = False
|
|
219
|
+
self.tempo_historics = None
|
|
205
220
|
self.tempo_days = None
|
|
206
221
|
self.tempo_prices = None
|
|
207
222
|
|
|
@@ -249,9 +264,10 @@ class EnedisByPDL:
|
|
|
249
264
|
self.pdl, start, end
|
|
250
265
|
)
|
|
251
266
|
|
|
252
|
-
if self.
|
|
253
|
-
|
|
254
|
-
|
|
267
|
+
if self.tempo_historics is None and self.has_tempo_subscription:
|
|
268
|
+
start = local_now() - timedelta(days=1095)
|
|
269
|
+
end = local_now() + timedelta(days=1)
|
|
270
|
+
self.tempo_historics = await self._api.async_get_tempo(start, end)
|
|
255
271
|
|
|
256
272
|
if self.tempo_prices is None and self.has_tempo_subscription:
|
|
257
273
|
self.tempo_prices = await self._api.async_get_tempo_prices()
|
|
@@ -259,6 +275,10 @@ class EnedisByPDL:
|
|
|
259
275
|
if self.tempo_days is None and self.has_tempo_subscription:
|
|
260
276
|
self.tempo_days = await self._api.async_get_tempo_days()
|
|
261
277
|
|
|
278
|
+
if self.has_parameters and self.has_collected is False:
|
|
279
|
+
await self._async_fetch_data()
|
|
280
|
+
self.last_refresh = local_now()
|
|
281
|
+
|
|
262
282
|
except EnedisException as error:
|
|
263
283
|
raise error from error
|
|
264
284
|
finally:
|
|
@@ -314,6 +334,7 @@ class EnedisByPDL:
|
|
|
314
334
|
prices: Prices | Mapping[str, Any] | None = None,
|
|
315
335
|
cum_value: Cum | Mapping[str, Any] | None = None,
|
|
316
336
|
cum_price: Cum | Mapping[str, Any] | None = None,
|
|
337
|
+
convert_kwh: bool = True,
|
|
317
338
|
) -> None:
|
|
318
339
|
"""Set parameters for data fetching.
|
|
319
340
|
|
|
@@ -322,8 +343,9 @@ class EnedisByPDL:
|
|
|
322
343
|
end: date of end to collect data
|
|
323
344
|
intervals: offpeak hours range - ex: [("01:00","05:00"),("12:00","14:00")]
|
|
324
345
|
prices: price for standard interval and offpeak interval
|
|
325
|
-
cum_sum:
|
|
326
|
-
cum_price:
|
|
346
|
+
cum_sum: Cumulative kwh value of start
|
|
347
|
+
cum_price: Cumulative price of start
|
|
348
|
+
convert_kwh: whether to convert kWh to Wh
|
|
327
349
|
"""
|
|
328
350
|
funcs: dict[str, Callable[..., Any]] = {
|
|
329
351
|
DAILY_PROD: self._api.async_get_daily_production,
|
|
@@ -349,9 +371,10 @@ class EnedisByPDL:
|
|
|
349
371
|
if cum_price:
|
|
350
372
|
self._set_cumsum(mode, ATTR_PRICE, cum_price)
|
|
351
373
|
|
|
374
|
+
self._convert_kwh = convert_kwh
|
|
352
375
|
self.has_parameters = True
|
|
353
376
|
|
|
354
|
-
async def
|
|
377
|
+
async def _async_fetch_data(self) -> None:
|
|
355
378
|
"""Fetch data.
|
|
356
379
|
|
|
357
380
|
It is necessary to value the initial data via the method: set_data_fetch.
|
|
@@ -380,9 +403,6 @@ class EnedisByPDL:
|
|
|
380
403
|
}
|
|
381
404
|
)
|
|
382
405
|
|
|
383
|
-
if mode == ATTR_CONSUM and self.has_tempo_subscription:
|
|
384
|
-
self.tempo = await self._api.async_get_tempo(start, end)
|
|
385
|
-
|
|
386
406
|
self.has_collected = True
|
|
387
407
|
|
|
388
408
|
async def async_close(self) -> None:
|
|
@@ -13,14 +13,34 @@ from datetime import datetime
|
|
|
13
13
|
from enum import IntFlag
|
|
14
14
|
from typing import Annotated, Any, Literal
|
|
15
15
|
|
|
16
|
-
from pydantic import
|
|
16
|
+
from pydantic import (
|
|
17
|
+
AfterValidator,
|
|
18
|
+
BaseModel,
|
|
19
|
+
BeforeValidator,
|
|
20
|
+
ConfigDict,
|
|
21
|
+
TypeAdapter,
|
|
22
|
+
model_validator,
|
|
23
|
+
)
|
|
17
24
|
|
|
18
25
|
# type Subscription = Literal["hphc", "tempo", "standard"]
|
|
19
26
|
type ProductionCollect = Literal["production_load_curve", "daily_production"]
|
|
20
27
|
type ConsumptionCollect = Literal["consumption_load_curve", "daily_consumption"]
|
|
21
28
|
type EnergyCollect = ProductionCollect | ConsumptionCollect
|
|
22
29
|
type Mode = Literal["consumption", "production"]
|
|
23
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _lower_tempo_label(value: Any) -> Any:
|
|
33
|
+
"""Normalize case before matching the ``blue``/``white``/``red`` literals.
|
|
34
|
+
|
|
35
|
+
The RTE Tempo API returns the colour in upper case (``"BLUE"``, ...),
|
|
36
|
+
which does not match the lower-case literal used throughout the package.
|
|
37
|
+
"""
|
|
38
|
+
return value.lower() if isinstance(value, str) else value
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
type TempoLabels = Annotated[
|
|
42
|
+
Literal["blue", "white", "red"], BeforeValidator(_lower_tempo_label)
|
|
43
|
+
]
|
|
24
44
|
|
|
25
45
|
type Service = (
|
|
26
46
|
Literal[
|
|
@@ -89,7 +109,7 @@ class Prices(BaseModel):
|
|
|
89
109
|
|
|
90
110
|
|
|
91
111
|
class Cum(_InputModel):
|
|
92
|
-
"""Cumulative starting values for ``standard`` and ``offpeak`` intervals."""
|
|
112
|
+
"""Cumulative starting kwh or wh values for ``standard`` and ``offpeak`` intervals."""
|
|
93
113
|
|
|
94
114
|
standard: float
|
|
95
115
|
offpeak: float | None = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: myelectricaldatapy
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.7
|
|
4
4
|
Summary: Fetch Linky data from myelectricaldata.fr
|
|
5
5
|
Author-email: Cyr-ius <cyr-ius@ipocus.net>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -120,7 +120,7 @@ Workflow:
|
|
|
120
120
|
| `set_ecowatt_subscription(activate=False)` | Enable Ecowatt retrieval |
|
|
121
121
|
| `set_maxpower_subscription(activate=False)` | Enable max power retrieval |
|
|
122
122
|
| `async_update(force_refresh=False)` | Refresh access, contract, address, tempo, ecowatt, collects |
|
|
123
|
-
| `
|
|
123
|
+
| `_async_fetch_data()` | Refresh only the registered collects |
|
|
124
124
|
| `stats` | `dict` keyed by mode (`"consumption"` / `"production"`) with the computed analytics |
|
|
125
125
|
| `access`, `contract`, `address`, `ecowatt`, `max_power`, `tempo`, `tempo_days`, `tempo_prices` | Last fetched models |
|
|
126
126
|
| `is_connected`, `has_intervals`, `has_tempo_subscription`, `has_offpeak_hours_subscription`, `has_standard_subscription`, `has_ecowatt_subscription`, `has_maxpower_subscription` | Boolean state |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "2023-03-01": "BLUE", "2023-03-02": "RED", "2023-03-03": "BLUE" }
|
|
@@ -57,7 +57,7 @@ async def test_standard_daily_consumption_with_prices(
|
|
|
57
57
|
"""Test standard with price."""
|
|
58
58
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session)
|
|
59
59
|
api.set_data_fetch(DAILY_CONSUM, prices=STANDARD_PRICE)
|
|
60
|
-
await api.
|
|
60
|
+
await api._async_fetch_data()
|
|
61
61
|
resultat = api.stats["consumption"]
|
|
62
62
|
|
|
63
63
|
assert resultat[0]["notes"] == "standard"
|
|
@@ -69,7 +69,7 @@ async def test_standard_detail_consumption(mock_enedis: Mock, session) -> None:
|
|
|
69
69
|
"""Test standard with price."""
|
|
70
70
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session)
|
|
71
71
|
api.set_data_fetch(DETAIL_CONSUM)
|
|
72
|
-
await api.
|
|
72
|
+
await api._async_fetch_data()
|
|
73
73
|
resultat = api.stats["consumption"]
|
|
74
74
|
|
|
75
75
|
assert resultat[0]["notes"] == "standard"
|
|
@@ -83,7 +83,7 @@ async def test_standard_detail_consumption_with_prices(
|
|
|
83
83
|
"""Test standard with price."""
|
|
84
84
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session)
|
|
85
85
|
api.set_data_fetch(DETAIL_CONSUM, prices=STANDARD_PRICE)
|
|
86
|
-
await api.
|
|
86
|
+
await api._async_fetch_data()
|
|
87
87
|
resultat = api.stats["consumption"]
|
|
88
88
|
|
|
89
89
|
assert resultat[0]["notes"] == "standard"
|
|
@@ -95,7 +95,7 @@ async def test_hphc_detail_consumption(mock_enedis: Mock, session) -> None:
|
|
|
95
95
|
# Without price
|
|
96
96
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="hphc")
|
|
97
97
|
api.set_data_fetch(DETAIL_CONSUM, intervals=OFFPEAK_INTERVALS)
|
|
98
|
-
await api.
|
|
98
|
+
await api._async_fetch_data()
|
|
99
99
|
resultat = api.stats["consumption"]
|
|
100
100
|
assert resultat[27]["value"] == 1.296
|
|
101
101
|
assert resultat[28]["value"] == 0.618
|
|
@@ -106,7 +106,7 @@ async def test_hphc_detail_consumption_with_prices(mock_enedis: Mock, session) -
|
|
|
106
106
|
"""Test without offpeak , with price."""
|
|
107
107
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="hphc")
|
|
108
108
|
api.set_data_fetch(DETAIL_CONSUM, prices=HPHC_PRICE, intervals=OFFPEAK_INTERVALS)
|
|
109
|
-
await api.
|
|
109
|
+
await api._async_fetch_data()
|
|
110
110
|
resultat = api.stats["consumption"]
|
|
111
111
|
|
|
112
112
|
assert resultat[0]["notes"] == "offpeak"
|
|
@@ -119,7 +119,7 @@ async def test_hphc_detail_consumption_with_prices(mock_enedis: Mock, session) -
|
|
|
119
119
|
async def test_hphc_daily_consumption(mock_enedis: Mock, session) -> None:
|
|
120
120
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="hphc")
|
|
121
121
|
api.set_data_fetch(DAILY_CONSUM, intervals=OFFPEAK_INTERVALS)
|
|
122
|
-
await api.
|
|
122
|
+
await api._async_fetch_data()
|
|
123
123
|
resultat = api.stats["consumption"]
|
|
124
124
|
|
|
125
125
|
assert resultat[0]["value"] == 42.045
|
|
@@ -130,7 +130,7 @@ async def test_hphc_daily_consumption(mock_enedis: Mock, session) -> None:
|
|
|
130
130
|
async def test_hphc_daily_consumption_with_prices(mock_enedis: Mock, session) -> None:
|
|
131
131
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="hphc")
|
|
132
132
|
api.set_data_fetch(DAILY_CONSUM, prices=HPHC_PRICE, intervals=OFFPEAK_INTERVALS)
|
|
133
|
-
await api.
|
|
133
|
+
await api._async_fetch_data()
|
|
134
134
|
resultat = api.stats["consumption"]
|
|
135
135
|
|
|
136
136
|
assert resultat[0]["value"] == 42.045
|
|
@@ -191,7 +191,7 @@ async def test_hphc_cumsums(mock_enedis: Mock, session) -> None:
|
|
|
191
191
|
cum_value=CUMSUM_VALUE,
|
|
192
192
|
cum_price=CUMSUM_PRICE,
|
|
193
193
|
)
|
|
194
|
-
await api.
|
|
194
|
+
await api._async_fetch_data()
|
|
195
195
|
resultat = api.stats["consumption"]
|
|
196
196
|
# offpeak
|
|
197
197
|
assert resultat[0]["sum_value"] == resultat[0]["value"] + 1000
|
|
@@ -212,7 +212,7 @@ async def test_hphc_cumsum_range(mock_enedis: Mock, session) -> None: # pylint:
|
|
|
212
212
|
prices=HPHC_PRICE,
|
|
213
213
|
intervals=OFFPEAK_INTERVALS,
|
|
214
214
|
)
|
|
215
|
-
await api.
|
|
215
|
+
await api._async_fetch_data()
|
|
216
216
|
resultat = api.stats["consumption"]
|
|
217
217
|
# offpeak
|
|
218
218
|
assert resultat[0]["sum_value"] is not None
|
|
@@ -230,7 +230,7 @@ async def test_hphc_cumsum_range(mock_enedis: Mock, session) -> None: # pylint:
|
|
|
230
230
|
"myelectricaldatapy.Enedis.async_fetch_datas",
|
|
231
231
|
side_effect=[mock_enedis, LimitReached(500, {"detail": "Limit reached"})],
|
|
232
232
|
):
|
|
233
|
-
await api.
|
|
233
|
+
await api._async_fetch_data()
|
|
234
234
|
resultat = api.stats["consumption"]
|
|
235
235
|
assert resultat[0]["sum_value"] is not None
|
|
236
236
|
|
|
@@ -247,14 +247,14 @@ async def test_tempo_detail_comsumption(mock_enedis: Mock, session) -> None:
|
|
|
247
247
|
cum_value=CUMSUM_VALUE,
|
|
248
248
|
cum_price=CUMSUM_PRICE,
|
|
249
249
|
)
|
|
250
|
-
await api.
|
|
250
|
+
await api.async_update()
|
|
251
251
|
resultat = api.stats["consumption"]
|
|
252
252
|
|
|
253
253
|
assert resultat[0]["tempo"] == "blue"
|
|
254
254
|
assert resultat[0]["value"] == 1.079
|
|
255
255
|
assert resultat[0].get("sum_price") is None
|
|
256
256
|
assert resultat[0]["sum_value"] == resultat[0]["value"] + 1000
|
|
257
|
-
assert api.
|
|
257
|
+
assert api.tempo == "blue"
|
|
258
258
|
|
|
259
259
|
|
|
260
260
|
@freeze_time("2023-3-1")
|
|
@@ -270,21 +270,21 @@ async def test_tempo_detail_comsumption_with_price(mock_enedis: Mock, session) -
|
|
|
270
270
|
cum_value=CUMSUM_VALUE,
|
|
271
271
|
cum_price=CUMSUM_PRICE,
|
|
272
272
|
)
|
|
273
|
-
await api.
|
|
273
|
+
await api.async_update()
|
|
274
274
|
resultat = api.stats["consumption"]
|
|
275
275
|
|
|
276
276
|
assert resultat[0]["tempo"] == "blue"
|
|
277
277
|
assert resultat[0]["value"] == 1.079
|
|
278
278
|
assert resultat[0]["sum_price"] == resultat[0]["price"] + 75
|
|
279
279
|
assert resultat[0]["sum_value"] == resultat[0]["value"] + 1000
|
|
280
|
-
assert api.
|
|
280
|
+
assert api.tempo == "blue"
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
@freeze_time("2023-3-1")
|
|
284
284
|
async def test_production(mock_enedis: Mock, session) -> None:
|
|
285
285
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="tempo")
|
|
286
286
|
api.set_data_fetch(DAILY_PROD, intervals=OFFPEAK_INTERVALS)
|
|
287
|
-
await api.
|
|
287
|
+
await api._async_fetch_data()
|
|
288
288
|
resultat = api.stats.get("production")
|
|
289
289
|
assert resultat[0].get("tempo") is None
|
|
290
290
|
assert resultat[0].get("price") is None
|
|
@@ -296,7 +296,7 @@ async def test_production(mock_enedis: Mock, session) -> None:
|
|
|
296
296
|
async def test_production_with_price(mock_enedis: Mock, session) -> None:
|
|
297
297
|
api = EnedisByPDL(pdl=PDL, token=TOKEN, session=session, subscription="tempo")
|
|
298
298
|
api.set_data_fetch(DAILY_PROD, prices=STANDARD_PRICE, intervals=OFFPEAK_INTERVALS)
|
|
299
|
-
await api.
|
|
299
|
+
await api._async_fetch_data()
|
|
300
300
|
resultat = api.stats.get("production")
|
|
301
301
|
assert round(resultat[1].get("price", 0), 3) == 5.519
|
|
302
302
|
assert resultat[1].get("value") == 32.464
|
|
@@ -312,7 +312,7 @@ async def test_start_date(mock_enedis: Mock, session) -> None:
|
|
|
312
312
|
DETAIL_CONSUM,
|
|
313
313
|
start=dt.strptime("2023-3-7", "%Y-%m-%d").replace(tzinfo=LOCAL_TIMEZONE),
|
|
314
314
|
)
|
|
315
|
-
await api.
|
|
315
|
+
await api._async_fetch_data()
|
|
316
316
|
resultat = api.stats["consumption"]
|
|
317
317
|
assert len(resultat) == 0
|
|
318
318
|
|
|
@@ -94,7 +94,7 @@ async def test_tempoday(mock_enedis: Mock, session) -> None:
|
|
|
94
94
|
mypdl.set_data_fetch(DETAIL_CONSUM)
|
|
95
95
|
await mypdl.async_update()
|
|
96
96
|
resultat = mypdl.stats["consumption"]
|
|
97
|
-
assert mypdl.
|
|
97
|
+
assert mypdl.tempo == "blue"
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
@freeze_time("2023-3-3")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "2023-03-01": "blue", "2023-03-02": "red", "2023-03-03": "blue" }
|
|
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.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/requires.txt
RENAMED
|
File without changes
|
{myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/myelectricaldatapy.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
{myelectricaldatapy-2.4.5 → myelectricaldatapy-2.4.7}/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
|