Skip to content

Commit 55ae6b6

Browse files
authored
2025.10.1 (#391)
* deleted max_seconds limit * max_mip_gap set to 0.005 (was 0.001) * added logging.debug of hass/api/config * fixed divide-zero error when production or consumption are 0.0 * when no country is configured in HA, NL is assumed. * added/adjusted settings in options_example.json * added/adjusted settings in options_example.json * "api/report/da/vandaag" and "api/report/da/vandaag en morgen" present data with the configured interval * add documentation about the interval-setting to DOCS.md * versie 2025.10.1 / 2025.10.1.rc1
1 parent de397f4 commit 55ae6b6

File tree

9 files changed

+71
-17
lines changed

9 files changed

+71
-17
lines changed

dao/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog 刀 DAO
22
# Day Ahead Optimizer
3+
# 2025.10.1
4+
This version is similar with 2025.10.1.rc1 in the testing-channel.<br>
5+
Fixes:
6+
- deleted max_seconds limit
7+
- max_mip_gap set to 0.005 (was 0.001)
8+
- added logging.debug of hass/api/config
9+
- fixed divide-zero error when production or consumption are 0.0
10+
- when no country is configured in HA, "NL" is assumed
11+
- "api/report/da/vandaag" and "api/report/da/vandaag en morgen" present data with the configured interval
12+
- added documentation about the interval-setting to DOCS.md
13+
14+
Know issue:
15+
- The forecast in the reports still nog good working
16+
317

418
# 2025.10.0
519
This version is similar with 2025.10.0.rc1 in the testing-channel

dao/DOCS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ Dit regelt de supervisor van Home Assistant dan voor je.
633633
| | vat production | list | | {datum : getal} |
634634
| | last invoice | datum | | begindatum contract |
635635
| | tax refund | boolean | | |
636+
| **interval** | | string | "1hour" | keuze uit "1hour" of "15min"
636637
| **log level** | | string | "info" | keuze uit "debug", "info", "warning" of "error" |
637638
| **use_calc_baseload** | | boolean | "False" | |
638639
| **baseload calc periode** | | getal | 56 | alleen als "use_calc_baseload" = True |
@@ -950,6 +951,24 @@ De meteodata worden opgehaald bij meteoserver. Ook hiervoor heb je een key nodig
950951
* last invoice: datum laatste jaarfactuur en/of de begindatum van je contractjaar (formaat "yyyy-mm-dd")
951952
* tax refund: kun je alles salderen of is je teruglevering hoger dan je verbruik (True of False)
952953
954+
### **interval**
955+
Standaard rekent het programma met een 1 uur interval (default settings = "**1hour**")
956+
Als jouw energieleverancier rekent met kwartieprijzen dan kun je het interval op "**15min**" zetten.
957+
Let daarbij op de volgende aandachtspunten:
958+
1. Pas de scheduler aan zodat het programma ook ieder kwartier rekent. Zet de volgende extra regels in de scheduler:<br>
959+
````
960+
"xx15": "calc_optimum",
961+
"xx30": "calc_optimum",
962+
"xx45": "calc_optimum",
963+
````
964+
Let daarbij op dat deze "kwartieren" niet overeenkomen met een andere actie (meteo ophalen of.)
965+
Het programma kan vooralsnog per minuut maar 1 taak uitvoeren. Pas in dat geval de planning van deze taak aan.
966+
967+
2. Vul bij price-source een providor in die het leveren van kwartierprijzen ondersteund.
968+
Vooralsnog zijn dat nordpool, tibber (beide getest) en entsoe (niet getest)
969+
3. Haal ("met de hand" via het run menu) de prijzen voor vandaag en na 13:00 voor morgen opnieuw op. Vul de datum van vandaag (en morgen) in bij het "vanaf"-veld.
970+
971+
953972
### **logging level**
954973
De output van het programma wordt opgeslagen in logfiles.
955974
Je kunt zelf bepalen hoe gedetailleerden uitgebreid deze output is:

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: 2025.10.0
3+
version: 2025.10.1
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/data/options_example.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"prices spot": "True",
9393
"average consumption": "True"
9494
},
95+
"interval": "15min",
9596
"strategy": "minimize cost",
9697
"notifications": {
9798
"notification entity": "input_text.dao_notificatie",
@@ -428,10 +429,10 @@
428429
"entities battery production": ["sensor.ess_grid_production"]
429430
},
430431
"scheduler": {
431-
"0430": "get_meteo_data",
432-
"1030": "get_meteo_data",
433-
"1630": "get_meteo_data",
434-
"2230": "get_meteo_data",
432+
"0435": "get_meteo_data",
433+
"1035": "get_meteo_data",
434+
"1635": "get_meteo_data",
435+
"2235": "get_meteo_data",
435436
"0950": "get_tibber_data",
436437
"1050": "get_tibber_data",
437438
"1150": "get_tibber_data",
@@ -444,7 +445,10 @@
444445
"1554": "get_day_ahead_prices",
445446
"1655": "get_day_ahead_prices",
446447
"xx00": "calc_optimum",
448+
"xx15": "calc_optimum",
449+
"xx30": "calc_optimum",
450+
"xx45": "calc_optimum",
447451
"2359": "clean_data",
448-
"0930": "calc_baseloads"
452+
"0935": "calc_baseloads"
449453
}
450454
}

