Skip to content
Open
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
6 changes: 6 additions & 0 deletions docs/input_mapping/_general.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ As OCPI enforces a maximum of seven digits after the comma, the OCPDB caps all l
and `EVSE` objects to seven digits after the comma. For further details about the OCPI regular expression for location
data, please have a look at the
[OCPI specification](https://github.com/ocpi/ocpi/blob/release-2.2.1-bugfixes/mod_locations.asciidoc#mod_locations_geolocation_class).


## EVSE: last status update

The extended OCPI output has a field `Evse.status_last_updated` which is used to update the status of an EVSE. It is
updated as soon as a status change is detected.
7 changes: 4 additions & 3 deletions webapp/services/import_services/base_import_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ def save_evse_updates(self, evse_updates: list[EvseUpdate | EvseRealtimeUpdate])
continue

evse.last_updated = evse_update.last_updated or datetime.now(tz=timezone.utc)
evse.status_last_updated = (
evse_update.status_last_updated or evse_update.last_updated or datetime.now(tz=timezone.utc)
)
if evse.status_last_updated is None or evse.status != evse_update.status:
evse.status_last_updated = (
evse_update.status_last_updated or evse_update.last_updated or datetime.now(tz=timezone.utc)
)

for key, value in evse_update.to_dict().items():
if key in ['last_updated', 'status_last_updated']:
Expand Down
Loading