Skip to content

Conversation

@LKuemmel
Copy link
Contributor

@LKuemmel LKuemmel commented Sep 2, 2025

tatsächlichen Zeitpunkt von Ladestart und -ende loggen und für den kompletten Ladevorgang aufsummieren.

@LKuemmel LKuemmel added this to the 2.1.9 milestone Sep 2, 2025
@LKuemmel LKuemmel changed the title time charged only if plug state true chargelog: time charged only if plug state true Sep 2, 2025
@LKuemmel LKuemmel requested a review from benderl September 8, 2025 10:44
@LKuemmel LKuemmel changed the title chargelog: time charged only if plug state true chargelog: time charged only if charge state true Sep 10, 2025
Comment on lines 109 to 111
log_data.time_charged += timecheck.create_timestamp() - log_data.timestamp_start_charging
log_data.timestamp_start_charging = None
log_data.end = timecheck.create_timestamp()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timecheck.create_timestamp() kann direkt als log_data.end verwendet werden. Dann ist der Zeitstempel auch konsistent, was bei zweimaligem Aufruf vermutlich nicht der Fall wäre.

Suggested change
log_data.time_charged += timecheck.create_timestamp() - log_data.timestamp_start_charging
log_data.timestamp_start_charging = None
log_data.end = timecheck.create_timestamp()
log_data.end = timecheck.create_timestamp()
log_data.time_charged += log_data.end - log_data.timestamp_start_charging
log_data.timestamp_start_charging = None

Noch besser wäre es, wenn der Zeitstempel in der Methode komplett konsistent ist und z.B. nach Zeile 73 erstellt wird.
now = timecheck.create_timestamp()
Im weiteren Verlauf der Methode wird dann immer auf now zugegriffen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umgesetzt


@dataclass
class Log:
begin: Optional[float] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollte nicht immer eine Anfangszeit vorhanden sein? Warum ist die optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Begin wird beim Ladestart gesetzt. Wenn angesteckt, aber nicht geladen wird, gibt es auch keine Anfangszeit.

@LKuemmel LKuemmel merged commit c911221 into openWB:master Oct 29, 2025
1 check passed
@LKuemmel LKuemmel deleted the fix_chargelog branch October 29, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants