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)
|
self._hass.bus.fire(event, data)
|
||||||
|
|
||||||
def update(self):
|
def update(self) -> None:
|
||||||
"""Update device state."""
|
"""Update device state."""
|
||||||
currently_tracked = set()
|
currently_tracked = set()
|
||||||
flight_metadata = {}
|
flight_metadata = {}
|
||||||
@ -159,18 +159,17 @@ class OpenSkySensor(SensorEntity):
|
|||||||
flight_metadata[callsign] = flight
|
flight_metadata[callsign] = flight
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
missing_location = (
|
if (
|
||||||
flight.get(ATTR_LONGITUDE) is None or flight.get(ATTR_LATITUDE) is None
|
(longitude := flight.get(ATTR_LONGITUDE)) is None
|
||||||
)
|
or (latitude := flight.get(ATTR_LATITUDE)) is None
|
||||||
if missing_location:
|
or flight.get(ATTR_ON_GROUND)
|
||||||
continue
|
):
|
||||||
if flight.get(ATTR_ON_GROUND):
|
|
||||||
continue
|
continue
|
||||||
distance = util_location.distance(
|
distance = util_location.distance(
|
||||||
self._latitude,
|
self._latitude,
|
||||||
self._longitude,
|
self._longitude,
|
||||||
flight.get(ATTR_LATITUDE),
|
latitude,
|
||||||
flight.get(ATTR_LONGITUDE),
|
longitude,
|
||||||
)
|
)
|
||||||
if distance is None or distance > self._radius:
|
if distance is None or distance > self._radius:
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user