Custom Component: Flightradar24

Wonderful project. I have two questions:
1: What would be the benefit of including my FR24 subscription information?
2: Is it possible to add a tracked flight based on IATA/ICAO orign and destination, instead of flightnumber?

[Edit]: What I actually would like to do for number 2 is to provide 3 parameters; Airline, Orign and Destination

Any way of fetching the age of a plane on a specfic flight?
Or age of all planes in “sight”?

Can I adjust the ‘area’ with my location? Or is that not possible? Would be a nice feature.

1 Like

I just made the upgrade of Home Assistant to 2025.5.0 on my test system and the integration is not working any more.

Logger: homeassistant.setup
Source: setup.py:344
First occurred: 22:29:13 (1 occurrence)
Last logged: 22:29:13

Setup failed for custom integration 'flightradar24': Unable to import component: cannot import name 'countries' from 'pycountry' (unknown location)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 993, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1053, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/flightradar24/__init__.py", line 7, in <module>
    from .coordinator import FlightRadar24Coordinator
  File "/config/custom_components/flightradar24/coordinator.py", line 8, in <module>
    from pycountry import countries
ImportError: cannot import name 'countries' from 'pycountry' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 344, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1013, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1005, in async_get_component
    comp = self._get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1053, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/flightradar24/__init__.py", line 7, in <module>
    from .coordinator import FlightRadar24Coordinator
  File "/config/custom_components/flightradar24/coordinator.py", line 8, in <module>
    from pycountry import countries
ImportError: cannot import name 'countries' from 'pycountry' (unknown location)

This error did not occur during the beta phase.
Shall i open an issue?

After clean restart the error disappeared. Ignore my post.

I am getting the same error sometimes after a restart of HA. I say sometimes as I need to restart HA to reload the integration and a restart does not always allow the integration to start.

I’ve opened an issue.

This error means that while update HA had not install python module - pycountry. The reason why HA had not install the module not in this integration.

@AlexandrErohin That would explain why only some restarts generate the error!

Hi,

Did you get this to work properly? I am also in NL trying to get the takeoff of the lifeliners in the area. I set different area’s to track take-off and maybe takeoff again and get that on a map with lon-lat. I have identified some of the lifeliner codes:

| Callsign        | Registration | ICAO Hex   | Type            | Base Location       |
| --------------- | ------------ | ---------- | --------------- | ------------------- |
| **Lifeliner 1** | PH-LLN       | **48605B** | Airbus H135 P3  | Amsterdam (VUmc)    | 48605B
| **Lifeliner 2** | PH-DOC       | **48414F** | Airbus H135 P3  | Rotterdam Airport   |
| **Lifeliner 3** | PH-ELP       | **484144** | Airbus H135 T2+ | Volkel AFB          |
| **Lifeliner 4** | PH-ULP       | **48416F** | Airbus H135 T2  | Groningen (Eelde)   |
| **Medic 01**    | PH-TTR       | **484157** | Airbus H135 P3  | Leeuwarden Air Base |

Any pointers to an automation so that I can track the takeoff and possibly plot the route on a map would be great.

Thanks and best regards

This integration is great! Have added this with the other third party card.

Has anyone been able to get an automation that can send TTS to a smart speaker saying something like flight overhead callsign from departing city to destination city

I had see someone was playing with it but not sure they got it to work.