juham-automation 0.0.11__py3-none-any.whl → 0.0.12__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.
- juham_automation/automation/spothintafi.py +18 -12
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/METADATA +2 -3
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/RECORD +7 -7
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/LICENSE.rst +0 -0
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/WHEEL +0 -0
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/entry_points.txt +0 -0
- {juham_automation-0.0.11.dist-info → juham_automation-0.0.12.dist-info}/top_level.txt +0 -0
@@ -12,7 +12,7 @@ class SpotHintaFiThread(JuhamCloudThread):
|
|
12
12
|
"""Thread running SpotHinta.fi.
|
13
13
|
|
14
14
|
Periodically fetches the spot electricity prices and publishes them
|
15
|
-
to
|
15
|
+
to 'spot' topic.
|
16
16
|
"""
|
17
17
|
|
18
18
|
_spot_topic: str = ""
|
@@ -52,25 +52,30 @@ class SpotHintaFiThread(JuhamCloudThread):
|
|
52
52
|
|
53
53
|
spot = []
|
54
54
|
for e in data:
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
dt = datetime.fromisoformat(e["DateTime"]) # Correct timezone handling
|
56
|
+
ts = int(dt.timestamp()) # Ensure integer timestamps like in the test
|
57
|
+
|
58
|
+
hour = dt.strftime("%H") # Correctly extract hour
|
59
|
+
|
60
|
+
if 6 <= int(hour) < 22:
|
60
61
|
grid_cost = self.grid_cost_day
|
61
62
|
else:
|
62
63
|
grid_cost = self.grid_cost_night
|
63
|
-
|
64
|
+
|
65
|
+
total_price = round(e["PriceWithTax"] + grid_cost + self.grid_cost_tax, 6)
|
66
|
+
grid_cost_total = round(grid_cost + self.grid_cost_tax, 6)
|
67
|
+
|
64
68
|
h = {
|
65
69
|
"Timestamp": ts,
|
66
70
|
"hour": hour,
|
67
71
|
"Rank": e["Rank"],
|
68
72
|
"PriceWithTax": total_price,
|
69
|
-
"GridCost":
|
73
|
+
"GridCost": grid_cost_total,
|
70
74
|
}
|
71
75
|
spot.append(h)
|
76
|
+
|
72
77
|
self.publish(self._spot_topic, json.dumps(spot), 1, True)
|
73
|
-
self.info(f"Spot electricity prices published for the next {len(spot)} days")
|
78
|
+
# self.info(f"Spot electricity prices published for the next {len(spot)} days")
|
74
79
|
|
75
80
|
|
76
81
|
class SpotHintaFi(JuhamThread):
|
@@ -78,6 +83,7 @@ class SpotHintaFi(JuhamThread):
|
|
78
83
|
https://api.spot-hinta.fi site.
|
79
84
|
"""
|
80
85
|
|
86
|
+
_SPOTHINTAFI: str = "_spothintafi"
|
81
87
|
worker_thread_id = SpotHintaFiThread.get_class_id()
|
82
88
|
url = "https://api.spot-hinta.fi/TodayAndDayForward"
|
83
89
|
update_interval = 12 * 3600
|
@@ -119,7 +125,7 @@ class SpotHintaFi(JuhamThread):
|
|
119
125
|
@override
|
120
126
|
def to_dict(self) -> Dict[str, Any]:
|
121
127
|
data: Dict[str, Any] = super().to_dict()
|
122
|
-
data[
|
128
|
+
data[self._SPOTHINTAFI] = {
|
123
129
|
"topic": self.spot_topic,
|
124
130
|
"url": self.url,
|
125
131
|
"interval": self.update_interval,
|
@@ -129,6 +135,6 @@ class SpotHintaFi(JuhamThread):
|
|
129
135
|
@override
|
130
136
|
def from_dict(self, data: Dict[str, Any]) -> None:
|
131
137
|
super().from_dict(data)
|
132
|
-
if
|
133
|
-
for key, value in data[
|
138
|
+
if self._SPOTHINTAFI in data:
|
139
|
+
for key, value in data[self._SPOTHINTAFI].items():
|
134
140
|
setattr(self, key, value)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: juham-automation
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.12
|
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>
|
@@ -44,10 +44,9 @@ Classifier: Programming Language :: Python :: 3.8
|
|
44
44
|
Requires-Python: >=3.8
|
45
45
|
Description-Content-Type: text/markdown
|
46
46
|
License-File: LICENSE.rst
|
47
|
-
Requires-Dist: masterpiece>=0.1.26
|
48
47
|
Requires-Dist: masterpiece_influx>=0.1.9
|
49
48
|
Requires-Dist: masterpiece_pahomqtt>=0.1.5
|
50
|
-
Requires-Dist: juham_core>=0.1.
|
49
|
+
Requires-Dist: juham_core>=0.1.1
|
51
50
|
Requires-Dist: requests>=2.31
|
52
51
|
Requires-Dist: pytz>=2024.1
|
53
52
|
Provides-Extra: dev
|
@@ -5,7 +5,7 @@ juham_automation/automation/__init__.py,sha256=HV67cq9oXTcoAk5uBbHw3F1vR_saKztsH
|
|
5
5
|
juham_automation/automation/energycostcalculator.py,sha256=R9BjsPw04ZxmpYEnn67zqiQzGFQYVT6bq-S2b3x6trg,10825
|
6
6
|
juham_automation/automation/hotwateroptimizer.py,sha256=FNRukp-a4dPiw8TUEiaCzrSfBNzaAO8wyHu4TUu35FU,21833
|
7
7
|
juham_automation/automation/powermeter_simulator.py,sha256=3WZcjByRTdqnC77l7LjP-TEjmZ8XBEO4hClYsrjxmBE,4549
|
8
|
-
juham_automation/automation/spothintafi.py,sha256=
|
8
|
+
juham_automation/automation/spothintafi.py,sha256=cZbi7w2fVweHX_fh1r5MTjGdesX9wDQta2mfVjtiwvw,4331
|
9
9
|
juham_automation/automation/watercirculator.py,sha256=a8meMNaONbHcIH3y0vP0UulJc1-gZiLZpw7H8kAOreY,6410
|
10
10
|
juham_automation/ts/__init__.py,sha256=SinjhBcaRVP5FUyCMFWJGR3P7ZetL7ya8-VqhRb2skg,525
|
11
11
|
juham_automation/ts/electricityprice_ts.py,sha256=BYs120V4teVjSqPc8PpPDjOTc5dOrVM9Maqse7E8cvk,1684
|
@@ -15,9 +15,9 @@ juham_automation/ts/log_ts.py,sha256=XsNaazuPmRUZLUqxU0DZae_frtT6kAFcXJTc598CtOA
|
|
15
15
|
juham_automation/ts/power_ts.py,sha256=e7bSeZjitY4C_gLup9L0NjvU_WnQsl3ayDhVShj32KY,1399
|
16
16
|
juham_automation/ts/powermeter_ts.py,sha256=wkCROQj9kXHgDdMuIbbAjhgP5Pr6TA6eT2T-r9sHidw,2351
|
17
17
|
juham_automation/ts/powerplan_ts.py,sha256=LZeE7TnzPCDaugggKlaV-K48lDwwnC1ZNum50JYAWaY,1482
|
18
|
-
juham_automation-0.0.
|
19
|
-
juham_automation-0.0.
|
20
|
-
juham_automation-0.0.
|
21
|
-
juham_automation-0.0.
|
22
|
-
juham_automation-0.0.
|
23
|
-
juham_automation-0.0.
|
18
|
+
juham_automation-0.0.12.dist-info/LICENSE.rst,sha256=QVHD5V5_HSys2PdPdig_xKggDj8cGX33ALKqRsYyjtI,1089
|
19
|
+
juham_automation-0.0.12.dist-info/METADATA,sha256=N8gB9QmKA57s9T5J6J2fNNGJFlipzIVwbCXyt_aCGRQ,4747
|
20
|
+
juham_automation-0.0.12.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
21
|
+
juham_automation-0.0.12.dist-info/entry_points.txt,sha256=di8tXChhP8B_98bQ44u-1zkOha2kZCoJpCAXxTgoSw8,491
|
22
|
+
juham_automation-0.0.12.dist-info/top_level.txt,sha256=jfohvtocvX_gfT21AhJk7Iay5ZiQsS3HzrDjF7S4Qp0,17
|
23
|
+
juham_automation-0.0.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|