-
Notifications
You must be signed in to change notification settings - Fork 107
chargelog: time charged only if charge state true #2726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| log_data.time_charged += timecheck.create_timestamp() - log_data.timestamp_start_charging | ||
| log_data.timestamp_start_charging = None | ||
| log_data.end = timecheck.create_timestamp() |
There was a problem hiding this comment.
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.
| 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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
ce5ea8e to
b3fb5ef
Compare
tatsächlichen Zeitpunkt von Ladestart und -ende loggen und für den kompletten Ladevorgang aufsummieren.