Skip to content

Blocking I/O calls in hacs-govee integration cause setup failure on HA 2025.1.1 (Python 3.13) #268

@Hierachical

Description

@Hierachical

Description
When attempting to set up the Govee integration, Home Assistant logs repeated warnings about blocking calls inside the async event loop. As a result, the integration fails to register services and devices do not appear in Developer Tools.

Environment

  • Home Assistant Core: 2025.1.1
  • Python: 3.13
  • Installation type: HA OS (HA green)
  • Integration version: Govee custom component via HACS (latest as of Dec 2025)
  • Hardware: Home Assistant Green

Logs / Traceback
`
Logger: homeassistant.util.loop
Source: util/loop.py:137
First occurred: 21:25:57 (2 occurrences)
Last logged: 21:25:58

Detected blocking call to loadverifylocations with args (<ssl.SSLContext object at 0xffff6119c190>, '/usr/local/lib/python3.13/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'govee' at customcomponents/govee/configflow.py, line 29: async with Govee(apikey, learningstorage=GoveeNoLearningStorage()) as hub:
(offender: /usr/local/lib/python3.13/ssl.py, line 717: context.loadverifylocations(cafile, capath, cadata))

Detected blocking call to open with args ('/config/goveelearning.yaml',) inside the event loop by custom integration 'govee' at customcomponents/govee/learningstorage.py, line 28: learneddict = loadyaml(self.configdir + LEARNINGSTORAGE_YAML)
(offender: /usr/local/lib/python3.13/site-packages/annotatedyaml/loader.py, line 166: with open(fname, encoding="utf-8") as conf_file:)
`

Expected Behavior
Integration should register services and devices without blocking the event loop.

Actual Behavior
Integration fails during setup due to blocking SSL and file I/O calls. No Govee services appear in Developer Tools.

Steps to Reproduce

  1. Install hacs-govee via HACS.
  2. Add integration with valid API key.
  3. Observe logs during setup.

Suggested Fix

  • Replace synchronous file I/O (open(), loadyaml) with async‑safe equivalents such as aiofiles or asyncio.tothread.
  • Move SSL certificate verification (context.loadverifylocations) off the event loop, e.g. by wrapping in asyncio.to_thread or performing it during initialization outside async context.
  • Ensure all config flow and learning storage operations use non‑blocking async patterns to comply with HA developer guidelines.

User Impact

  • Integration is currently unusable: devices fail to load, services are missing, and automations depending on Govee entities cannot run.
  • This blocks basic control of Govee lamps and prevents discovery in Home Assistant.
  • Restarting HA does not resolve the issue; disabling the integration is the only workaround until fixed.

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