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