Flightradar24 Home Assistant Integration

repository·main·Indexed 19 days ago

https://github.com/alexandrerohin/home-assistant-flightradar24

A Home Assistant integration for real-time aviation tracking. It enables monitoring of local flights, global aircraft tracking, and airport statistics. Users can trigger automations based on flight events such as arrivals, departures, or area entry/exit. The integration provides area and airport tracking sensors, configuration entities for managing tracked flights, and a built-in Lovelace map card for visualizing aircraft markers and flight tracks.

Tokens
14.6K
Snippets
15
Records
27
Agent score
17%

What's inside home-assistant-flightradar24

  1. Receive notifications when flights enter or exit your area

    main

    You can set up Home Assistant automations to trigger notifications when a flight enters or exits your monitored area using the flightradar24_entry or flightradar24_exit event types.

    If you have multiple Flightradar24 devices configured, you can identify which device triggered the event by checking trigger.event.data.tracked_by_device. To customize this name, go to Settings -> Devices & services, find the Flightradar24 integration, click the three-dot menu next to the specific device, and select Rename.

    automation:
      - alias: "Flight entry notification"
        trigger:
          platform: event
          event_type: flightradar24_entry
        action:
          service: notify.mobile_app_<device_name>
          data:
            message: >-
              Flight entry of {{ trigger.event.data.callsign }} to {{ trigger.event.data.airport_destination_city }}
              [Open FlightRadar](https://www.flightradar24.com/{{ trigger.event.data.callsign }})
            data:
              url: >-
                https://fr24.com/{{ trigger.event.data.callsign }}/{{ trigger.event.data.id }}
              clickAction: >-
                https://fr24.com/{{ trigger.event.data.callsign }}/{{ trigger.event.data.id }}
              image: "{{ trigger.event.data.aircraft_photo_medium }}"
  2. Configure the Flightradar24 integration

    main

    The integration is configured via the Home Assistant User Interface.

    1. Go to Settings -> Devices & services.
    2. Click + ADD INTEGRATION.
    3. Search for Flightradar24.
    4. Set your desired parameters (Radius, Latitude, and Longitude) and click SUBMIT.

    To modify existing settings:

    1. Go to Settings -> Devices & services.
    2. Find the Flightradar24 integration and click on it.
    3. Click CONFIGURE.
    4. Edit your options and click SUBMIT.
    5. Reload the integration to apply changes.
  3. Receive notifications when a scheduled flight takes off

    main

    Use the flightradar24_tracked_took_off event type to trigger automations when a flight you are tracking officially takes off.

    automation:
      - alias: "Scheduled flight takes off"
        trigger:
          platform: event
          event_type: flightradar24_tracked_took_off
        action:
          service: notify.mobile_app_<device_name>
          data:
            message: >-
              Flight takes off {{ trigger.event.data.callsign }} to {{ trigger.event.data.airport_destination_city }}
              [Open FlightRadar](https://www.flightradar24.com/{{ trigger.event.data.callsign }})
            data:
              url: >-
                https://fr24.com/{{ trigger.event.data.callsign }}/{{ trigger.event.data.id }}
              clickAction: >-
                https://fr24.com/{{ trigger.event.data.callsign }}/{{ trigger.event.data.id }}
              image: "{{ trigger.event.data.aircraft_photo_medium }}"
  4. Enable Device Tracker for Live Flights

    main

    You can track a live flight as a device_tracker entity and associate it with a person in Home Assistant.

    Requirements & Limitations:

    1. You must activate this feature in the Configuration section.
    2. The integration creates a device tracker with the static name device_tracker.flightradar24.
    3. The tracker updates only when there is a live flight in the Additional tracked list.
    4. Crucial: It only works with one live flight from the Additional tracked list at a time.
  5. Automatically add flights to additional tracking

    main

    You can automate the process of adding a flight to your additional tracking list based on specific criteria (e.g., origin city) using the flightradar24_exit event.

    Note: If your Home Assistant is not in English, replace text.flightradar24_add_to_track with your actual local entity ID.

    automation:
      - alias: "Track flights"
        trigger:
          platform: event
          event_type: flightradar24_exit
        condition:
          - condition: template
            value_template: "{{ 'Frankfurt' == trigger.event.data.airport_origin_city }}"
        action:
          - service: text.set_value
            data:
              value: "{{ trigger.event.data.aircraft_registration }}"
            target:
              entity_id: text.flightradar24_add_to_track
  6. Optimize Recorder database usage

    main

    To reduce the amount of data stored by the Home Assistant recorder component, you can exclude flight sensors from being recorded.

    ⚠️ WARNING: Do not exclude sensor.flightradar24_additional_tracked from Recorder. This sensor relies on its last recorded state to restore tracked flights after a Home Assistant restart. Excluding it will cause additional tracked flights to be cleared on every reboot.

    Heavy flights attributes on other sensors are already automatically excluded from Recorder by the integration using _unrecorded_attributes.

    recorder:
      exclude:
        entities:
          - sensor.flightradar24_current_in_area
          - sensor.flightradar24_entered_area
          - sensor.flightradar24_exited_area
  7. Add an Airport Flight Board to Lovelace dashboard

    main

    You can create a visual arrivals/departures board in Home Assistant using a vertical-stack containing entities cards and markdown cards.

    Note: If your Home Assistant system is not in English, replace sensor.flightradar24_airport_... with your actual local entity IDs.

    Steps:

    1. Open your Home Assistant dashboard.
    2. Select the three-dot menu -> Edit dashboard.
    3. Click + ADD CARD and select Manual.
    4. Paste the YAML configuration provided in the example below.
    type: vertical-stack
    title: Flightradar24
    cards:
      - type: entities
        entities:
          - entity: sensor.flightradar24_airport_arrivals_canceled
            name: Arrivals canceled
          - entity: sensor.flightradar24_airport_arrivals_delayed
            name: Arrivals delayed
          - entity: sensor.flightradar24_airport_arrivals_on_time
            name: Arrivals on time
      - type: markdown
        title: Arrivals
        content: >
          {% set flights =
          state_attr('sensor.flightradar24_airport_arrivals','flights') |
          default([], true) %}
            | TIME | FROM | FLIGHT | REMARK |
            | ---- | ---- | ------ | ------ |
            {% for f in flights %}
            | {{ f.time_scheduled_arrival | timestamp_custom('%H:%M') if f.time_scheduled_arrival else '--:--' }} | {{ f.airport_city |  default('---', true) }} | {{ f.flight_number |  default('---', true) }} | {{ f.status_text |  default('---', true) }} |
            {% endfor %}
      - type: entities
        entities:
          - entity: sensor.flightradar24_airport_departures_canceled
            name: Departures canceled
          - entity: sensor.flightradar24_airport_departures_delayed
            name: Departures delayed
          - entity: sensor.flightradar24_airport_departures_on_time
            name: Departures on time
      - type: markdown
        title: Departures
        content: >
          {% set flights = state_attr('sensor.flightradar24_airport_departures', 
          'flights') |  default([], true) %}
            | TIME | TO | FLIGHT | REMARK |
            | ---- | ---- | ------ | ------ |
            {% for f in flights %}
            | {{ f.time_scheduled_departure | timestamp_custom('%H:%M') if f.time_scheduled_departure else '--:--' }} | {{ f.airport_city |  default('---', true) }} | {{ f.flight_number |  default('---', true) }} | {{ f.status_text |  default('---', true) }} |
            {% endfor %}
  8. Use the Flightradar24 Map Card

    main

    The flightradar24-card is a built-in Lovelace card that displays an OpenStreetMap of your monitored area with aircraft markers and optional flight tracks. It is registered automatically when the integration loads.

    Configuration Options

    OptionTypeDefaultDescription
    entitystringRequired. Typically sensor.flightradar24_current_in_area
    titlestringOptional card title
    show_flightsbooleantrueShow the flights list under the map
    show_tracksbooleantrueDraw flight tracks on the map from each flight's coordinates history
    type: custom:flightradar24-card
    entity: sensor.flightradar24_current_in_area
    title: Flights Nearby
    show_flights: true
    show_tracks: true
  9. Track specific airport arrivals and departures

    main

    To receive real-time flight data for a specific airport, use the text.flightradar24_airport_track service.

    • To start tracking: Pass the airport's IATA or ICAO code to the service.
    • To stop tracking: Pass an empty string "" to the service.

    Data is exposed via sensor.flightradar24_airport_arrivals and sensor.flightradar24_airport_departures sensors.

  10. Install the Flightradar24 integration manually

    main

    If you prefer not to use HACS, you can install the integration manually:

    1. Locate the custom_components directory in your Home Assistant configuration directory (create it if it doesn't exist).
    2. Copy the custom_components/flightradar24 directory from the repository into your local custom_components directory.
    3. Restart Home Assistant.
  11. Verify Entity IDs for Localized Systems

    main

    Home Assistant automatically generates entity_id values based on your system's default language. For example, on a German system, sensor.flightradar24_current_in_area might become sensor.flightradar24_bereich_betreten.

    Action Required: Before using any YAML or Lovelace code, verify your exact entity IDs by navigating to Settings → Devices & Services → Entities and update the IDs to match your localized versions.