Skip to content

⚠️ Blocking calls detected in Govee integration: load_verify_locations and open() inside the event loop #244

@MacJoSch

Description

@MacJoSch

Hi 👋

I’m seeing two warnings from Home Assistant related to blocking calls made inside the event loop by the govee custom integration. These calls violate Home Assistant’s asyncio rules and could cause performance issues.

🧪 System Information
• Home Assistant Core Version: 2025.7.0
• Python Version: 3.13
• Installation Type: Docker (Synology)
• Govee Integration: Installed via HACS
• Custom Component Path: /config/custom_components/govee/

🐞 Detected Issues

  1. Blocking call: load_verify_locations()
    Detected blocking call to load_verify_locations with args (<ssl.SSLContext object ...>, '/usr/local/lib/python3.13/site-packages/certifi/cacert.pem', ...)
    inside the event loop by custom integration 'govee' at custom_components/govee/init.py, line 53:
    hub = await Govee.create(...)

  2. Blocking call: open('/config/govee_learning.yaml')
    Detected blocking call to open with args ('/config/govee_learning.yaml',)
    inside the event loop by custom integration 'govee' at custom_components/govee/learning_storage.py, line 28:
    learned_dict = load_yaml(self._config_dir + LEARNING_STORAGE_YAML)

🔁 Expected Behavior

These operations should be moved out of the event loop and executed using non-blocking techniques (e.g., asyncio.to_thread() or homeassistant.util.async_.run_blocking_io()).

Reference:
👉 https://developers.home-assistant.io/docs/asyncio_blocking_operations/

🙏 Suggestion

Please refactor the integration to avoid direct blocking calls inside async functions. It would help prevent log spam and improve performance for users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions