e-data 1.2.3__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.
Files changed (25) hide show
  1. {e-data-1.2.3/e_data.egg-info → e-data-1.2.4}/PKG-INFO +1 -1
  2. {e-data-1.2.3 → e-data-1.2.4/e_data.egg-info}/PKG-INFO +1 -1
  3. {e-data-1.2.3 → e-data-1.2.4}/edata/helpers.py +22 -2
  4. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/billing.py +10 -8
  5. {e-data-1.2.3 → e-data-1.2.4}/setup.py +1 -1
  6. {e-data-1.2.3 → e-data-1.2.4}/LICENSE +0 -0
  7. {e-data-1.2.3 → e-data-1.2.4}/MANIFEST.in +0 -0
  8. {e-data-1.2.3 → e-data-1.2.4}/README.md +0 -0
  9. {e-data-1.2.3 → e-data-1.2.4}/e_data.egg-info/SOURCES.txt +0 -0
  10. {e-data-1.2.3 → e-data-1.2.4}/e_data.egg-info/dependency_links.txt +0 -0
  11. {e-data-1.2.3 → e-data-1.2.4}/e_data.egg-info/requires.txt +0 -0
  12. {e-data-1.2.3 → e-data-1.2.4}/e_data.egg-info/top_level.txt +0 -0
  13. {e-data-1.2.3 → e-data-1.2.4}/edata/__init__.py +0 -0
  14. {e-data-1.2.3 → e-data-1.2.4}/edata/connectors/__init__.py +0 -0
  15. {e-data-1.2.3 → e-data-1.2.4}/edata/connectors/datadis.py +0 -0
  16. {e-data-1.2.3 → e-data-1.2.4}/edata/connectors/redata.py +0 -0
  17. {e-data-1.2.3 → e-data-1.2.4}/edata/const.py +0 -0
  18. {e-data-1.2.3 → e-data-1.2.4}/edata/definitions.py +0 -0
  19. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/__init__.py +0 -0
  20. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/base.py +0 -0
  21. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/consumption.py +0 -0
  22. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/maximeter.py +0 -0
  23. {e-data-1.2.3 → e-data-1.2.4}/edata/processors/utils.py +0 -0
  24. {e-data-1.2.3 → e-data-1.2.4}/edata/storage.py +0 -0
  25. {e-data-1.2.3 → e-data-1.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e-data
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Home-page: https://github.com/uvejota/python-edata
6
6
  Author: VMG
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e-data
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Home-page: https://github.com/uvejota/python-edata
6
6
  Author: VMG
@@ -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 BillingInput, BillingProcessor
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.keys()}
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
- DEFAULT_ENERGY_BILLING_FORMULA = "electricity_tax * iva_tax * kwh_eur * kwh"
27
- DEFAULT_POWER_BILLING_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_OTHERS_BILLING_FORMULA = "iva_tax * meter_month_eur / 30 / 24"
29
- DEFAULT_SURPLUS_BILLING_FORMULA = "surplus_kwh * surplus_kwh_eur"
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=DEFAULT_ENERGY_BILLING_FORMULA
67
+ "energy_formula", default=DEFAULT_BILLING_ENERGY_FORMULA
66
68
  ): str,
67
69
  voluptuous.Optional(
68
- "power_formula", default=DEFAULT_POWER_BILLING_FORMULA
70
+ "power_formula", default=DEFAULT_BILLING_POWER_FORMULA
69
71
  ): str,
70
72
  voluptuous.Optional(
71
- "others_formula", default=DEFAULT_OTHERS_BILLING_FORMULA
73
+ "others_formula", default=DEFAULT_BILLING_OTHERS_FORMULA
72
74
  ): str,
73
75
  voluptuous.Optional(
74
- "surplus_formula", default=DEFAULT_SURPLUS_BILLING_FORMULA
76
+ "surplus_formula", default=DEFAULT_BILLING_SURPLUS_FORMULA
75
77
  ): str,
76
78
  }
77
79
  )
@@ -20,7 +20,7 @@ URL = "https://github.com/uvejota/python-edata"
20
20
  EMAIL = "vmayorg@outlook.es"
21
21
  AUTHOR = "VMG"
22
22
  REQUIRES_PYTHON = ">=3.6.0"
23
- VERSION = "1.2.3"
23
+ VERSION = "1.2.4"
24
24
 
25
25
  # What packages are required for this module to be executed?
26
26
  REQUIRED = [
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