Move DEVICE_TRACKERS a little higher in the file

This commit is contained in:
Jack Boswell (boswelja)
2023-08-12 12:04:23 +12:00
parent 47c7dd0b23
commit 94e1b2462f

View File

@@ -41,6 +41,17 @@ class StarlinkDeviceTrackerEntityDescription(
"""Describes a Starlink button entity."""
DEVICE_TRACKERS = [
StarlinkDeviceTrackerEntityDescription(
key="device_location",
translation_key="device_location",
entity_registry_enabled_default=False,
latitude_fn=lambda data: data.location["latitude"],
longitude_fn=lambda data: data.location["longitude"],
),
]
class StarlinkDeviceTrackerEntity(StarlinkEntity, TrackerEntity):
"""A TrackerEntity for Starlink devices. Handles creating unique IDs."""
@@ -60,14 +71,3 @@ class StarlinkDeviceTrackerEntity(StarlinkEntity, TrackerEntity):
def longitude(self) -> float | None:
"""Return longitude value of the device."""
return self.entity_description.longitude_fn(self.coordinator.data)
DEVICE_TRACKERS = [
StarlinkDeviceTrackerEntityDescription(
key="device_location",
translation_key="device_location",
entity_registry_enabled_default=False,
latitude_fn=lambda data: data.location["latitude"],
longitude_fn=lambda data: data.location["longitude"],
),
]