Custom Component: Flightradar24

Sorry my delayed response had some local issues which crashed my HA.
here is tested working and better commented suggested automation for your requirements

# verified sample output: 
# "Flight nearby is, Virgin Australia, Flight VA519, Registed as , Boeing 737, airport Sydney Kingsford Smith Airport to Gold Coast Airport, 
# It is 6 km away, at 10750 feet, Heading North-Northeast"

# the following creates a text string in 'announce_details' that is used to speak / display selected information (if available) from detected aircraft:
alias: WIP 2025-07-02 V5 HELP Flight entered Zone - Notify
description: Aircraft entered watch zone around home so notify with audio
triggers:
  - event_type: flightradar24_entry
    trigger: event
conditions:
  - condition: time
    after: "09:00:00"
    before: "19:00:00"
  - condition: state
    entity_id: binary_sensor.do_not_disturb
    state: "off"
actions:
  - alias: Announce aircraft with plain TTS
    action: tts.google_translate_say
    data:
      entity_id: media_player.display_bedroom
      message: "{{ announce_details }}"
variables:
  flight_data: "{{ trigger.event.data if trigger.event.data is defined else {} }}"
  announce_details: |-
    {% set announce_details = [] %} {% if not flight_data %}
      {% set announce_details = ['No aircraft detected entering area'] %}
    {% else %}
      {% set announce_details = ['Flight nearby is'] %}

      {# add aircraft airline name (short version) if available from detected aircraft #}
      {% if flight_data.get('airline_short') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + [flight_data.airline_short] %}
      {% endif %}

      {# add aircraft flight number if available from detected aircraft #}
      {% if flight_data.get('flight_number') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['Flight ' ~ flight_data.flight_number] %}
      {% endif %}

      {# add aircraft registration if available from detected aircraft #}
      {% if flight_data.get('aircraft_registration') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['Registed as ' ~ flight_data.registration] %}
      {% endif %}

      {# add aircraft model if available from detected aircraft #}
      {% if flight_data.get('aircraft_model') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + [flight_data.aircraft_model.split('-')[0]] %}
      {% endif %}

      {# add aircraft (origin and destination)airport name if available from detected aircraft #}
      {% if flight_data.get('airport_origin_name') and flight_data.get('airport_destination_name') %}
        {% set announce_details = announce_details + ['from ' ~ flight_data.airport_origin_name ~ ' to ' ~ flight_data.airport_destination_name] %}
      {% endif %}

      {# add aircraft distance from tracking location if available from detected aircraft #}
      {% if flight_data.get('distance') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['aircraft is ' ~ (flight_data.distance | round(0, 'floor')) ~ ' km away'] %}
      {% endif %}

      {# add aircraft altitude (in feet) if available from detected aircraft #}
      {% if flight_data.get('altitude') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['at ' ~ (flight_data.altitude | round(0, 'floor')) ~ ' feet'] %}
      {% endif %}

      {# add compass bearing (after calculating) of aircraft if available from detected aircraft #}
      {% if flight_data.get('heading') not in [None, 'unknown', ''] %}
        {% set compass_directions = ['North', 'North-Northeast', 'Northeast', 'East-Northeast', 'East', 'East-Southeast', 'Southeast', 'South-Southeast', 'South', 'South-Southwest', 'Southwest', 'West-Southwest', 'West', 'West-Northwest', 'Northwest', 'North-Northwest'] %}
        {% set heading_index = ((flight_data.heading | float(0) + 11.25) // 22.5) | int %}
        {% set heading_direction = compass_directions[heading_index % 16] %}
        {% set announce_details = announce_details + ['Heading ' ~ heading_direction] %}
      {% endif %}
    {% endif %} {{ announce_details | join(', ') }}

Thanks Lozinoz, will try later today. I too have been very busy and haven’t worked on it , cheers Shane

thanks lozinoz, i have given up on this. nothing coming from speaker. Other HA reports google translate say no longer works and i have tried changing to tts.say but with no success. Appreciate your help anyway. The automation is triggering just nothing spoken from it

humm thats frustrating. happy if you want to send in full your automation and ill check it. FYI Google translate working just fine on my system, but that aside lets dumb it down to get it working for you.

Hi Lozinoz, the full automation I have is below. Sorry for the delay been busy with life lol. whatever I’m doing it is not speaking. Even though HA recommends tts.speak I am trying tts.say today. I can confirm tts.say did not work, HA says it doesn’t exist, so I went back to tts.speak, still no response. Sorry to be a pain lol

If it helps info about my HA

  • Installation method Home Assistant Container
  • Core 2025.5.3
  • Frontend 20250516.0
description: Aircraft entered watch zone around home so notify with audio
triggers:
  - event_type: flightradar24_entry
    trigger: event
conditions:
  - condition: time
    after: "06:00:00"
    before: "19:00:00"
actions:
  - alias: Announce aircraft with plain TTS
    action: tts.speak
    data:
      entity_id: media_player.living_room_display
      message: "{{ announce_details }}"
variables:
  flight_data: "{{ trigger.event.data if trigger.event.data is defined else {} }}"
  announce_details: |-
    {% set announce_details = [] %} {% if not flight_data %}
      {% set announce_details = ['No aircraft detected entering area'] %}
    {% else %}
      {% set announce_details = ['Flight nearby is'] %}

      {# add aircraft airline name (short version) if available from detected aircraft #}
      {% if flight_data.get('airline_short') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + [flight_data.airline_short] %}
      {% endif %}

      {# add aircraft flight number if available from detected aircraft #}
      {% if flight_data.get('flight_number') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['Flight ' ~ flight_data.flight_number] %}
      {% endif %}

      {# add aircraft registration if available from detected aircraft #}
      {% if flight_data.get('aircraft_registration') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['Registed as ' ~ flight_data.registration] %}
      {% endif %}

      {# add aircraft model if available from detected aircraft #}
      {% if flight_data.get('aircraft_model') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + [flight_data.aircraft_model.split('-')[0]] %}
      {% endif %}

      {# add aircraft (origin and destination)airport name if available from detected aircraft #}
      {% if flight_data.get('airport_origin_name') and flight_data.get('airport_destination_name') %}
        {% set announce_details = announce_details + ['from ' ~ flight_data.airport_origin_name ~ ' to ' ~ flight_data.airport_destination_name] %}
      {% endif %}

      {# add aircraft distance from tracking location if available from detected aircraft #}
      {% if flight_data.get('distance') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['aircraft is ' ~ (flight_data.distance | round(0, 'floor')) ~ ' km away'] %}
      {% endif %}

      {# add aircraft altitude (in feet) if available from detected aircraft #}
      {% if flight_data.get('altitude') not in [None, 'unknown', ''] %}
        {% set announce_details = announce_details + ['at ' ~ (flight_data.altitude | round(0, 'floor')) ~ ' feet'] %}
      {% endif %}

      {# add compass bearing (after calculating) of aircraft if available from detected aircraft #}
      {% if flight_data.get('heading') not in [None, 'unknown', ''] %}
        {% set compass_directions = ['North', 'North-Northeast', 'Northeast', 'East-Northeast', 'East', 'East-Southeast', 'Southeast', 'South-Southeast', 'South', 'South-Southwest', 'Southwest', 'West-Southwest', 'West', 'West-Northwest', 'Northwest', 'North-Northwest'] %}
        {% set heading_index = ((flight_data.heading | float(0) + 11.25) // 22.5) | int %}
        {% set heading_direction = compass_directions[heading_index % 16] %}
        {% set announce_details = announce_details + ['Heading ' ~ heading_direction] %}
      {% endif %}
    {% endif %} {{ announce_details | join(', ') }}

type or paste code here

Interesting, I have the automation enabled and did a trace (not that I’m sure what I’m doing lol, but I see this issue, if that helps

Cheers

Shane

Executed: July 18, 2025 at 07:43:19
Error: required key not provided @ data['media_player_entity_id']
Result:
params:
  domain: tts
  service: speak
  service_data:
    entity_id: media_player.living_room_display
    message: >-
      Flight nearby is, Registed as , Cessna 337G Super Skymaster, from
      Melbourne Moorabbin Airport to Mount Gambier Airport, aircraft is 0 km
      away, at 150 feet, Heading North
  target: {}
running_script: false
type or paste code here

Hey @AlexandrErohin and fellow FlightRadar24 fans,

TLDR:

  1. Is there a way to trigger automations based on when a flight leaves the gate, and after it has arrived at the gate (perhaps using the tracked_type attribute?)
  2. How can we get flights to remove themselves from the additional_tracked parameters after it has arrived at the gate.

@AlexandrErohin if you happen to recall, last year, you had worked on the ā€œscheduledā€ flight system, which allowed me to load my flight schedule and setup various automations based on my assigned flights, which works great! Thank-you again for that!

I’ve been trying to setup some additional automations based on what phase of flight an aircraft is in. Specifically I’m looking to determine:

  1. When a flight has left the gate
    2. When a flight takes-off
    3. When a flight lands.
  2. When a flight has arrived at the gate

The flightradar24_tracked_took_off, and flightradar24_tracked_landed, triggers always work perfectly. So that takes care of 2 and 3.

I’ve been trying to utilize the ā€œtracked_typeā€ attribute, which shows whether a flight is ā€œscheduledā€ or ā€œliveā€. However, the test automations I’ve setup never seems to ā€œfireā€ when tracked_type changes from scheduled to live, or vice versa. I’ve included a sample automation below, I’m probably just messing up something simple. In any case, would you or anyone have any recommendations on how best to implement this? I suppose if there was a ā€œleft_gateā€ and ā€œarrivedā€ trigger, similar to the takeoff/landing triggers, that would be slick and work perfectly, but I would think there has to be a way of using the tracked_type attribute, no?

Thanks in advance!

Oh, one other quick q. If I recall correctly, in past versions of this integration, flights that were added via additional_tracked seemed to just ā€œdrop offā€ at the end of the flight. Now, flights appear to remain ā€œin memoryā€, for lack of a better word, after the flight arrives. I’ve seen the same flight reappear the following day for a regularly scheduled, daily flight. Since I want the flight to indeed ā€œdrop offā€ or be removed after it arrives, I’m guessing I should add an automation that uses the Remove from Track command to remove the specified flight? I know there’s a Clear Additional, but that removes all flights, and there may be rare occasions when there’s 2 flights in the Additional Tracked, so removing all might not be the best option.

alias: flight_live
description: ""
triggers:
  - trigger: state
    entity_id: sensor.flightradar24_additional_tracked
    attribute: tracked_type
    from: schedule
    to: live
conditions: []
actions:
  - action: notify.mobile_app_steve_phone
    metadata: {}
    data:
      message: Flight has left the gate.
mode: single

v1.28.0 Released

Changelog

1 Like

I need help… I’m a pilot. I almost always fly the same commercial aircraft. I’d like to be able to track my plane only by its registration number, not its flight number (which changes frequently), and create automations based on its movements (where it is, when it takes off, and when it lands). Is it possible to integrate this into HA with FR24?

I would need to be able to receive notifications on my phone when it takes off and lands.

Thanks.

There’s a lot of information on this topic… if you could direct me to the right post I’d really appreciate it.

1 Like

Just want to mention that this integration is brilliant and such a fun option to play with, so thank you!

One request - could we please have it so that the API Data Fetching toggle keeps its value after restart?

I disable the API Data Fetching toggle when I don’t want aircraft notifications. Sure I can disable the automation but I simply don’t want the integration to continue querying an API every ten seconds for days on end if I’m just going to discard the data anyway - plus I’ve heard people getting their IP banned by Flight Radar for excessive usage so trying to keep my usage to the minimum.

However, I was surprised to find that after a Home Assistant update and restart that the API Data Fetching toggle turned itself back on without my permission or knowledge and I started getting unexpected announcements and notifications about aircraft. This is kinda poor form as the user should be in control of this.

In short, please don’t reset the Data Fetching API toggle back to on after every server restart.

Thanks!

Are there any other options for ā€˜label1’ besides ā€˜reg’?

https://www.flightradar24.com/simple?lat=LATITUDE&lon=LONGITUDE&z=ZOOM&label1=reg&size=small

did you try some things like: flight, alt, speed
or try to add more labels with label1, label2
e.g.: &label1=reg&label2=alt

Hi all,
Please could you share some simple YAML configuration for see the flights enter to an area?
I see the flight on map but not detect and i cant see with de detail.

Here is my code:

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 }}
          {{ flight.airport_origin_city }}{%if flight.airport_origin_city %}<img src="https://flagsapi.com/{{ flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/>{% endif %} -> {{ flight.airport_destination_city }}{%
          if 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.time_scheduled_departure %}Departure - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }}; {% endif %}{%if flight.time_scheduled_arrival%}Arrival - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %}
          Altitude - {{ flight.altitude }} ft{%if flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}; Gr. speed - {{ flight.ground_speed }} kts{%if flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%}
          {% endfor %}
  - type: iframe
    url: >-
      https://www.flightradar24.com/simple?lat=43.42&lon=-6.19&z=9&label1=reg&size=small
    aspect_ratio: 100%

Thank you!!

Hi there…
I was playing around with this cool stuff!
All works flawless…
But i noted when a plain enters my neighborhood
But with no call sign or flight number…
All my other plain will go away in the card

Then a popup gives me this error:
TypeError: unsupported operand type(s) for -: ā€˜NoneType’ and ā€˜NoneType’

As soon that plain fannish from my range …all will be fine again

Any clue someone?

Thank you…

sounds like an issue with the card you are using rather than this Integration (as that seems to be reporting the flight correctly)…what card is it you are using as maybe you need to follow up there?

Hi Gav! first thank you fr the reply…
i did used the original markdown card…
but alterd it alot…
ill give you the code…

type: markdown
    content: >-
{% set data = state_attr('sensor.flightradar24_current_in_area',
  'flights') %} {% for flight in data %}
<ha-icon icon="mdi:sign-real-estate"></ha-icon>  Vlucht Nummer:  <font color= '#0077e9'></font>  <font color='#ffff00'>{{ flight.flight_number }}</font>
<ha-icon icon="mdi:airplane"></ha-icon> Regnr:  <font color= '#32cd32'>{{ flight.aircraft_registration }}</font>
<ha-icon icon="mdi:shield-airplane"></ha-icon>  Vlieg Maatschapij:  <font color= '#32cd32'>{{ flight.airline_short }}</font>
<ha-icon icon="mdi:airplane-search">  </ha-icon>  Vliegtuig Type:  <font color= '#32cd32'>{{ flight.aircraft_model }}</font>
<ha-icon icon="mdi:airport"></ha-icon>  Van:<font color= '#32cd32'>  {{ flight.airport_origin_city }}{%if flight.airport_origin_city %}  <img src="https://flagsapi.com/{{flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/>{% endif %}</font>  
<ha-icon icon="mdi:airport"></ha-icon>  Naar:  <font color= '#32cd32'> {{ flight.airport_destination_city }}{%
  if 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 %}</font>
<ha-icon icon="mdi:airplane-takeoff"></ha-icon>{%if flight.time_scheduled_departure %}  Vertrek:  <font color= '#32cd32'>{{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }} {% endif %}</font>{%if flight.time_scheduled_arrival%}
<ha-icon icon="mdi:airplane-landing"></ha-icon> Aankomst:  <font color= '#32cd32'>{{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %}</font>
<ha-icon icon="mdi:airplane-clock"></ha-icon>  Vliegtijd: <font color= '#32cd32'>{{
  ((flight.time_scheduled_arrival - flight.time_scheduled_departure) / 3600) |
  int }}h {{ (((flight.time_scheduled_arrival - flight.time_scheduled_departure)
  % 3600) / 60) | int }}m</font>
<ha-icon icon="mdi:altimeter"></ha-icon> Hoogte:  <font color= '#32cd32'>{%if flight.altitude > 0 %} {{(flight.altitude * 0.3048)| round(0)}} m{% endif%}</font>
<ha-icon icon="mdi:speedometer"></ha-icon>  Snelheid:  <font color= '#32cd32'>{%if flight.ground_speed > 0 %} {{(flight.ground_speed * 1.852)| round(0)}} km/h{% endif%}</font>
<ha-icon icon="mdi:map-marker-distance"></ha-icon> Afstand: <font color= '#32cd32'>{%if flight.distance > 0 %} {{(flight.distance )| round(0)}} km{% endif%}</font>

<img src="{{ flight.aircraft_photo_medium }}"></img>
...
[Open FlightRadar](https://www.flightradar24.com/{{ flight.callsign }})
...
    {% endfor %}

The plaininfo that give me the error was > AW 189 <

I think your template IF statements in the card are causing you issue as when the Flight has no call sign/other info the IF is falling over…take that out and see how/if it works next time a flight with no detail is overhead…if card still displays then you know the issue and can tweak from there

(and just to say that I’m far from a template expert…more a trial and error guy so I may be on the wrong assumption here)

I did removed the distance stuff that was in…
Let’s see if that helps…
Cause the original markdown code worked…
So now im curious how to get that correct in again…
Thanks Gav_in…appreciate it!
Wonders how to add that now again tho

edit: adding distance succeeded…
but…in the original code there is If also in it…
so in my eyes it can’t be the issue there i think…

Hey @AlexandrErohin,

Sorry to bother again. I was wondering if there might be any way to add triggers for ā€œLeft Gateā€ and ā€œArrived at Gateā€? Much like the take-off/landing triggers, which work flawlessly everytime.

I tried putting something together using the other parameters, (basically when a tracked flight goes to/from ā€œliveā€ / ā€œscheduledā€ and it’s hit or miss.

Thanks again for a great integration!

I did try some, but because I don’t know the options, I failed repeatedly.

How did you find the ones you mentioned?