Add websocket type hints in components (#80654)
* Add websocket type hints in components * Adjust * Apply suggestion Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
parent
ae7eb9cef9
commit
2c43606922
16 changed files with 116 additions and 40 deletions
|
@ -135,7 +135,11 @@ async def websocket_trace_contexts(
|
|||
vol.Optional("run_id"): str,
|
||||
}
|
||||
)
|
||||
def websocket_breakpoint_set(hass, connection, msg):
|
||||
def websocket_breakpoint_set(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Set breakpoint."""
|
||||
key = f"{msg['domain']}.{msg['item_id']}"
|
||||
node = msg["node"]
|
||||
|
@ -162,7 +166,11 @@ def websocket_breakpoint_set(hass, connection, msg):
|
|||
vol.Optional("run_id"): str,
|
||||
}
|
||||
)
|
||||
def websocket_breakpoint_clear(hass, connection, msg):
|
||||
def websocket_breakpoint_clear(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Clear breakpoint."""
|
||||
key = f"{msg['domain']}.{msg['item_id']}"
|
||||
node = msg["node"]
|
||||
|
@ -176,7 +184,11 @@ def websocket_breakpoint_clear(hass, connection, msg):
|
|||
@callback
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command({vol.Required("type"): "trace/debug/breakpoint/list"})
|
||||
def websocket_breakpoint_list(hass, connection, msg):
|
||||
def websocket_breakpoint_list(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""List breakpoints."""
|
||||
breakpoints = breakpoint_list(hass)
|
||||
for _breakpoint in breakpoints:
|
||||
|
@ -191,7 +203,11 @@ def websocket_breakpoint_list(hass, connection, msg):
|
|||
@websocket_api.websocket_command(
|
||||
{vol.Required("type"): "trace/debug/breakpoint/subscribe"}
|
||||
)
|
||||
def websocket_subscribe_breakpoint_events(hass, connection, msg):
|
||||
def websocket_subscribe_breakpoint_events(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Subscribe to breakpoint events."""
|
||||
|
||||
@callback
|
||||
|
@ -240,7 +256,11 @@ def websocket_subscribe_breakpoint_events(hass, connection, msg):
|
|||
vol.Required("run_id"): str,
|
||||
}
|
||||
)
|
||||
def websocket_debug_continue(hass, connection, msg):
|
||||
def websocket_debug_continue(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Resume execution of halted script or automation."""
|
||||
key = f"{msg['domain']}.{msg['item_id']}"
|
||||
run_id = msg["run_id"]
|
||||
|
@ -260,7 +280,11 @@ def websocket_debug_continue(hass, connection, msg):
|
|||
vol.Required("run_id"): str,
|
||||
}
|
||||
)
|
||||
def websocket_debug_step(hass, connection, msg):
|
||||
def websocket_debug_step(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Single step a halted script or automation."""
|
||||
key = f"{msg['domain']}.{msg['item_id']}"
|
||||
run_id = msg["run_id"]
|
||||
|
@ -280,7 +304,11 @@ def websocket_debug_step(hass, connection, msg):
|
|||
vol.Required("run_id"): str,
|
||||
}
|
||||
)
|
||||
def websocket_debug_stop(hass, connection, msg):
|
||||
def websocket_debug_stop(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Stop a halted script or automation."""
|
||||
key = f"{msg['domain']}.{msg['item_id']}"
|
||||
run_id = msg["run_id"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue