1 """Helper functions for the Traccar Server integration."""
3 from __future__
import annotations
5 from pytraccar
import DeviceModel, GeofenceModel
8 def get_device(device_id: int, devices: list[DeviceModel]) -> DeviceModel |
None:
9 """Return the device."""
11 (dev
for dev
in devices
if dev[
"id"] == device_id),
17 geofences: list[GeofenceModel],
19 ) -> GeofenceModel |
None:
20 """Return the geofence."""
22 (geofence
for geofence
in geofences
if geofence[
"id"]
in target),
GeofenceModel|None get_first_geofence(list[GeofenceModel] geofences, list[int] target)
DeviceModel|None get_device(int device_id, list[DeviceModel] devices)