juham-automation 0.0.28__py3-none-any.whl → 0.0.30__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.
@@ -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,10 +88,9 @@ 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_powerconsumption = self.make_topic_name("powerconsumption")
92
- self.topic_in_net_energy_balance = self.make_topic_name("net_energy_balance")
93
- self.topic_out_energybalance = self.make_topic_name("energybalance_consumers")
94
- self.topic_out_power = self.make_topic_name("power") # controls the relay
91
+ self.topic_in_energybalance = self.make_topic_name("energybalance/status")
92
+ self.topic_out_energybalance = self.make_topic_name("energybalance/consumers")
93
+ self.topic_out_power = self.make_topic_name("power")
95
94
 
96
95
  self.current_temperature = 100
97
96
  self.current_heating_plan = 0
@@ -111,8 +110,7 @@ class HeatingOptimizer(Juham):
111
110
  self.subscribe(self.topic_spot)
112
111
  self.subscribe(self.topic_forecast)
113
112
  self.subscribe(self.topic_temperature)
114
- self.subscribe(self.topic_in_powerconsumption)
115
- self.subscribe(self.topic_in_net_energy_balance)
113
+ self.subscribe(self.topic_in_energybalance)
116
114
  self.register_as_consumer()
117
115
 
118
116
  def register_as_consumer(self) -> None:
@@ -226,7 +224,7 @@ class HeatingOptimizer(Juham):
226
224
  elif msg.topic == self.topic_temperature:
227
225
  m = json.loads(msg.payload.decode())
228
226
  self.current_temperature = m["temperature"]
229
- elif msg.topic == self.topic_in_net_energy_balance:
227
+ elif msg.topic == self.topic_in_energybalance:
230
228
  decoded_payload = msg.payload.decode()
231
229
  m = json.loads(decoded_payload)
232
230
  self.on_netenergy_balance(m)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: juham-automation
3
- Version: 0.0.28
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>
@@ -2,9 +2,9 @@ juham_automation/__init__.py,sha256=32BL36bhT7OaSw22H7st-7-3IXcFM2Pf5js80hNA8W0,
2
2
  juham_automation/japp.py,sha256=L2u1mfKvun2fiXhB3AEJD9zMDcdFZ3_doXZYJJzu9tg,1646
3
3
  juham_automation/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
4
  juham_automation/automation/__init__.py,sha256=uxkIrcRSp1cFikn-oBRtQ8XiT9cSf7xjm3CS1RN7lAQ,522
5
- juham_automation/automation/energybalancer.py,sha256=V_2t6hkRWf0--o9njfa8G-AtHPYcPVNY2rDrO5WRqsc,10698
5
+ juham_automation/automation/energybalancer.py,sha256=HcBTCI4eS429Up2-lx5zkAZQmZGn2ZCVTwGCavsjGg4,10722
6
6
  juham_automation/automation/energycostcalculator.py,sha256=v30wxRpuY2gGBSMJifrFRTjsRU9t-iCiq33Vds7s3O8,10877
7
- juham_automation/automation/heatingoptimizer.py,sha256=f8T7KOa4Chgw2jfyxOkpvxTBfPZxc6lMQZYV4xopWyw,21664
7
+ juham_automation/automation/heatingoptimizer.py,sha256=V56gZEsjJOf4veZCZYT1JUv8Tv8lmZ-65zLEb6T7q8s,21488
8
8
  juham_automation/automation/powermeter_simulator.py,sha256=3WZcjByRTdqnC77l7LjP-TEjmZ8XBEO4hClYsrjxmBE,4549
9
9
  juham_automation/automation/spothintafi.py,sha256=cZbi7w2fVweHX_fh1r5MTjGdesX9wDQta2mfVjtiwvw,4331
10
10
  juham_automation/automation/watercirculator.py,sha256=a8meMNaONbHcIH3y0vP0UulJc1-gZiLZpw7H8kAOreY,6410
@@ -17,9 +17,9 @@ juham_automation/ts/log_ts.py,sha256=XsNaazuPmRUZLUqxU0DZae_frtT6kAFcXJTc598CtOA
17
17
  juham_automation/ts/power_ts.py,sha256=e7bSeZjitY4C_gLup9L0NjvU_WnQsl3ayDhVShj32KY,1399
18
18
  juham_automation/ts/powermeter_ts.py,sha256=gXzfK2S4SzrQ9GqM0tsLaV6z_vYmTkBatTcaivASSXs,2188
19
19
  juham_automation/ts/powerplan_ts.py,sha256=LZeE7TnzPCDaugggKlaV-K48lDwwnC1ZNum50JYAWaY,1482
20
- juham_automation-0.0.28.dist-info/licenses/LICENSE.rst,sha256=QVHD5V5_HSys2PdPdig_xKggDj8cGX33ALKqRsYyjtI,1089
21
- juham_automation-0.0.28.dist-info/METADATA,sha256=sPrwas2n-HhRjXduTKr5TQwI4F8R-GoMj5gHDEyqd2o,6837
22
- juham_automation-0.0.28.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
23
- juham_automation-0.0.28.dist-info/entry_points.txt,sha256=h-KzuKjmGPd4_iX_oiGvxx4IEc97dVbGGlhdh5ctbpI,605
24
- juham_automation-0.0.28.dist-info/top_level.txt,sha256=jfohvtocvX_gfT21AhJk7Iay5ZiQsS3HzrDjF7S4Qp0,17
25
- juham_automation-0.0.28.dist-info/RECORD,,
20
+ juham_automation-0.0.30.dist-info/licenses/LICENSE.rst,sha256=QVHD5V5_HSys2PdPdig_xKggDj8cGX33ALKqRsYyjtI,1089
21
+ juham_automation-0.0.30.dist-info/METADATA,sha256=Be-9u_ReioR9XS4Z4U8jtaQBxrSbdGfoJPQHx9OkaXg,6837
22
+ juham_automation-0.0.30.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
23
+ juham_automation-0.0.30.dist-info/entry_points.txt,sha256=h-KzuKjmGPd4_iX_oiGvxx4IEc97dVbGGlhdh5ctbpI,605
24
+ juham_automation-0.0.30.dist-info/top_level.txt,sha256=jfohvtocvX_gfT21AhJk7Iay5ZiQsS3HzrDjF7S4Qp0,17
25
+ juham_automation-0.0.30.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.1)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5