Skip to content

Commit 2f4ea7c

Browse files
authored
2026.02.0 2026.02.0.rc2 (#541)
1 parent a96902b commit 2f4ea7c

File tree

7 files changed

+65
-21
lines changed

7 files changed

+65
-21
lines changed

dao/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog 刀 DAO
22
# Day Ahead Optimizer
3+
# 2026.02.0
4+
- Update several python modules
5+
- Fix error api predict pv_dc (reported by @Dogooder)
6+
- Adjustments in documentation (#521, @storeman)
7+
- Fix error calculation of pv-prognose in api should be done with ml_prediction if configured (reported by @Dogooder)
8+
- Fix error when HA-sensor has unit_of_measurement="MWh" (reported by @itavero)
9+
- Catched error when ml_prediction=true and there is no trained model: with warning-logging and use dao-prediction as fallback
10+
- Fixed groupby-error with mysql(with "ONLY_FULL_GROUP_BY") and postgresql
11+
- Fixed error in Wh-correction when no ha-data are present
12+
- Correct sensordata from HA with unit_of_measurement="Wh" to "kWh"
13+
314
# 2026.01.2
415
Correct sensordata from HA with unit_of_measurement="Wh" to "kWh"
516

dao/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: 刀 Day Ahead Optimizer
3-
version: 2026.01.2
3+
version: 2026.02.0
44
slug: day_ahead_opt
55
description: Home Assistant Community Add-ons for day ahead optimizations
66
url: https://github.com/corneel27/day-ahead

dao/prog/da_graph.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def build(self, df, options, show=True):
188188
ymax_left = math.ceil(max(ymax_left, max(data_array)))
189189
ymin_left = math.floor(min(ymin_left, min(data_array)))
190190
if vax == "right":
191-
ymax_right = math.ceil(max(ymax_right, max(data_array)))
191+
ymax_right = (
192+
math.ceil(max(ymax_right, max(data_array)) * 10) / 10
193+
)
192194
ymin_right = math.floor(min(ymin_right, min(data_array)))
193195
if s_type == "bar" or s_type == "stacked":
194196
nr_bar += 1
@@ -313,8 +315,15 @@ def build(self, df, options, show=True):
313315
# axis.legend(loc = 'center left', bbox_to_anchor=(1, 0.5))
314316

315317
if axis_right:
316-
ylim = math.ceil(
317-
max(np.max(stacked_plus_right), -np.min(stacked_neg_right))
318+
ylim = (
319+
math.ceil(
320+
max(
321+
max(np.max(stacked_plus_right), ymax_right),
322+
-min(np.min(stacked_neg_right), ymin_right),
323+
)
324+
* 10
325+
)
326+
/ 10
318327
)
319328
if ylim > 0:
320329
if np.min(stacked_neg_right) < 0:
@@ -324,9 +333,19 @@ def build(self, df, options, show=True):
324333
else:
325334
axis_right.set_ylim([min(0, ymin_right), ymax_right])
326335
axis_right.set_ylabel(g_options["vaxis"][1]["title"])
336+
if "format" in g_options["vaxis"][1]:
337+
f_str = g_options["vaxis"][1]["format"]
338+
axis_right.yaxis.set_major_formatter(
339+
ticker.FormatStrFormatter(f_str)
340+
)
327341

328342
if stacked_plus is not None:
329-
ylim = math.ceil(max(np.max(stacked_plus), -np.min(stacked_neg)))
343+
ylim = math.ceil(
344+
max(
345+
max(np.max(stacked_plus), ymax_left),
346+
-min(np.min(stacked_neg), ymin_left),
347+
)
348+
)
330349
if ylim > 0:
331350
if np.min(stacked_neg) < 0:
332351
ax.set_ylim([-ylim, ylim])
@@ -345,5 +364,4 @@ def build(self, df, options, show=True):
345364

346365
if show:
347366
plt.show()
348-
else:
349-
return fig
367+
return fig

dao/prog/da_prices.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,45 @@ def __init__(self, config: Config, db_da: DBmanagerObj):
2121
self.interval = self.config.get(["interval"], None, "1hour")
2222
self.country = self.config.get(["country"], None, "NL")
2323

24-
def get_prices(self, source):
24+
def get_prices(
25+
self, source, _start: datetime.datetime = None, _end: datetime.datetime = None
26+
):
2527
if self.interval == "1hour":
2628
resolution = 60
2729
else:
2830
resolution = 15
2931
now = datetime.datetime.now()
3032
# start
31-
if len(sys.argv) > 2:
32-
arg_s = sys.argv[2]
33-
start = datetime.datetime.strptime(arg_s, "%Y-%m-%d")
33+
if _start is None:
34+
if len(sys.argv) > 2:
35+
arg_s = sys.argv[2]
36+
start = datetime.datetime.strptime(arg_s, "%Y-%m-%d")
37+
else:
38+
start = pd.Timestamp(
39+
year=now.year, month=now.month, day=now.day, tz="CET"
40+
)
3441
else:
35-
start = pd.Timestamp(year=now.year, month=now.month, day=now.day, tz="CET")
42+
start = _start
3643
# end
37-
if len(sys.argv) > 3:
38-
arg_s = sys.argv[3]
39-
end = datetime.datetime.strptime(arg_s, "%Y-%m-%d")
40-
else:
41-
if now.hour < 12:
42-
end = start + datetime.timedelta(days=1)
44+
if _end is None:
45+
if len(sys.argv) > 3:
46+
arg_s = sys.argv[3]
47+
end = datetime.datetime.strptime(arg_s, "%Y-%m-%d")
4348
else:
44-
end = start + datetime.timedelta(days=2)
49+
if now.hour < 12:
50+
end = start + datetime.timedelta(days=1)
51+
else:
52+
end = start + datetime.timedelta(days=2)
53+
else:
54+
end = _end
4555

4656
if len(sys.argv) <= 2:
4757
present = self.db_da.get_time_border_record("da")
4858
if not (present is None):
4959
tz = pytz.timezone("CET")
5060
present = tz.normalize(tz.localize(present))
61+
if end.tzinfo is None:
62+
end = tz.normalize(tz.localize(end))
5163
if present >= (end - datetime.timedelta(hours=1)):
5264
logging.info(f"Day ahead data already present")
5365
return

dao/prog/db_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def get_column_data(
557557
result = connection.execute(query)
558558
df = pd.DataFrame(result.fetchall(), columns=result.keys())
559559
if agg_func is not None:
560-
df.groupby("uur").agg(
560+
df = df.groupby("uur").agg(
561561
{
562562
"uur": "min",
563563
"time": "min",

release-testing/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog 刀 DAO
22
# Day Ahead Optimizer
3+
# 2026.02.0.rc2
4+
Update several python modules
5+
36
# 2026.02.0.rc1
47
Fix error api predict pv_dc (reported by @Dogooder)
58

release-testing/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: 刀 Day Ahead Optimizer (TESTING)
3-
version: 2026.02.0.rc1
3+
version: 2026.02.0.rc2
44
stage: experimental
55
slug: day_ahead_opt-testing
66
description: Beta version of DAO. Use only for testing!

0 commit comments

Comments
 (0)