Skip to content

Stick.__init__ enables asyncio debug mode for the whole Home Assistant event loop (loop.set_debug(True)) #510

Closed

Description

@SuperTus

Describe the problem
plugwise_usb/__init__.py line 61 (current main, also in 0.47.8):

def __init__(self, port: str | None = None, cache_enabled: bool = True) -> None:
    self._loop = get_running_loop()
    self._loop.set_debug(True)

When this runs inside Home Assistant, the library switches on asyncio debug mode for HA's shared event loop. This happens on every startup, every config entry reload, and every setup retry of the Plugwise USB integration. Debug mode is meant for development only and it affects every integration, not just Plugwise.

Impact observed (HA 2026.10.4, Python 3.14, Plugwise USB custom integration v0.59.3 / plugwise-usb 0.47.8)

  • Another integration (zonneplan_one) failed during HA startup with an SSL TypeError raised from asyncio/sslproto.py. The debug flag was switched on while that integration was in the middle of its SSL handshake. A similar interaction is described in TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' in sslproto home-assistant/core#151993.
  • The HA log fills with thousands of Executing <Task ...> took X seconds warnings (6000+ in our case), which hides real problems.
  • Debug mode adds CPU overhead to the whole event loop (slow-callback tracking, coroutine origin tracking).

Expected behaviour
A library should not change global event loop settings. Please remove self._loop.set_debug(True). If debugging is needed, users can enable it through HA's own debugpy/homeassistant.debug options or PYTHONASYNCIODEBUG=1.

Workaround in use
An automation that turns debug mode off again some minutes after startup.

Activity

  1. bouwew commented on Nov 18, 2026

    @bouwew
    Contributor

    Thanks for reporting the problem!
    I will try to implement the suggested change soon.

  2. bouwew commented on Nov 18, 2026

    @bouwew
    Contributor

    Implemented in #511

  3. bouwew commented on Nov 18, 2026

    @bouwew
    Contributor

    Next is the integration-update, that might be a bit more tricky, the github environment is kind of broken and I'm not an expert on that topic 🙂

  4. bouwew commented on Nov 20, 2026

    @bouwew
    Contributor

    @SuperTus please try plugwise_usb-beta v0.59.4, it contains the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions