mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Improve type hint in opensky (#77829)
This commit is contained in:
parent
36f3028ec3
commit
d6ca3544ee
@ -147,7 +147,7 @@ class OpenSkySensor(SensorEntity):
|
||||
}
|
||||
self._hass.bus.fire(event, data)
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update device state."""
|
||||
currently_tracked = set()
|
||||
flight_metadata = {}
|
||||
@ -159,18 +159,17 @@ class OpenSkySensor(SensorEntity):
|
||||
flight_metadata[callsign] = flight
|
||||
else:
|
||||
continue
|
||||
missing_location = (
|
||||
flight.get(ATTR_LONGITUDE) is None or flight.get(ATTR_LATITUDE) is None
|
||||
)
|
||||
if missing_location:
|
||||
continue
|
||||
if flight.get(ATTR_ON_GROUND):
|
||||
if (
|
||||
(longitude := flight.get(ATTR_LONGITUDE)) is None
|
||||
or (latitude := flight.get(ATTR_LATITUDE)) is None
|
||||
or flight.get(ATTR_ON_GROUND)
|
||||
):
|
||||
continue
|
||||
distance = util_location.distance(
|
||||
self._latitude,
|
||||
self._longitude,
|
||||
flight.get(ATTR_LATITUDE),
|
||||
flight.get(ATTR_LONGITUDE),
|
||||
latitude,
|
||||
longitude,
|
||||
)
|
||||
if distance is None or distance > self._radius:
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user