Custom Component: Flightradar24

About radius it depends how many flights pass your area. More flights make more requests to FlightRadar. There is request amount restrictions if you dont have flightradar subscription. So the best way is to test by our own

Just use url in markdown like

type: vertical-stack
title: Flightradar24
cards:
  - type: entities
    entities:
      - entity: sensor.flightradar24_current_in_area
        name: In area
  - type: conditional
    conditions:
      - condition: numeric_state
        entity: sensor.flightradar24_current_in_area
        above: 0
    card:
      type: markdown
      content: >-
        {% set data = state_attr('sensor.flightradar24_current_in_area',
        'flights') %} {% for flight in data %}
          <ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }}({{ flight.aircraft_registration }}) - {{ flight.airline_short }} - {{ flight.aircraft_model }}
          ...
          [Open FlightRadar](https://www.flightradar24.com/{{ flight.callsign }})
          {% endfor %}

Hi @AlexandrErohin ,

First off, I would like to say thank-you kindly for putting this integration together. Itā€™s very cool!

A feature request. Iā€™m an airline pilot and Iā€™d love to be able to load my schedule so the rest of the family can track where I am. Initially, even having the capability to load flights one at a time would work, but I suppose it would mean having the ability to include a date when inputting a flight number via the Additional Tracked input method, and it would ā€œpopupā€, so-to-speak, in the table when itā€™s time?

I also have my work calendar (via an Outlook 365 integration) as an entity in Home Assistant already. What I love about this calendar is that it updates automatically when the company changes my schedule. Ideally, it would be awesome if this integration could interface with my work calendar and automatically pull my flights on a given date automatically. Not to be greedy, of courseā€¦

This integration is awesome! I appreciate your hard work. Thanks again!

(Perhaps I should post this in GitHub as a feature request?)

1 Like

This such a great integration - thank you so much for putting it together. As a relative newcomer to HA, I was wondering if there was a way to provide a daily summary of the flights that have overflown. I get about 6 a day so it would not be a massive amount of data. I think Iā€™ve worked out how to use a trigger sensor to transfer a particular flightā€™s details to another sensor but this would only show the last flight and overwrite after each new flight.

Hi Alex,

I have played around with so many different numbers, and for some reason the last three of four configurations, no matter what size I alter the radius to, it keeps showing ā€˜unknownā€™ for the sensors. Basically what I am trying to do is cover as large an area as possible via the radius and then setup an automation whereby I have a condition template to look out for particular call signs. I just canā€™t seem to figure out what the largest allowed radius is? The only other alternative I can think of is setting up a dozen of so smaller ones but I would rather have to only setup 2 or 3 large radius zones. Thanks :slight_smile:

@neil.sayer Hi.
You may always send notification when a new flight appears. So you will get a list of all flights in notifications

I have around 800 flights in a day - so store all of them would be a massive amount of data

@steve1123 Hi

Addition tracking is mostly used for tracking a flight that passed user area. And when the flight is over it is automatically removed from tracking. Adding flight that will be tracked in future is a problem, because flightradar api doesnt have difference in scheduled flight and finished flight.

You may integrate your calendar with this integration like this. Calendar - Home Assistant

Create an automation - when an event from calendar starts - it adds a flight to additional tracking

1 Like

Is there any errors in logs?

I didnt check the large radius - so I can suggest you nothing on this

Thanks Alex :slight_smile: It seems to start working after a couple of days and I have a radius as large as 1000000, which is great. I also have this template in an automation, which looks out for aircraft that have any of these in their callsigns within the areas I have setup -

{%- for x in ['FORTE','RRR','NICKL','RAGE','VIPER','CLAW','NASA','ANIMAL','ZZZ','LAGR','NCHO','JAKE','HOMER','PYTHON','RCH','HEIST','COBRA','REDEYE','DUKE','REBEL','CL60','YANK','SPAR17','SAM379','RSD73','RSD32','RSD201','SUM9625','SUM9108','SUM9627','SUM9625','SUM9622','SUM9603','SUM9628','HAVOC','CHAOS','83692','54482','42524','GAF','SCARE','DEMON','PLF','RSF','IAM','MMF','APCHE','NAF','NATO','VULTRA','SWORD','TESTR','ASY'] -%}
  {% if x in trigger.event.data.callsign -%}
    {% set ns.i = true -%}
  {% endif -%}
{% endfor -%}
{{ ns.i }}
type or paste code here

Is there anyway you can think of to put that value condition into the cards you have created too? So that it shows the flights it picks up with that any of those specific call signs?

I have HA running on my Synology, with HACS installed. I canā€™t find any custom integration named FlightRadar24, FR24 or anything else that resembles FlightRadarā€¦ what am I doing wrong? Thanks

Have you added this repository as a custom repository into HACS as its not there by defaultā€¦
(Instructions are on GitHub via link in first post)

1 Like

@sam3487 You may try like this

    card:
      type: markdown
      content: >-
        {% set data = state_attr('sensor.flightradar24_current_in_area',
        'flights') %} {% for flight in data %}
          {% if flight.callsign in ('FORTE','RRR','NICKL','RAGE','VIPER','CLAW','NASA','ANIMAL','ZZZ','LAGR','NCHO','JAKE','HOMER','PYTHON','RCH','HEIST','COBRA','REDEYE','DUKE','REBEL','CL60','YANK','SPAR17','SAM379','RSD73','RSD32','RSD201','SUM9625','SUM9108','SUM9627','SUM9625','SUM9622','SUM9603','SUM9628','HAVOC','CHAOS','83692','54482','42524','GAF','SCARE','DEMON','PLF','RSF','IAM','MMF','APCHE','NAF','NATO','VULTRA','SWORD','TESTR','ASY') %}
          <ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }}({{ flight.aircraft_registration }}) - {{ flight.airline_short }} - {{ flight.aircraft_model }}
          ...
          {% endif %}
          {% endfor %}

How to convert the arrival time in a readable format?

v1.9.0 Released

Changelog

Thank you for this! Works great!

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?

2 Likes

@maurizio53 time parameters contain timestamp.
To get readable format use as_datetime() function
like

{{ as_datetime(1712331600) }}

@JurajNyiri Ill try to add in next releases

1 Like

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)

{{ as_timestamp(now(),0)|timestamp_custom("%Y-%m-%d %H:%M" ) }}

edit - and as a disclaimer Iā€™ve a trial and error sort of approach so the above code may not be 100%

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?