gazpar2haws 0.3.0b15__py3-none-any.whl → 0.3.0b17__py3-none-any.whl

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.
gazpar2haws/gazpar.py CHANGED
@@ -100,13 +100,15 @@ class Gazpar:
100
100
  last_date_and_value_by_sensor[cost_sensor_name] = await self.find_last_date_and_value(cost_sensor_name)
101
101
 
102
102
  # Compute the start date as the minimum of the last dates plus one day
103
- start_date = min(v[0] for v in last_date_and_value_by_sensor.values()) + timedelta(days=1)
104
-
105
- # The end date is the as of date
106
- end_date = self._as_of_date
103
+ start_date = min(
104
+ min(v[0] for v in last_date_and_value_by_sensor.values()) + timedelta(days=1), self._as_of_date
105
+ )
107
106
 
108
107
  # Fetch the data from GrDF and publish it to Home Assistant
109
- daily_history = self.fetch_daily_gazpar_history(start_date, end_date)
108
+ daily_history = self.fetch_daily_gazpar_history(start_date, self._as_of_date)
109
+
110
+ # The end date is the last date of the daily history
111
+ end_date = datetime.strptime(daily_history[-1][pygazpar.PropertyName.TIME_PERIOD.value], "%d/%m/%Y").date()
110
112
 
111
113
  # Extract the volume from the daily history
112
114
  volume_array = self.extract_property_from_daily_gazpar_history(
@@ -150,18 +152,17 @@ class Gazpar:
150
152
  return
151
153
 
152
154
  # Compute the cost from the energy
153
- quantities = ConsumptionQuantityArray(
154
- start_date=last_date_and_value_by_sensor[energy_sensor_name][0],
155
- end_date=end_date,
156
- value_unit=QuantityUnit.KWH,
157
- base_unit=TimeUnit.DAY,
158
- value_array=energy_array,
159
- )
160
-
161
- # Compute the cost
162
155
  if energy_array is not None:
163
156
  pricer = Pricer(self._pricing_config)
164
157
 
158
+ quantities = ConsumptionQuantityArray(
159
+ start_date=last_date_and_value_by_sensor[energy_sensor_name][0],
160
+ end_date=end_date,
161
+ value_unit=QuantityUnit.KWH,
162
+ base_unit=TimeUnit.DAY,
163
+ value_array=energy_array,
164
+ )
165
+
165
166
  cost_array = pricer.compute(quantities, PriceUnit.EURO)
166
167
  else:
167
168
  cost_array = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gazpar2haws
3
- Version: 0.3.0b15
3
+ Version: 0.3.0b17
4
4
  Summary: Gazpar2HAWS is a gateway that reads data history from the GrDF (French gas provider) meter and send it to Home Assistant using WebSocket interface
5
5
  License: MIT License
6
6
 
@@ -4,12 +4,12 @@ gazpar2haws/bridge.py,sha256=VEl22xt2Szgk_FVrxSvZNxp3T5Q2JXc9ulfrunHHkmo,3685
4
4
  gazpar2haws/config_utils.py,sha256=yT2G-naMA2Vst6bQdm1bD2oVsPTU3Q_RuukCs-dZ6Ak,2280
5
5
  gazpar2haws/configuration.py,sha256=24q8FUBMS1vpqU6RYAv5Au179HbiBk1CZIEMiBGuXq0,722
6
6
  gazpar2haws/date_array.py,sha256=XQ8gwTl0w97ADjs6igdMZLxtPPrDWTLQzhhzTDVjC4M,8761
7
- gazpar2haws/gazpar.py,sha256=o2YT9M1m7YRhuk7TBuUOOwf9ZElPASjTpUwRpHpDsss,12574
7
+ gazpar2haws/gazpar.py,sha256=EZbVohc6_FkB2FhyWNWeSL0ly3XdQQXqyfa5hQ_bVDk,12729
8
8
  gazpar2haws/haws.py,sha256=1ELdompdACNf5XkpjCN6Bdiw7stPfzar3x8OjoBmhxQ,7969
9
9
  gazpar2haws/model.py,sha256=-1yhLNNcEvEtW67GMVLZ4lcXw6Lk75kWvrdjoVgjKCw,7055
10
10
  gazpar2haws/pricer.py,sha256=YhMfvAKSxQhE2JGgrkNOpqQZdTWjGZ_bUtNsYA0u2fs,21932
11
11
  gazpar2haws/version.py,sha256=9Iq5Jm63Ev7QquCjhDqa9_KAgHdKl9FJHynq8M6JNrY,83
12
- gazpar2haws-0.3.0b15.dist-info/LICENSE,sha256=ajApZPyhVx8AU9wN7DXeRGhoWFqY2ylBZUa5GRhTmok,1073
13
- gazpar2haws-0.3.0b15.dist-info/METADATA,sha256=qtXzqYtd_Wl0p8TGEzYI1z7WsUbtlR6BVVOwq7a0NXs,17406
14
- gazpar2haws-0.3.0b15.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
15
- gazpar2haws-0.3.0b15.dist-info/RECORD,,
12
+ gazpar2haws-0.3.0b17.dist-info/LICENSE,sha256=ajApZPyhVx8AU9wN7DXeRGhoWFqY2ylBZUa5GRhTmok,1073
13
+ gazpar2haws-0.3.0b17.dist-info/METADATA,sha256=Udh5bnsmnYMjPzUbXLmTCQuY3CwTpHn-wx4ggF9_c1o,17406
14
+ gazpar2haws-0.3.0b17.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
15
+ gazpar2haws-0.3.0b17.dist-info/RECORD,,