AlexandrErohin / home-assistant-flightradar24

Flightradar24 integration for Home Assistant
https://community.home-assistant.io/t/custom-component-flightradar24
MIT License
170 stars 16 forks source link

HA 2026.1 & FR 1.14.1 | [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'flightradar24' at custom_components/flightradar24/coordinator.py, line 240 #44

Closed AnthonyBe closed 5 months ago

AnthonyBe commented 5 months ago

I just updated from HA 2024.5.5 to 2024.6.1 and am now getting the following error. I have v1.14.1 of the FlightRadar24 integration. Just for reference, a number of other integrations I use are encountering the same issue, e.g. Tuya-Local (https://github.com/make-all/tuya-local/issues/1981) and TheWatchman (https://github.com/dummylabs/thewatchman/issues/135) with HA 2024.6

2024-06-08 13:35:17.793 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'flightradar24' at custom_components/flightradar24/coordinator.py, line 240: country = pycountry.countries.get(alpha_3=code) (offender: /usr/local/lib/python3.12/site-packages/pycountry/db.py, line 103: with open(self.filename, encoding="utf-8") as f:), please create a bug report at https://github.com/AlexandrErohin/home-assistant-flightradar24/issues
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 255, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/flightradar24/coordinator.py", line 109, in _async_update_data
    await self._update_flights_in_area()
  File "/config/custom_components/flightradar24/coordinator.py", line 125, in _update_flights_in_area
    await self._update_flights_data(obj, current, self.in_area, SensorType.IN_AREA)
  File "/config/custom_components/flightradar24/coordinator.py", line 187, in _update_flights_data
    flight = self._get_flight_data(data)
  File "/config/custom_components/flightradar24/coordinator.py", line 267, in _get_flight_data
    'airport_origin_country_code': _get_country_code(
  File "/config/custom_components/flightradar24/coordinator.py", line 240, in _get_country_code
    country = pycountry.countries.get(alpha_3=code)
AlexandrErohin commented 5 months ago

@AnthonyBe Thank you! It is fixed now.