From 85b61493dbf87ba448b2edb3e31967cecc227d0a Mon Sep 17 00:00:00 2001 From: Zuinige Rijder Date: Mon, 5 Aug 2024 14:40:48 +0200 Subject: [PATCH] introduced setting for including regeneration in consumption daily stats --- README.md | 2 ++ dailystats.py | 7 ++++++- monitor.cfg | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index de1aefc..a4707bd 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,7 @@ use_geocode = True use_geocode_email = True language = en odometer_metric = km +include_regenerate_in_consumption = False ``` Explanation of the configuration items: @@ -220,6 +221,7 @@ Explanation of the configuration items: - use_geocode_email: (default: True) use email to avoid abuse of address lookup - language: (default: en) the Bluelink App is reset to English for users who have set another language in the Bluelink App in Europe when using hyundai_kia_connect_api, you can configure another language as workaround - odometer_metric, e.g. km or mi +- include_regenerate_in_consumption, in [R3.23.0](https://github.com/ZuinigeRijder/hyundai_kia_connect_monitor/releases/tag/R3.23.0) the regeneration is taken into account for the consumption in daily stats, to better match the boardcomputer values. However, some users have better results in the old situation. Included a setting, default is the old situation before R3.23.0. *Note: language is only implemented for Europe currently.* diff --git a/dailystats.py b/dailystats.py index a3750e0..2fcd6e6 100644 --- a/dailystats.py +++ b/dailystats.py @@ -86,6 +86,10 @@ def dbg(line: str) -> bool: parser.read(get_filepath("monitor.cfg")) monitor_settings = dict(parser.items("monitor")) ODO_METRIC = get(monitor_settings, "odometer_metric", "km").lower() +INCLUDE_REGENERATE_IN_CONSUMPTION = ( + get(monitor_settings, "include_regenerate_in_consumption", "False").lower() + == "true" +) # indexes to splitted monitor.dailystats.csv items DATE = 0 @@ -530,7 +534,8 @@ def print_dailystats( batterycare: int, ) -> None: """print stats""" - consumed = consumed + regenerated # car efficiency is including regenerated + if INCLUDE_REGENERATE_IN_CONSUMPTION: + consumed = consumed + regenerated # car efficiency is including regenerated regenerated_perc = safe_divide(regenerated * 100, consumed) engine_perc = safe_divide(engine * 100, consumed) climate_perc = safe_divide(climate * 100, consumed) diff --git a/monitor.cfg b/monitor.cfg index a389f0d..2796f65 100644 --- a/monitor.cfg +++ b/monitor.cfg @@ -8,3 +8,4 @@ use_geocode = True use_geocode_email = True language = en odometer_metric = km +include_regenerate_in_consumption = False