juham-automation 0.0.15__py3-none-any.whl → 0.0.17__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.
@@ -16,13 +16,17 @@ from juham_core.timeutils import (
16
16
 
17
17
  class HotWaterOptimizer(Juham):
18
18
  """Automation class for optimized control of temperature driven home energy consumers e.g hot
19
- water radiators. Reads spot prices, electricity forecast and temperatures to minimize electricity bill.
20
- Additional control over heating is provided by the following attributes
19
+ water radiators. Reads spot prices, electricity forecast, power meter and temperatures to minimize electricity bill.
21
20
 
22
- Computes UOI - optimization utilization index for each hour, based on the spot price and the solar power forecast.
23
- Value of 0 means the hour is expensive, value of 1 means the hour is free. The UOI threshold determines the slots
24
- that are allowed to be consumed.
21
+ Represents a heating system that knows the power rating of its radiator (e.g., 3kW).
22
+ The system subscribes to the 'power' topic to track the current power balance. If the solar panels
23
+ generate more energy than is being consumed, the optimizer activates a relay to ensure that all excess energy
24
+ produced within that hour is used for heating. The goal is to achieve a net zero energy balance for each hour,
25
+ ensuring that any surplus energy from the solar panels is fully utilized.
25
26
 
27
+ Computes also UOI - optimization utilization index for each hour, based on the spot price and the solar power forecast.
28
+ For negative energy balance this determines when energy is consumed. Value of 0 means the hour is expensive, value of 1 means
29
+ the hour is free. The UOI threshold determines the slots that are allowed to be consumed.
26
30
 
27
31
  """
28
32
 
@@ -299,6 +303,10 @@ class HotWaterOptimizer(Juham):
299
303
  bool: true if production exceeds the consumption
300
304
  """
301
305
 
306
+ # if net energy balance is negative, then we are not in balancing mode
307
+ if self.net_energy_balance < 0:
308
+ return False
309
+
302
310
  # elapsed and remaining time within the current balancing slot
303
311
  elapsed_ts = ts - quantize(self.energy_balancing_interval, ts)
304
312
  remaining_ts = self.energy_balancing_interval - elapsed_ts
@@ -306,12 +314,19 @@ class HotWaterOptimizer(Juham):
306
314
  # don't bother to switch the relay on for small intervals, to avoid
307
315
  # wearing contactors out
308
316
  if remaining_ts < self.operation_threshold:
317
+ print(
318
+ f"Skipping balance, remaining time {remaining_ts}s < {self.operation_threshold}s"
319
+ )
309
320
  return False
310
321
 
311
322
  # check if the balance is sufficient for heating the next half of the energy balancing interval
312
323
  # if yes then switch heating on for the next half an hour
313
324
  needed_energy = 0.5 * self.radiator_power * remaining_ts
314
325
  elapsed_interval = ts - self.net_energy_balance_ts
326
+ print(
327
+ f"Needed energy {int(needed_energy)}Wh, current balance {int(self.net_energy_balance)}Wh"
328
+ )
329
+
315
330
  if (
316
331
  self.net_energy_balance > needed_energy
317
332
  ) and not self.net_energy_balancing_rc:
@@ -342,7 +357,7 @@ class HotWaterOptimizer(Juham):
342
357
 
343
358
  # check if we have energy to consume, if so return 1
344
359
  if self.consider_net_energy_balance(ts):
345
- self.warning("Net energy balance positive")
360
+ self.info("Net energy balance positive")
346
361
  return 1
347
362
  elif self.net_energy_balancing_mode:
348
363
  balancing_slot_start_ts = quantize(self.energy_balancing_interval, ts)
@@ -350,13 +365,11 @@ class HotWaterOptimizer(Juham):
350
365
  if elapsed_b > self.energy_balancing_interval:
351
366
  self.net_energy_balancing_mode = False
352
367
  self.info(
353
- f"TODO: Net energy balancing mode because elapsed {elapsed_b}s is less than balancing interval {self.energy_balancing_interval}s"
368
+ f"Exiting net energy balancing mode: {elapsed_b}s > {self.energy_balancing_interval}s"
354
369
  )
355
370
  else:
356
- self.info(
357
- f"TODO: Net energy balance waiting interval {elapsed_b}s to end"
358
- )
359
- # return 0
371
+ self.info(f"Net energy balance waiting interval {elapsed_b}s to end")
372
+ return 0
360
373
 
361
374
  if self.current_temperature > self.maximum_boiler_temperature:
362
375
  self.info(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: juham-automation
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Juha's Ultimate Home Automation Masterpiece
5
5
  Author-email: J Meskanen <juham.api@gmail.com>
6
6
  Maintainer-email: "J. Meskanen" <juham.api@gmail.com>
@@ -3,7 +3,7 @@ juham_automation/japp.py,sha256=zD5ulfIcaSzwbVKjHv2tdXpw79fpw97B7P-v-ncY6e4,1520
3
3
  juham_automation/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
4
  juham_automation/automation/__init__.py,sha256=73Mw0jkipeMCoUtpREHJPATfKe368ZyNeqfbjamBx_Q,481
5
5
  juham_automation/automation/energycostcalculator.py,sha256=7GGKLv5JpHAY3XVjbkboXuQBk-whpWkBwNuQ68Tv4Pc,11091
6
- juham_automation/automation/hotwateroptimizer.py,sha256=a3kp6JuOG13wHoC3CJFS4rz1HxedR2RHNTiKiJkuvEI,22359
6
+ juham_automation/automation/hotwateroptimizer.py,sha256=oOgMgfqzqLN-hNdqaxgK_eKuw6q3JCsnZNM5XG17nko,23194
7
7
  juham_automation/automation/powermeter_simulator.py,sha256=0g0gOD9WTqxUj9IbENkea_33JrJ2sZDSQVtmxVUHcD8,4688
8
8
  juham_automation/automation/spothintafi.py,sha256=XnL2zIPx_XaP_1E8ksuYEUemtHP7N6tLlSv2LEBQyXQ,4471
9
9
  juham_automation/automation/watercirculator.py,sha256=d7PQFNajtVafizS_y2R_6GWhm_GYb8uV4-QScz1Sggo,6569
@@ -15,9 +15,9 @@ juham_automation/ts/log_ts.py,sha256=DPfeJhbSMQChY37mjAxEmE73Ys3dxUvNsN78PSuBm9Y
15
15
  juham_automation/ts/power_ts.py,sha256=esNbtH1xklyUaf0YJQ2wDuxTAV3SnEfx-FtiBGPaSVA,1448
16
16
  juham_automation/ts/powermeter_ts.py,sha256=zSATxZAzz1KJeU1wFK8CP86iySWnHil89mridz7WHos,2421
17
17
  juham_automation/ts/powerplan_ts.py,sha256=-Lhc7v5Cj7USy2MfmyUEusXSox9UbEoDtYGReDEt3cw,1527
18
- juham_automation-0.0.15.dist-info/licenses/LICENSE.rst,sha256=D3SSbUrv10lpAZ91lTMCQAke-MXMvrjFDsDyM3vEKJI,1114
19
- juham_automation-0.0.15.dist-info/METADATA,sha256=hOAyfbi17nrr7UZ3rYBLGB47Thc8RkBm4mfdrka2o64,4733
20
- juham_automation-0.0.15.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
- juham_automation-0.0.15.dist-info/entry_points.txt,sha256=di8tXChhP8B_98bQ44u-1zkOha2kZCoJpCAXxTgoSw8,491
22
- juham_automation-0.0.15.dist-info/top_level.txt,sha256=jfohvtocvX_gfT21AhJk7Iay5ZiQsS3HzrDjF7S4Qp0,17
23
- juham_automation-0.0.15.dist-info/RECORD,,
18
+ juham_automation-0.0.17.dist-info/licenses/LICENSE.rst,sha256=D3SSbUrv10lpAZ91lTMCQAke-MXMvrjFDsDyM3vEKJI,1114
19
+ juham_automation-0.0.17.dist-info/METADATA,sha256=os2IZ8IJd054hzwvnWwzC8OPdX5939zEMzdrSwH77nw,4733
20
+ juham_automation-0.0.17.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
+ juham_automation-0.0.17.dist-info/entry_points.txt,sha256=di8tXChhP8B_98bQ44u-1zkOha2kZCoJpCAXxTgoSw8,491
22
+ juham_automation-0.0.17.dist-info/top_level.txt,sha256=jfohvtocvX_gfT21AhJk7Iay5ZiQsS3HzrDjF7S4Qp0,17
23
+ juham_automation-0.0.17.dist-info/RECORD,,