From 3d308651c91ef2c9861eab266303523e47f37465 Mon Sep 17 00:00:00 2001 From: Alex Erohin Date: Thu, 5 Sep 2024 15:14:14 +0300 Subject: [PATCH] fix Added to track disappears --- README.md | 14 ++++++++++++-- custom_components/flightradar24/coordinator.py | 4 ++++ custom_components/flightradar24/manifest.json | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 45ff07d..b508e84 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,14 @@ automation: action: service: notify.mobile_app_ data: - content: >- + message: >- Flight entry of {{ trigger.event.data.callsign }} to {{ trigger.event.data.airport_destination_city }} [Open FlightRadar](https://www.flightradar24.com/{{ trigger.event.data.callsign }}) + data: + url: >- + https://fr24.com/{{ trigger.event.data.callsign }}/{{ + trigger.event.data.id }} + image: "{{ trigger.event.data.aircraft_photo_medium }}" ``` All available fields in `trigger.event.data` you can check [here](#flight) @@ -130,9 +135,14 @@ automation: action: service: notify.mobile_app_ data: - content: >- + message: >- Flight takes off {{ trigger.event.data.callsign }} to {{ trigger.event.data.airport_destination_city }} [Open FlightRadar](https://www.flightradar24.com/{{ trigger.event.data.callsign }}) + data: + url: >- + https://fr24.com/{{ trigger.event.data.callsign }}/{{ + trigger.event.data.id }} + image: "{{ trigger.event.data.aircraft_photo_medium }}" ``` ### Automation diff --git a/custom_components/flightradar24/coordinator.py b/custom_components/flightradar24/coordinator.py index 2e259a8..e4bd9ed 100644 --- a/custom_components/flightradar24/coordinator.py +++ b/custom_components/flightradar24/coordinator.py @@ -173,7 +173,11 @@ async def _update_flights_tracked(self) -> None: remains = self.tracked.keys() - current.keys() if remains: for flight_id in remains: + size = current.__len__() await self._find_flight(current, self.tracked[flight_id]['flight_number']) + if size == current.__len__(): + current[flight_id] = self.tracked[flight_id] + current[flight_id]['tracked_type'] = 'not_found' self.tracked = current diff --git a/custom_components/flightradar24/manifest.json b/custom_components/flightradar24/manifest.json index f41730b..bffef9a 100644 --- a/custom_components/flightradar24/manifest.json +++ b/custom_components/flightradar24/manifest.json @@ -7,5 +7,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/AlexandrErohin/home-assistant-flightradar24/issues", "requirements": ["FlightRadarAPI==1.3.25", "pycountry==23.12.11"], - "version": "1.15.0" + "version": "1.15.1" } \ No newline at end of file