mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Enable asyncio debugging from debugpy integration (#51880)
* Optionally enable asyncio debugging from debugpy integration * Unconditionally enable asyncio debugging
This commit is contained in:
parent
3db8d9ede5
commit
f3c6e846fa
@ -1,7 +1,7 @@
|
|||||||
"""The Remote Python Debugger integration."""
|
"""The Remote Python Debugger integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from asyncio import Event
|
from asyncio import Event, get_event_loop
|
||||||
import logging
|
import logging
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -15,8 +15,8 @@ from homeassistant.helpers.service import async_register_admin_service
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
DOMAIN = "debugpy"
|
DOMAIN = "debugpy"
|
||||||
CONF_WAIT = "wait"
|
|
||||||
CONF_START = "start"
|
CONF_START = "start"
|
||||||
|
CONF_WAIT = "wait"
|
||||||
SERVICE_START = "start"
|
SERVICE_START = "start"
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
@ -43,7 +43,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
async def debug_start(
|
async def debug_start(
|
||||||
call: ServiceCall | None = None, *, wait: bool = True
|
call: ServiceCall | None = None, *, wait: bool = True
|
||||||
) -> None:
|
) -> 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]))
|
debugpy.listen((conf[CONF_HOST], conf[CONF_PORT]))
|
||||||
|
|
||||||
wait = conf[CONF_WAIT]
|
wait = conf[CONF_WAIT]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user