chargelog: time charged only if charge state true#2726
Merged
LKuemmel merged 4 commits intoopenWB:masterfrom Oct 29, 2025
Merged
chargelog: time charged only if charge state true#2726LKuemmel merged 4 commits intoopenWB:masterfrom
LKuemmel merged 4 commits intoopenWB:masterfrom
Conversation
benderl
reviewed
Oct 28, 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() |
Contributor
There was a problem hiding this comment.
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.
|
|
||
| @dataclass | ||
| class Log: | ||
| begin: Optional[float] = None |
Contributor
There was a problem hiding this comment.
Sollte nicht immer eine Anfangszeit vorhanden sein? Warum ist die optional?
Contributor
Author
There was a problem hiding this comment.
Begin wird beim Ladestart gesetzt. Wenn angesteckt, aber nicht geladen wird, gibt es auch keine Anfangszeit.
ce5ea8e to
b3fb5ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tatsächlichen Zeitpunkt von Ladestart und -ende loggen und für den kompletten Ladevorgang aufsummieren.