juham-automation 0.0.29__tar.gz → 0.0.30__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 (47) hide show
  1. {juham_automation-0.0.29/juham_automation.egg-info → juham_automation-0.0.30}/PKG-INFO +1 -1
  2. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/energybalancer.py +9 -5
  3. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/heatingoptimizer.py +2 -2
  4. {juham_automation-0.0.29 → juham_automation-0.0.30/juham_automation.egg-info}/PKG-INFO +1 -1
  5. {juham_automation-0.0.29 → juham_automation-0.0.30}/pyproject.toml +1 -1
  6. {juham_automation-0.0.29 → juham_automation-0.0.30}/LICENSE.rst +0 -0
  7. {juham_automation-0.0.29 → juham_automation-0.0.30}/MANIFEST.in +0 -0
  8. {juham_automation-0.0.29 → juham_automation-0.0.30}/README.rst +0 -0
  9. {juham_automation-0.0.29 → juham_automation-0.0.30}/examples/myapp.py +0 -0
  10. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/__init__.py +0 -0
  11. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/__init__.py +0 -0
  12. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/energycostcalculator.py +0 -0
  13. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/powermeter_simulator.py +0 -0
  14. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/spothintafi.py +0 -0
  15. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/automation/watercirculator.py +0 -0
  16. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/japp.py +0 -0
  17. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/py.typed +0 -0
  18. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/__init__.py +0 -0
  19. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/electricityprice_ts.py +0 -0
  20. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/energybalancer_ts.py +0 -0
  21. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/energycostcalculator_ts.py +0 -0
  22. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/forecast_ts.py +0 -0
  23. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/log_ts.py +0 -0
  24. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/power_ts.py +0 -0
  25. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/powermeter_ts.py +0 -0
  26. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation/ts/powerplan_ts.py +0 -0
  27. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation.egg-info/SOURCES.txt +0 -0
  28. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation.egg-info/dependency_links.txt +0 -0
  29. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation.egg-info/entry_points.txt +0 -0
  30. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation.egg-info/requires.txt +0 -0
  31. {juham_automation-0.0.29 → juham_automation-0.0.30}/juham_automation.egg-info/top_level.txt +0 -0
  32. {juham_automation-0.0.29 → juham_automation-0.0.30}/setup.cfg +0 -0
  33. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/__init__.py +0 -0
  34. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/__init__.py +0 -0
  35. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/test_energybalancer.py +0 -0
  36. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/test_energycostcalculator.py +0 -0
  37. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/test_heatingoptimizer.py +0 -0
  38. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/test_juham.py +0 -0
  39. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/automation/test_spothintafi.py +0 -0
  40. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/test_japp.py +0 -0
  41. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/__init__.py +0 -0
  42. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_energycostcalculator_ts.py +0 -0
  43. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_forecast_ts.py +0 -0
  44. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_log_ts.py +0 -0
  45. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_power_ts.py +0 -0
  46. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_powermeter_ts.py +0 -0
  47. {juham_automation-0.0.29 → juham_automation-0.0.30}/tests/ts/test_powerplan_ts.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: juham-automation
3
- Version: 0.0.29
3
+ Version: 0.0.30
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>
@@ -34,9 +34,10 @@ class EnergyBalancer(Juham):
34
34
  """
35
35
  super().__init__(name)
36
36
 
37
- self.topic_in_consumers = self.make_topic_name("energybalance_consumers")
38
- self.topic_in_net_energy_balance = self.make_topic_name("net_energy_balance")
39
- self.topic_out_energybalance = self.make_topic_name("energybalance")
37
+ self.topic_in_consumers = self.make_topic_name("energybalance/consumers")
38
+ self.topic_out_energybalance = self.make_topic_name("energybalance/status")
39
+ self.topic_in_power = self.make_topic_name("net_energy_balance")
40
+
40
41
  self.net_energy_balance: float = 0.0 # Energy balance in joules (watt-seconds)
41
42
  self.current_interval_ts: float = -1
42
43
  self.needed_energy: float = 0.0 # Energy needed in joules (watt-seconds)
@@ -48,14 +49,14 @@ class EnergyBalancer(Juham):
48
49
  def on_connect(self, client: object, userdata: Any, flags: int, rc: int) -> None:
49
50
  super().on_connect(client, userdata, flags, rc)
50
51
  if rc == 0:
51
- self.subscribe(self.topic_in_net_energy_balance)
52
+ self.subscribe(self.topic_in_power)
52
53
  self.subscribe(self.topic_in_consumers)
53
54
 
54
55
  @override
55
56
  def on_message(self, client: object, userdata: Any, msg: MqttMsg) -> None:
56
57
  ts: float = timestamp()
57
58
 
58
- if msg.topic == self.topic_in_net_energy_balance:
59
+ if msg.topic == self.topic_in_power:
59
60
  self.on_power(json.loads(msg.payload.decode()), ts)
60
61
  elif msg.topic == self.topic_in_consumers:
61
62
  self.on_consumer(json.loads(msg.payload.decode()))
@@ -131,8 +132,11 @@ class EnergyBalancer(Juham):
131
132
  Returns:
132
133
  float: energy needed in joules
133
134
  """
135
+
134
136
  required_power: float = 0.0
135
137
  num_consumers: int = len(self.consumers)
138
+ if num_consumers == 0:
139
+ return 0.0
136
140
  remaining_ts_consumer: float = (
137
141
  self.energy_balancing_interval - interval_ts
138
142
  ) / num_consumers
@@ -88,8 +88,8 @@ class HeatingOptimizer(Juham):
88
88
  self.topic_forecast = self.make_topic_name("forecast")
89
89
  self.topic_temperature = self.make_topic_name(temperature_sensor)
90
90
  self.topic_powerplan = self.make_topic_name("powerplan")
91
- self.topic_in_energybalance = self.make_topic_name("energybalance")
92
- self.topic_out_energybalance = self.make_topic_name("energybalance_consumers")
91
+ self.topic_in_energybalance = self.make_topic_name("energybalance/status")
92
+ self.topic_out_energybalance = self.make_topic_name("energybalance/consumers")
93
93
  self.topic_out_power = self.make_topic_name("power")
94
94
 
95
95
  self.current_temperature = 100
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: juham-automation
3
- Version: 0.0.29
3
+ Version: 0.0.30
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>
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "juham-automation"
8
- version = "0.0.29"
8
+ version = "0.0.30"
9
9
  description = "Juha's Ultimate Home Automation Masterpiece"
10
10
  readme = {file = "README.rst", content-type = "text/markdown"}
11
11
  requires-python = ">=3.8"