Enable asyncio debugging from debugpy integration (#51880)

* Optionally enable asyncio debugging from debugpy integration

* Unconditionally enable asyncio debugging
This commit is contained in:
Erik Montnemery 2021-06-15 12:10:47 +02:00 committed by GitHub
parent 3db8d9ede5
commit f3c6e846fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
"""The Remote Python Debugger integration."""
from __future__ import annotations
from asyncio import Event
from asyncio import Event, get_event_loop
import logging
from threading import Thread
@ -15,8 +15,8 @@ from homeassistant.helpers.service import async_register_admin_service
from homeassistant.helpers.typing import ConfigType
DOMAIN = "debugpy"
CONF_WAIT = "wait"
CONF_START = "start"
CONF_WAIT = "wait"
SERVICE_START = "start"
CONFIG_SCHEMA = vol.Schema(
@ -43,7 +43,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def debug_start(
call: ServiceCall | None = None, *, wait: bool = True
) -> None:
"""Start the debugger."""
"""Enable asyncio debugging and start the debugger."""
get_event_loop().set_debug(True)
debugpy.listen((conf[CONF_HOST], conf[CONF_PORT]))
wait = conf[CONF_WAIT]