Here is an improved card example that works well for most tracked as well and does not show Nones and Nulls.
type: vertical-stack
cards:
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.flightradar24_most_tracked
above: 0
card:
type: markdown
content: >-
{% set data = state_attr('sensor.flightradar24_most_tracked', 'flights')
%}
{% for flight in data %}
<ha-icon icon="mdi:airplane"></ha-icon>{%if flight.get('flight_number') and flight.flight_number %}{{ flight.flight_number }} - {% endif %}{%if flight.get('airline_short') and flight.airline_short %}{{ flight.airline_short }} - {% endif %}{%if flight.get('aircraft_model') and flight.aircraft_model %}{{ flight.aircraft_model }} - {% endif %}{%if flight.get('callsign') and flight.callsign %}{{ flight.callsign }}{% endif %}
{%if flight.get('airport_origin_city') and flight.get('airport_origin_country_code') and flight.airport_origin_city %}{{ flight.airport_origin_city }}<img src="https://flagsapi.com/{{ flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/> -> {{ flight.airport_destination_city }}{% endif %}{%
if flight.get('airport_destination_country_code') and flight.airport_destination_country_code %}<img src="https://flagsapi.com/{{ flight.airport_destination_country_code }}/shiny/16.png" title='{{ flight.airport_destination_country_name }}'/>{% endif %}
{%if flight.get('time_scheduled_departure') and flight.time_scheduled_departure %}Departure - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }}; {% endif %}{%if flight.get('time_scheduled_arrival') and flight.time_scheduled_arrival%}Arrival - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %}{%if flight.get('time_estimated_arrival') and flight.time_estimated_arrival%}; Estimated Arrival - {{ flight.time_estimated_arrival | timestamp_custom('%H:%M') }}{% endif %}
{%if flight.get('altitude') and flight.altitude %}Altitude - {{ flight.altitude }} ft;{% endif%}{%if flight.get('altitude') and flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}{%if flight.get('ground_speed') and flight.ground_speed %} Gr. speed - {{ flight.ground_speed }} kts{%if flight.get('ground_speed') and flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%}{% endif%}
[Open FlightRadar](https://www.flightradar24.com/{{ flight.callsign }})
{% endfor %}
view_layout:
position: sidebar
@AlexandrErohin It would be trully great to get an event on landing and lift off for the manually tracked planes. Would this be possible to be added as an event please?
Thanks, but how to add this to the notifications?
I know i can add {{ trigger.event.data.arrival_time }}, but how to transform this in readable format?
that’s not really specific to this integration so you might get the answer/info you need, as well as a whole lot of other background detail from somewhere like this thread…
You’ll end up with something like the below (which shows “Now” as a custom timestamp displaying > 2024-04-05 19:41)
Hey guys, question: I’m tracking one of the Lifeliners in The Netherlands. I’ve set up a circle with a radius of 2000 m and I get a notification when it enters or leaves the circle. But right after it lands, I get another notification that it took off again, while it’s on the ground. What causes this and how can I prevent this? I’m currently tracking it’s callsign.
Hi Jurai…how are you getting this card to work properly…
Looking at the attributes of the sensor.flightradar24_most_tracked from GitHub - AlexandrErohin/home-assistant-flightradar24: Flightradar24 integration for Home Assistant as well as what’s in HA it doesn’t have a load of the data you are showing in your card code…for example airport_destination_country_code or time_scheduled_departure or altitude, etc
Have you done some “magic” to bring this extra data in that I’m missing or what’s going on?
Cheers…makes sense…so using the same code for cards for both Local Flights and “top 10”…
So now my query becomes if it’s possible to add the extra attributes to the Top 10 sensor that are already available via sensor.flightradar24_current_in_area @AlexandrErohin do you think that’s an option?
Thanks very much for your reply! I gave it a go and have it sort of working.
I have a trigger condition that monitors my calendar and filters for my flight numbers. The issue seems that the flight will only populate if the flight has already departed, as you alluded to. So I set the automation to run at departure time +5 minutes. So long as my flight departs on time, all is well. However, if my flight is delayed, it is not added to the additional tracked flights. Is there any way that you can think of to work around this? I could have it fire to add the flight every couple of minutes after departure time for a little while, but that seems clumsy? Any ideas?
EDIT: I’ve also been playing around with the map card as well. I’ll set the lat/lon/zoom to see most of North America, as that’s where most of my flying is. Of course, the map is cluttered with all active flights. Is there any way to only display the additional.tracked.flights parameter? I see on Flightradar24, you can filter based on callsign for subscribers. I’d pay the $15/yr to add this functionality. Is this possible? I see there is parameter of {{ flight.flight_number }} in the map card’s code, not sure it’s for what we’re looking to do though.
Unfortunately, I dont have Flightradar24 subscription, so I can suggestion you nothing on this
You may play with the url. There is filter called filter_callsign for airline filter
I assume that when it leaves the airport, it takes off and when it returns it lands. I checked on the location and added a circle around the location with a 5000 meter radius. Sometimes they have to go around the airport and they may leave the circle and get back in immediately. That could cause 2 notifications. But now a flight taking of causes 2 notifications. If you use my automation you can check, I can supply you with the exact coordinates if needed.