e-data 1.2.2__tar.gz → 1.2.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.
- {e-data-1.2.2/e_data.egg-info → e-data-1.2.4}/PKG-INFO +1 -1
- {e-data-1.2.2 → e-data-1.2.4/e_data.egg-info}/PKG-INFO +1 -1
- {e-data-1.2.2 → e-data-1.2.4}/edata/definitions.py +1 -1
- {e-data-1.2.2 → e-data-1.2.4}/edata/helpers.py +22 -2
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/billing.py +18 -12
- {e-data-1.2.2 → e-data-1.2.4}/setup.py +1 -1
- {e-data-1.2.2 → e-data-1.2.4}/LICENSE +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/MANIFEST.in +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/README.md +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/e_data.egg-info/SOURCES.txt +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/e_data.egg-info/dependency_links.txt +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/e_data.egg-info/requires.txt +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/e_data.egg-info/top_level.txt +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/__init__.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/connectors/__init__.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/connectors/datadis.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/connectors/redata.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/const.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/__init__.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/base.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/consumption.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/maximeter.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/processors/utils.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/edata/storage.py +0 -0
- {e-data-1.2.2 → e-data-1.2.4}/setup.cfg +0 -0
|
@@ -110,7 +110,7 @@ ConsumptionSchema = vol.Schema(
|
|
|
110
110
|
vol.Required("datetime"): dt.datetime,
|
|
111
111
|
vol.Required("delta_h"): vol.Coerce(float),
|
|
112
112
|
vol.Required("value_kWh"): vol.Coerce(float),
|
|
113
|
-
vol.Optional("surplus_kWh", default=0): vol.Coerce(float),
|
|
113
|
+
vol.Optional("surplus_kWh", default=0): vol.Union(vol.Coerce(float), None),
|
|
114
114
|
vol.Required("real"): bool,
|
|
115
115
|
}
|
|
116
116
|
)
|
|
@@ -11,7 +11,14 @@ from .connectors.datadis import DatadisConnector
|
|
|
11
11
|
from .connectors.redata import REDataConnector
|
|
12
12
|
from .definitions import ATTRIBUTES, EdataData, PricingRules
|
|
13
13
|
from .processors import utils
|
|
14
|
-
from .processors.billing import
|
|
14
|
+
from .processors.billing import (
|
|
15
|
+
BillingInput,
|
|
16
|
+
BillingProcessor,
|
|
17
|
+
DEFAULT_BILLING_ENERGY_FORMULA,
|
|
18
|
+
DEFAULT_BILLING_OTHERS_FORMULA,
|
|
19
|
+
DEFAULT_BILLING_POWER_FORMULA,
|
|
20
|
+
DEFAULT_BILLING_SURPLUS_FORMULA,
|
|
21
|
+
)
|
|
15
22
|
from .processors.consumption import ConsumptionProcessor
|
|
16
23
|
from .processors.maximeter import MaximeterProcessor
|
|
17
24
|
from .storage import check_storage_integrity, load_storage, dump_storage
|
|
@@ -31,6 +38,10 @@ class EdataHelper:
|
|
|
31
38
|
cups: str,
|
|
32
39
|
datadis_authorized_nif: str | None = None,
|
|
33
40
|
pricing_rules: PricingRules | None = None,
|
|
41
|
+
billing_energy_formula: str = DEFAULT_BILLING_ENERGY_FORMULA,
|
|
42
|
+
billing_power_formula: str = DEFAULT_BILLING_POWER_FORMULA,
|
|
43
|
+
billing_others_formula: str = DEFAULT_BILLING_OTHERS_FORMULA,
|
|
44
|
+
billing_surplus_formula: str = DEFAULT_BILLING_SURPLUS_FORMULA,
|
|
34
45
|
storage_dir_path: str | None = None,
|
|
35
46
|
data: EdataData | None = None,
|
|
36
47
|
) -> None:
|
|
@@ -46,11 +57,16 @@ class EdataHelper:
|
|
|
46
57
|
cost_daily_sum=[],
|
|
47
58
|
cost_monthly_sum=[],
|
|
48
59
|
)
|
|
60
|
+
self._billing_energy_formula = billing_energy_formula
|
|
61
|
+
self._billing_power_formula = billing_power_formula
|
|
62
|
+
self._billing_others_formula = billing_others_formula
|
|
63
|
+
self._billing_surplus_formula = billing_surplus_formula
|
|
64
|
+
|
|
49
65
|
self.attributes = {}
|
|
50
66
|
self._storage_dir = storage_dir_path
|
|
51
67
|
self._cups = cups
|
|
52
68
|
self._authorized_nif = datadis_authorized_nif
|
|
53
|
-
self.last_update = {x: datetime(1970, 1, 1) for x in self.data
|
|
69
|
+
self.last_update = {x: datetime(1970, 1, 1) for x in self.data}
|
|
54
70
|
self._date_from = datetime(1970, 1, 1)
|
|
55
71
|
self._date_to = datetime.today()
|
|
56
72
|
self._must_dump = True
|
|
@@ -607,6 +623,10 @@ class EdataHelper:
|
|
|
607
623
|
if self.is_pvpc
|
|
608
624
|
else None,
|
|
609
625
|
rules=self.pricing_rules,
|
|
626
|
+
energy_formula=self._billing_energy_formula,
|
|
627
|
+
power_formula=self._billing_power_formula,
|
|
628
|
+
others_formula=self._billing_others_formula,
|
|
629
|
+
surplus_formula=self._billing_surplus_formula,
|
|
610
630
|
)
|
|
611
631
|
)
|
|
612
632
|
month_starts = datetime(
|
|
@@ -23,10 +23,12 @@ from ..processors.base import Processor
|
|
|
23
23
|
|
|
24
24
|
_LOGGER = logging.getLogger(__name__)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
DEFAULT_BILLING_ENERGY_FORMULA = "electricity_tax * iva_tax * kwh_eur * kwh"
|
|
27
|
+
DEFAULT_BILLING_POWER_FORMULA = "electricity_tax * iva_tax * (p1_kw * (p1_kw_year_eur + market_kw_year_eur) + p2_kw * p2_kw_year_eur) / 365 / 24"
|
|
28
|
+
DEFAULT_BILLING_OTHERS_FORMULA = "iva_tax * meter_month_eur / 30 / 24"
|
|
29
|
+
DEFAULT_BILLING_SURPLUS_FORMULA = (
|
|
30
|
+
"electricity_tax * iva_tax * [surplus_kwh, kwh]|min * surplus_kwh_eur"
|
|
31
|
+
)
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
class BillingOutput(TypedDict):
|
|
@@ -62,16 +64,16 @@ class BillingProcessor(Processor):
|
|
|
62
64
|
),
|
|
63
65
|
voluptuous.Required("rules"): PricingRulesSchema,
|
|
64
66
|
voluptuous.Optional(
|
|
65
|
-
"energy_formula", default=
|
|
67
|
+
"energy_formula", default=DEFAULT_BILLING_ENERGY_FORMULA
|
|
66
68
|
): str,
|
|
67
69
|
voluptuous.Optional(
|
|
68
|
-
"power_formula", default=
|
|
70
|
+
"power_formula", default=DEFAULT_BILLING_POWER_FORMULA
|
|
69
71
|
): str,
|
|
70
72
|
voluptuous.Optional(
|
|
71
|
-
"others_formula", default=
|
|
73
|
+
"others_formula", default=DEFAULT_BILLING_OTHERS_FORMULA
|
|
72
74
|
): str,
|
|
73
75
|
voluptuous.Optional(
|
|
74
|
-
"surplus_formula", default=
|
|
76
|
+
"surplus_formula", default=DEFAULT_BILLING_SURPLUS_FORMULA
|
|
75
77
|
): str,
|
|
76
78
|
}
|
|
77
79
|
)
|
|
@@ -79,7 +81,11 @@ class BillingProcessor(Processor):
|
|
|
79
81
|
|
|
80
82
|
# joint data by datetime
|
|
81
83
|
_data = {
|
|
82
|
-
x["datetime"]: {
|
|
84
|
+
x["datetime"]: {
|
|
85
|
+
"datetime": x["datetime"],
|
|
86
|
+
"kwh": x["value_kWh"],
|
|
87
|
+
"surplus_kwh": x["surplus_kWh"] if x["surplus_kWh"] is not None else 0,
|
|
88
|
+
}
|
|
83
89
|
for x in self._input["consumptions"]
|
|
84
90
|
}
|
|
85
91
|
|
|
@@ -129,7 +135,7 @@ class BillingProcessor(Processor):
|
|
|
129
135
|
|
|
130
136
|
if x["kwh_eur"] is None:
|
|
131
137
|
continue
|
|
132
|
-
|
|
138
|
+
|
|
133
139
|
if tariff == "p1":
|
|
134
140
|
x["surplus_kwh_eur"] = x["surplus_p1_kwh_eur"]
|
|
135
141
|
elif tariff == "p2":
|
|
@@ -137,7 +143,6 @@ class BillingProcessor(Processor):
|
|
|
137
143
|
elif tariff == "p3":
|
|
138
144
|
x["surplus_kwh_eur"] = x["surplus_p3_kwh_eur"]
|
|
139
145
|
|
|
140
|
-
|
|
141
146
|
new_item = PricingAggData(
|
|
142
147
|
datetime=x["datetime"],
|
|
143
148
|
energy_term=round(energy_expr(**x), 3),
|
|
@@ -151,7 +156,8 @@ class BillingProcessor(Processor):
|
|
|
151
156
|
new_item["value_eur"] = round(
|
|
152
157
|
new_item["energy_term"]
|
|
153
158
|
+ new_item["power_term"]
|
|
154
|
-
+ new_item["others_term"]
|
|
159
|
+
+ new_item["others_term"]
|
|
160
|
+
- new_item["surplus_term"],
|
|
155
161
|
3,
|
|
156
162
|
)
|
|
157
163
|
|
|
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
|