Custom Component: Flightradar24

I assume that when it leaves the airport, it takes off and when it returns it lands. I checked on the location and added a circle around the location with a 5000 meter radius. Sometimes they have to go around the airport and they may leave the circle and get back in immediately. That could cause 2 notifications. But now a flight taking of causes 2 notifications. If you use my automation you can check, I can supply you with the exact coordinates if needed.

Here’s my dashboard based on this integration!

2 Likes

@AlexandrErohin

The url shows a lot of promise! I can display a single flight with the call sign. I’ll look into this some more. Thanks!

I’ve been able to make some progress with the automation to add a flight from my schedule. However, I’m running into a problem of passing the flight number into the variable that will add the additional_tracked flight. Any chance you could take a look for me please?

alias: Flight Radar 24 Test Level 1
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "0:05:0"
    entity_id: calendar.my_access_mycalendar
condition:
  - condition: template
    value_template: "{{ trigger.calendar_event.summary | regex_match('^(?!T).*\\d{3,4}.*') }}"
action:
  - service: notify.mobile_app_steve_s_s22
    data:
      message: >-
        DAL{{ trigger.calendar_event.summary | regex_findall('\\d{3,4}\\b') |
        first }}
      title: FT24 Test Title
  - service: text.set_value
    data_template: >-
      DAL{{ trigger.calendar_event.summary | regex_findall('\d{3,4}\b') | first
      }}
    target:
      entity_id: text.flightradar24_add_to_track
    enabled: true
mode: single

Basically, my calendar just has the flight numbers, so I have to append the airline code to the beginning of the number.
I have the notification go to my phone for now just to make sure it’s parsing the flight number correctly, which it does, everytime. It just fails when I try to pass the flight number into the additional_tracked. I’m messing up the syntax somehow.

v1.9.1 Released

Changelog

  • Translation into Spanish language
  • Fixed Deprecated config entry data update method
1 Like

@chintito4ever Great dashboard
Could you share your dashboard code and how you have set up hourly sensors?

2 Likes

I used HA’s built in Utility Meter (under settings/config/helpers) to track flights above my home hourly/daily/monthly etc.

Here’s the code for hourly flights data card, let me know if you need any other card’s codes.

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:bubble-card
    card_type: separator
    name: Hourly Flights
    icon: mdi:airplane
  - type: custom:apexcharts-card
    graph_span: 1d
    span:
      start: day
    yaxis:
      - id: tv
        show: false
    series:
      - entity: sensor.flights_above_hourly
        color: teal
        type: column
        group_by:
          func: last
          duration: 1h
        show:
          as_duration: hour
          datalabels: true
        yaxis_id: tv
    apex_config:
      grid:
        show: false
      dataLabels:
        offsetY: -10
        background:
          enabled: false
        style:
          colors:
            - var(--primary-text-color)
      plotOptions:
        bar:
          columnWidth: 60%
          borderRadius: 4
      xaxis:
        axisTicks:
          show: false
        axisBorder:
          show: false
        labels:
          offsetY: -5
          datetimeFormatter:
            day: hh
      yaxis:
        decimals: 0
        crosshairs:
          show: true
        axisTicks:
          show: true
        tickAmount: 5
        labels:
          show: true
          maxwidth: 4
      tooltip:
        enabled: false

3 Likes

@chintito4ever Thanks!

@steve1123 What is the error you get?

@AlexandrErohin The error I got was “Error rendering data template: Result is not a Dictionary”.

Where you got the sensor.flights_above_hourly?
EDIT: Ok, i got it… but can you share the complete code of your dashboard?

I am trying to convert your code from hourly to daily, created the daily helper, but i still cannot get the correct daily chart.
Can you give me some hints about it?

