Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/modules/common/component_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def __init__(self, soc: float, range: Optional[float] = None, soc_timestamp: Opt
if soc_timestamp is None:
self.soc_timestamp = timecheck.create_timestamp()
else:
if soc_timestamp > 1e10: # Convert soc_timestamp to seconds if it is in milliseconds
log.debug(f'Zeitstempel {soc_timestamp} ist in ms, wird in s gewandelt. Modul sollte angepasst werden.')
soc_timestamp /= 1000
self.soc_timestamp = soc_timestamp


Expand Down
3 changes: 3 additions & 0 deletions packages/modules/common/configurable_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def update(self, vehicle_update_data: VehicleUpdateData):
if vehicle_update_data.soc_timestamp is None or vehicle_update_data.soc_timestamp < car_state.soc_timestamp:
# Nur wenn der SoC neuer ist als der bisherige, diesen setzen.
self.store.set(car_state)
elif vehicle_update_data.soc_timestamp > 1e10:
# car_state ist in ms geschrieben, dieser kann überschrieben werden
self.store.set(car_state)
else:
log.debug("Not updating SoC, because timestamp is older.")

Expand Down