Custom Component: Flightradar24

Hi AlexandrErohin, great thanks :+1::blush:!
But :innocent::sweat_smile: I’m a helicopter pilot and have no flight number.
We only have the call sign because we don’t have any scheduled flights.
It that also possible anyhow :face_with_monocle:?

Could you add your flight to Additional tracked and post here the sensor.flightradar24_additional_tracked attributes values ? You may change the numbers and letters in the values to secure them, I need only to see what is in flight_number, callsign values

Sure, I’ll do that the next time one of our helicopters is in the air :+1::sunglasses:.

v1.21.1 Released

Changelog

  • Added callsign for device_tracker if flight number doesnt exists

Track flights as device_tracker with flight information. To use it - you need to activate this feature
in Configuration. When it is enabled - this integration creates device_tracker
for every additional tracked flight from sensor.flightradar24_additional_tracked.

To create device_tracker for a flight:

  1. Add a flight to Additional tracked by flight number. If it has no flight number, use callsign
  2. Use device_tracker device_tracker.FLIGHT_NUMBER if flight number exists or device_tracker.CALL_SIGN.

To find device_tracker - Go to Developer tools and search for your flight number or callsign - you’ll find sensor
like device_tracker.FLIGHT_NUMBER or device_tracker.CALL_SIGN.

Added callsign. Please try and let me know

The first test looks very promising :helicopter::+1::smile:!
Thank you very much :blush:!!!

v1.21.3 Released

Changelog

AlexandrErohin

Loving the flight radar, however I’m not a coder by any standard, a friend set it up for me, I’ve tweaked things by trial and error more error lol.

Is there an method to set up an automation, via the gui only, to notify me when one of the additional tracked aircraft or any aircraft of a particular callsign to notify me via my google speakers when it enters the area please?

I would like to do several small aircraft at my local airport

Hi Shane… please try this as example and substitute PH-DOC by the registration number of the plane you would like to be announced by your media player of choice (here google nest hub)

alias: Lifeliner 3 test
description: test
triggers:

  • event_type: flightradar24_exit
    trigger: event
    conditions:
  • condition: template
    value_template: “{{ trigger.event.data.aircraft_registration == ‘PH-DOC’ }}”
    actions:
  • data:
    entity_id: media_player.hub
    message: Type here the text to say say by Google Nest Hub
    action: tts.google_say
    mode: single

The device tracker functionality works great, thanks again :+1:!
It seems that “additional_tracked” aircraft are gone and so the device tracker is no longer “connected” to them after a reboot of HA.
Is there a solution to keep them after a reboot or can I add the relevant call signs via a service after reboot?
Thanks a lot for the great support :blush:!

Hi Edda

Thanks but this is code, which I am not familiar with, I’m trying to set up in the GUI.

I will pass this onto my friend who is a bit more savvy on code and see if he knows where it goes, thank you .

If anyone knows how to do this via the GUI please let me know.

i want a announcement through my speakers when a certain (maybe more than one but let’s get this working first lol) plane enters the area and exits the area

This is the code currently but it is not detecting the aircraft so entered or exited. The automation shows it is triggering for aircraft entering or exiting, but not reporting the specified aircraft

alias: Aircraft test
description: “”
triggers:

  • trigger: state
    entity_id:
    • sensor.flightradar24_entered_area
    • sensor.flightradar24_exited_area
      attribute: flights
      conditions:
  • condition: template
    value_template: “{{ trigger.event.data.aircraft_registration == ‘VH-KRR’}}”
    actions:
  • action: notify.mobile_app_sm_s908e
    metadata: {}
    data:
    message: KRR DETECTED
    title: AIRCRAFT
  • action: media_player.play_media
    target:
    entity_id: media_player.nolen_group
    data:
    media_content_id: >-
    media-source://tts/google_translate?message=Attention+KRR+in+or+exiting+airspace&language=en-au
    media_content_type: provider
    metadata:
    title: Attention KRR in or exiting airspace
    thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
    media_class: app
    children_media_class: null
    navigateIds:
    - {}
    - media_content_type: app
    media_content_id: media-source://tts
    - media_content_type: provider
    media_content_id: >-
    media-source://tts/google_translate?message=Attention+KRR+in+or+exiting+airspace&language=en-au
    mode: single

