Skip to content

Get Device

Fetch a specific device by ID from your Traccar server.

WARNING

  • Standard users can only access devices they own or have been shared with them
  • Admins and managers can access any device

Usage

Use the ThingsTelemetry\Traccar\Facades\Device::get(int $id) method to retrieve a single device.

php
use ThingsTelemetry\Traccar\Facades\Device;

$device = Device::get(6); // ThingsTelemetry\Traccar\Dto\DeviceData

Result

The response is an instance of ThingsTelemetry\Traccar\Dto\DeviceData.

php
$device->id; // 6
$device->name; // "Truck 1"
$device->uniqueId; // "ABC123"
$device->status->value; // "online"
$device->status->label(); // "Online"
$device->category->value; // "truck"
$device->disabled; // false
$device->lastUpdate?->toIso8601String(); // "2019-08-24T14:15:22+00:00"
$device->positionId; // 123
$device->groupId; // 1
$device->phone; // "+123456789"
$device->model; // "TK103"
$device->contact; // "Ops"

// Attributes (typed)
$device->attributes->speedLimit; // 80.0 (knots)
$device->attributes->fuelDropThreshold; // 5.0
$device->attributes->fuelIncreaseThreshold; // 10.0

Key Result Items

  • statusDeviceStatus Enum representing device connection state (online, offline, unknown).
  • categoryDeviceCategory Enum representing device category/type (car, truck, motorcycle, etc.).
  • attributesDeviceAttributesData Typed DTO for device-specific attributes like speed limit, fuel thresholds, etc.
  • lastUpdate?CarbonImmutable When the device last sent a position update (null if never).

Released under the MIT License.