Daily one is slightly different, here’s the code:

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:bubble-card
    card_type: separator
    name: Daily Flights
    icon: mdi:airplane
  - type: custom:apexcharts-card
    update_interval: 1min
    graph_span: 7d
    span:
      start: day
      offset: '-6d'
    series:
      - entity: sensor.flights_above_today
        type: column
        show:
          datalabels: true
        group_by:
          func: last
          duration: 1d
    apex_config:
      chart:
        type: bar
        height: 300
        toolbar:
          show: false
        dropShadow:
          enabled: true
          top: 0
          left: 0
          blur: 1.5
          opacity: 0.5
          color: '#fcb874'
      plotOptions:
        bar:
          columnWidth: 50%
          borderRadius: 4
      xaxis:
        axisTicks:
          show: false
        axisBorder:
          show: false
        labels:
          offsetY: -5
          datetimeFormatter:
            day: ddd
      yaxis:
        decimals: 0
        crosshairs:
          show: true
        axisTicks:
          show: true
        tickAmount: 4
        labels:
          show: true
          maxwidth: 4
      tooltip:
        enabled: false
      fill:
        type: solid
        colors:
          - '#077056'
          - '#9debd7'

4 Likes

This is the Flight Information card. Slightly modified from default card shared by the developer.

type: markdown
content: >
  {% set flight = state_attr('sensor.flightradar24_current_in_area',
  'flights')[0] %}

  <ha-icon icon="mdi:airplane"></ha-icon> **Flight Number:** {{
  flight.flight_number }}


  <ha-icon icon="mdi:shield-airplane"></ha-icon> **Airline:** {{ flight.airline
  }}


  <ha-icon icon="mdi:airplane-search"></ha-icon> **Aircraft Model:** {{
  flight.aircraft_model }}


  <ha-icon icon="mdi:airport"></ha-icon> **Origin:** {{
  flight.airport_origin_city }} ({{ flight.airport_origin_code_iata }})  


  <ha-icon icon="mdi:airport"></ha-icon> **Destination:** {{
  flight.airport_destination_city }} ({{ flight.airport_destination_code_iata
  }})  


  <ha-icon icon="mdi:airplane-takeoff"></ha-icon> **Scheduled Departure:** {{
  flight.time_scheduled_departure | timestamp_custom('%I:%M %p') }}  


  <ha-icon icon="mdi:airplane-landing"></ha-icon> **Scheduled Arrival:** {{
  flight.time_scheduled_arrival | timestamp_custom('%I:%M %p') }}


  <ha-icon icon="mdi:airplane-clock"></ha-icon> **Flight Time:** {{
  ((flight.time_scheduled_arrival - flight.time_scheduled_departure) / 3600) |
  int }}h {{ (((flight.time_scheduled_arrival - flight.time_scheduled_departure)
  % 3600) / 60) | int }}m


  <ha-icon icon="mdi:altimeter"></ha-icon> **Altitude:** {{ flight.altitude }}
  ft  


  <ha-icon icon="mdi:speedometer"></ha-icon> **Ground Speed:**
  {{(flight.ground_speed * 1.15078) | round(0)}} MPH
title: Flight Information

2 Likes

This is an awesome integration! Thanks Alex!

I was wondering if there is a way to update the home location based on a person’s location?

I’d love to have it update so I only get notified for aircraft above me right now.

Thanks again!

1 Like

Not sure it works but did you try it with the Lat/Long from your person entity attributes…

1 Like

I second this… could be very useful.

v1.10.0 Released

Changelog

3 Likes

Thank u for this beautiful custom integration. As an airline pilot this will help me a lot!!!. god bless you.
I plan to use this to track the flights that I am going to fly and set an automation in node red.
I aim to achieve this by retrieving my aircraft registration based on the flight number that I am going to fly . I will then use the registration to find out the status of the incoming aircraft. however I am not able to “add to track “ a flight that is not live. Is there a work around for this ? . It would be nice if I could add it and then get the updated once it is live .

Thanks in advance .

Hi, This integration is really nice. I’m wondering if it would be possible to havethe same map in our dashboard as we have with a subscription with custom filters and the additionnal layers (like the weather and icing layers). That would be really awesome!

Thanks for the integration.
Couple of questions:

  1. Somewhere in the first two dozen posts, you indicated that the configuration may be added to the UI instead of having to create a new device. Is this going to happen or did I miss something?
  2. What goes into “Add to track” and “Remove from track”? I don’t see any documentation for these entities.