Really nice custom component :+1:
Is it somehow possible to get the picture of the aircraft as part of the notification?

This is a great integration that I have been using for a while. My son is really into aircraft and commercial flight info and likes to monitor local activity.

I had it set up to keep track of the number of flights in my area over the past 24 hours just to get an idea of how busy the airspace is. To do this, I used a statistic helper that was set up like this in my configuration.yaml:

sensor:
  - platform: statistics
    name: "Flights in past 24 hours"
    entity_id: sensor.flightradar24_entered_area
    state_characteristic: count
    max_age:
      hours: 24

It was working fine until a few weeks ago when it suddenly started counting much more frequently, going from maybe 250 per day to 17,000+ per day. It seems like it is recording all flights instead of just flights within my radius (5km). Is this a bug or something changed in home assistant?

This is a fantastic and well working integration. Thank you so much for this @AlexandrErohin

I edited the markdown card slightly and added the flight distance. Unfortunatly it is in german but you can easily adjust it to your needs:

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.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 %}Abflug - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }} - {% endif %}{%if flight.time_scheduled_arrival%}Ankunft - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %}
      Höhe - {{ flight.altitude }} ft{%if flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}
      Geschwindigkeit Boden - {{ flight.ground_speed }} kts{%if flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%}
      Entfernung - {{ flight.distance | round(2) }} km
      {% endfor %}

And here is the automation code to paste into the notification box for Amazon Alexa:

data:
  message: >-
    <audio src="soundbank://soundlibrary/musical/amzn_sfx_electronic_beep_01"/> This is
    Major Tom to ground control. Das Radar hat ein Flugobjekt in einer
    Entfernung von {% set data =
    state_attr('sensor.flightradar24_current_in_area', 'flights') %} {% for
    flight in data %} {{ flight.distance | round(2) }} km identifiziert.
    Flugnummer: {{ flight.flight_number }}, Airline: {{ flight.airline_short }},
    Flugzeugtyp: {{ flight.aircraft_model }}, Abflug von {{
    flight.airport_origin_city }}{% if flight.airport_origin_country_name %} ({{
    flight.airport_origin_country_name }}){% endif %} nach {{
    flight.airport_destination_city }}{% if
    flight.airport_destination_country_name %} ({{
    flight.airport_destination_country_name }}){% endif %}. {% if
    flight.time_scheduled_departure %} Geplanter Abflug: {{
    flight.time_scheduled_departure | timestamp_custom('%H:%M') }}, {% endif
    %}{% if flight.time_scheduled_arrival %} Geplante Ankunft: {{
    flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}. {% endif %}
    Die aktuelle Flughöhe beträgt: {{ flight.altitude }} ft{% if flight.altitude
    > 0 %} ({{ (flight.altitude * 0.3048) | round(0) }} m){% endif %},
    Geschwindigkeit: {{ flight.ground_speed }} Knoten, das entspricht: {% if
    flight.ground_speed > 0 %} ({{ (flight.ground_speed * 1.852) | round(0) }}
    km/h){% endif %} {% endfor %} Ende der Durchsage. <audio
    src="soundbank://soundlibrary/musical/amzn_sfx_electronic_beep_01"/>
action: notify.alexa_media_jorgs_2_echo_dot

Hope you like it and keep up the good work @AlexandrErohin

2 Likes

Does anyone know how is possible to setup a HA configuration for flight monitoring radius which for mobile phones with companion app uses current GPS coordinates and within those coordinates defined radius, but for fixed location (HA home server) uses fixed home coordinates with the same radius ? Anyway great integration ! Respect.

Has anyone had any success with identifying an aircraft in an automation?

The Aircraft exit automation works perfectly but when I do the same for aircraft entered that automation does not work.

I’m led to believe that someone feels the backend python code maybe incorrect, this is way out of my league lol. has there been any update on this integration??

Cheers

Shane

I really like that!
Can you save some history? I.e. show what flights were in the area in the last two minutes, rather than currently

This was my own error it seems - switching from Count to Sum solved it for me. Not sure why it was working before.

1 Like

there’s some detail on the GitHub Repo about recording history from the events…it’s not 100% what you are looking for (in terms of flights in last x minutes) but should put you in the right direction

1 Like