diff --git a/dao/CHANGELOG.md b/dao/CHANGELOG.md index 9fd94f1..e9f73ab 100644 --- a/dao/CHANGELOG.md +++ b/dao/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog 刀 DAO # Day Ahead Optimizer +## [V2024.11.0] +- Fixed a db-error when getting Tibber-data with the default sqlite-db ## [V2024.10.6] - Fixed a few errors in the graphics for users with more than one battery diff --git a/dao/config.yaml b/dao/config.yaml index 20bb9b5..c2523cc 100644 --- a/dao/config.yaml +++ b/dao/config.yaml @@ -1,6 +1,6 @@ --- name: 刀 Day Ahead Optimizer -version: "2024.10.6" +version: "2024.11.0" slug: day_ahead_opt description: Docker used by Home Assistant Community Add-ons for day ahead optimizations url: https://github.com/corneel27/day-ahead/ diff --git a/dao/prog/utils.py b/dao/prog/utils.py index bbe9c81..f45a5d3 100644 --- a/dao/prog/utils.py +++ b/dao/prog/utils.py @@ -102,13 +102,18 @@ def generate_hourly_timestamps(start_gen: float, end_gen: float) -> list: url = config.get(["api url"], tibber_options, "https://api.tibber.com/v1-beta/gql") db_da_engine = config.get(['database da', "engine"], None, "mysql") db_da_server = config.get(['database da', "server"], None, "core-mariadb") - db_da_port = int(config.get(['database da', "port"], None, 3306)) - db_da_name = config.get(['database da', "database"], None, "day_ahead") + db_da_port = int(config.get(['database da', "port"], None, 0)) + if db_da_engine == "sqlite": + db_da_name = config.get(['database da', "database"], None, "day_ahead.db") + else: + db_da_name = config.get(['database da', "database"], None, "day_ahead") db_da_user = config.get(['database da', "username"], None, "day_ahead") db_da_password = config.get(['database da', "password"]) + db_da_path = config.get(['database da', "db_path"], None, "../data") db_time_zone = config.get(["time_zone"]) - db_da = DBmanagerObj(db_dialect=db_da_engine, db_name=db_da_name, db_server=db_da_server, db_port=db_da_port, - db_user=db_da_user, db_password=db_da_password, db_time_zone=db_time_zone) + db_da = DBmanagerObj(db_dialect=db_da_engine, db_name=db_da_name, db_server=db_da_server, + db_port=db_da_port, db_user=db_da_user, db_password=db_da_password, + db_path=db_da_path, db_time_zone=db_time_zone) prices_options = config.get(["prices"]) headers = { "Authorization": "Bearer " + tibber_options["api_token"],