dao/prog/da_base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,15 @@ def __init__(self, file_name: str = None):
110110
}
111111
resp = get(self.hassurl + "api/config", headers=headers)
112112
resp_dict = json.loads(resp.text)
113-
# logging.debug(f"hass/api/config: {resp.text}")
113+
logging.debug(f"hass/api/config: {resp.text}")
114114
self.config.set("latitude", resp_dict["latitude"])
115115
self.config.set("longitude", resp_dict["longitude"])
116116
self.config.set("time_zone", resp_dict["time_zone"])
117117
self.time_zone = resp_dict["time_zone"]
118-
self.config.set("country", resp_dict["country"])
118+
country = resp_dict["country"]
119+
if country is None or country == "":
120+
country = "NL"
121+
self.config.set("country", country)
119122
self.db_da = self.config.get_db_da()
120123
self.db_ha = self.config.get_db_ha()
121124
self.meteo = Meteo(self.config, self.db_da)

dao/prog/da_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2944,7 +2944,7 @@ def get_api_data(self, field: str, _periode: str, cumulate: bool = False):
29442944
df[field] = df[field].cumsum()
29452945
elif field == "da":
29462946
df = self.get_price_data(
2947-
self.periodes[periode]["vanaf"], self.periodes[periode]["tot"]
2947+
self.periodes[periode]["vanaf"], self.periodes[periode]["tot"], self.interval
29482948
)
29492949
elif field[0:3] == "soc":
29502950
df = self.get_soc_data(field, self.periodes[periode]["vanaf"], tot)

dao/prog/day_ahead.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def calc_optimum(
943943
boiler_temp = [
944944
model.add_var(
945945
var_type=CONTINUOUS,
946-
lb=min(boiler_act_temp, boiler_setpoint - boiler_hysterese),
946+
lb=min(boiler_act_temp, boiler_setpoint - boiler_hysterese - 10),
947947
ub=boiler_setpoint + 10,
948948
)
949949
for _ in range(U + 1)
@@ -2314,9 +2314,9 @@ def calc_optimum(
23142314
# strategy optimization
23152315
#####################################################
23162316
# settings
2317-
model.max_mip_gap_abs = 0.001
2317+
model.max_mip_gap_abs = 0.005
23182318
model.max_nodes = 1500
2319-
model.max_seconds = 20
2319+
# model.max_seconds = 20
23202320
if self.log_level > logging.DEBUG:
23212321
model.verbose = 0
23222322
model.check_optimization_results()
@@ -2679,9 +2679,9 @@ def calc_optimum(
26792679
d_f = d_f.astype({"uur": str})
26802680
d_f.loc["total"] = d_f.iloc[:, 1:].sum()
26812681
cost_consumption = d_f.loc["total"]["cost"]
2682-
tariff_consumption = cost_consumption / delivery.x
2682+
tariff_consumption = cost_consumption / delivery.x if delivery.x != 0 else 0.0
26832683
profit_production = d_f.loc["total"]["profit"]
2684-
tariff_production = profit_production / production.x
2684+
tariff_production = abs(profit_production) / production.x if production.x != 0 else 0.0
26852685
# d_f.loc['total'] = d_f.loc['total'].astype(object)
26862686

26872687
d_f.at[d_f.index[-1], "uur"] = "Totaal"
@@ -2720,7 +2720,7 @@ def calc_optimum(
27202720
+ boiler_storage
27212721
)
27222722

2723-
logging.info("/nCalculation profit after optimize in €\n"
2723+
logging.info("\nCalculation profit after optimize in €\n"
27242724
f"Cost before optimize {old_cost_da: 7.2f}\n"
27252725
f"Cost consumption {cost_consumption: 7.2f}\n"
27262726
f"Profit production {profit_production: 7.2f}\n"
@@ -2736,7 +2736,7 @@ def calc_optimum(
27362736
if not self.debug:
27372737
logging.info("Doorzetten van alle settings naar HA")
27382738
else:
2739-
logging.info("Onderstaande settings worden NIET doorgezet naar HA")
2739+
logging.info("Onderstaande settings worden NIET doorgezet naar HA (debug-run)")
27402740

27412741
"""
27422742
set helpers output home assistant

release-testing/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog 刀 DAO
22
# Day Ahead Optimizer
3+
# 2025.10.1.rc1
4+
This version is similar with 2025.10.1 in the stable-channel.<br>
5+
Fixes:
6+
- deleted max_seconds limit
7+
- max_mip_gap set to 0.005 (was 0.001)
8+
- added logging.debug of hass/api/config
9+
- fixed divide-zero error when production or consumption are 0.0
10+
- when no country is configured in HA, "NL" is assumed
11+
- "api/report/da/vandaag" and "api/report/da/vandaag en morgen" present data with the configured interval
12+
- added documentation about the interval-setting to DOCS.md
13+
14+
Know issue:
15+
- The forecast in the reports still nog good working
16+
317
# 2025.10.0.rc1
418
This version is similar with 2025.10.0 in the stable-channel
519
- Fix error with storing forecast (there was no timezone-correction)

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: 2025.10.0.rc1
3+
version: 2025.10.1.rc1
44
stage: experimental
55
slug: day_ahead_opt-testing
66
description: Beta version of DAO. Use only for testing!

0 commit comments

Comments
 (0)