Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.trace Namespace Reference

Classes

class  StopReason
 
class  TraceElement
 

Functions

_T|None _T (ContextVar[list[_T]|None] trace_stack_var)
 
None _T (ContextVar[list[_T]|None] trace_stack_var, _T node)
 
Callable[[Callable[[ *_Ts], Coroutine[Any, Any, None]]], Callable[[ *_Ts], Coroutine[Any, Any, None]],] _Ts (str|list[str] suffix)
 
str|None script_execution_get ()
 
None script_execution_set (str reason, ServiceResponse response=None)
 
None trace_append_element (TraceElement trace_element, int|None maxlen=None)
 
None trace_clear ()
 
dict[str, deque[TraceElement]]|None trace_get (bool clear=True)
 
tuple[str, str]|None trace_id_get ()
 
None trace_id_set (tuple[str, str] trace_id)
 
Generator[None] trace_path (str|list[str] suffix)
 
str trace_path_get ()
 
None trace_path_pop (int count)
 
int trace_path_push (str|list[str] suffix)
 
None trace_set_child_id (str child_key, str child_run_id)
 
None trace_set_result (**Any kwargs)
 
None trace_stack_pop (ContextVar[list[Any]|None] trace_stack_var)
 
None trace_update_result (**Any kwargs)
 

Detailed Description

Helpers for script and condition tracing.

Function Documentation

◆ _T() [1/2]

_T | None homeassistant.helpers.trace._T ( ContextVar[list[_T] | None]  trace_stack_var)
private
Return the element at the top of a trace stack.

Definition at line 153 of file trace.py.

◆ _T() [2/2]

None homeassistant.helpers.trace._T ( ContextVar[list[_T] | None]  trace_stack_var,
_T   node 
)
private
Push an element to the top of a trace stack.

Definition at line 135 of file trace.py.

◆ _Ts()

Callable[ [Callable[[*_Ts], Coroutine[Any, Any, None]]], Callable[[*_Ts], Coroutine[Any, Any, None]], ] homeassistant.helpers.trace._Ts ( str | list[str]  suffix)
private
Go deeper in the config tree.

To be used as a decorator on coroutine functions.

Definition at line 263 of file trace.py.

◆ script_execution_get()

str | None homeassistant.helpers.trace.script_execution_get ( )
Return the stop reason.

Definition at line 243 of file trace.py.

◆ script_execution_set()

None homeassistant.helpers.trace.script_execution_set ( str  reason,
ServiceResponse   response = None 
)
Set stop reason.

Definition at line 235 of file trace.py.

◆ trace_append_element()

None homeassistant.helpers.trace.trace_append_element ( TraceElement  trace_element,
int | None   maxlen = None 
)
Append a TraceElement to trace[path].

Definition at line 181 of file trace.py.

◆ trace_clear()

None homeassistant.helpers.trace.trace_clear ( )
Clear the trace.

Definition at line 201 of file trace.py.

◆ trace_get()

dict[str, deque[TraceElement]] | None homeassistant.helpers.trace.trace_get ( bool   clear = True)
Return the current trace.

Definition at line 194 of file trace.py.

◆ trace_id_get()

tuple[str, str] | None homeassistant.helpers.trace.trace_id_get ( )
Get id if the current trace.

Definition at line 130 of file trace.py.

◆ trace_id_set()

None homeassistant.helpers.trace.trace_id_set ( tuple[str, str]  trace_id)
Set id of the current trace.

Definition at line 125 of file trace.py.

◆ trace_path()

Generator[None] homeassistant.helpers.trace.trace_path ( str | list[str]  suffix)
Go deeper in the config tree.

Can not be used as a decorator on couroutine functions.

Definition at line 251 of file trace.py.

◆ trace_path_get()

str homeassistant.helpers.trace.trace_path_get ( )
Return a string representing the current location in the config tree.

Definition at line 174 of file trace.py.

◆ trace_path_pop()

None homeassistant.helpers.trace.trace_path_pop ( int  count)
Go n levels up in the config tree.

Definition at line 168 of file trace.py.

◆ trace_path_push()

int homeassistant.helpers.trace.trace_path_push ( str | list[str]  suffix)
Go deeper in the config tree.

Definition at line 159 of file trace.py.

◆ trace_set_child_id()

None homeassistant.helpers.trace.trace_set_child_id ( str  child_key,
str  child_run_id 
)
Set child trace_id of TraceElement at the top of the stack.

Definition at line 210 of file trace.py.

◆ trace_set_result()

None homeassistant.helpers.trace.trace_set_result ( **Any  kwargs)
Set the result of TraceElement at the top of the stack.

Definition at line 216 of file trace.py.

◆ trace_stack_pop()

None homeassistant.helpers.trace.trace_stack_pop ( ContextVar[list[Any] | None]  trace_stack_var)
Remove the top element from a trace stack.

Definition at line 146 of file trace.py.

◆ trace_update_result()

None homeassistant.helpers.trace.trace_update_result ( **Any  kwargs)
Update the result of TraceElement at the top of the stack.

Definition at line 222 of file trace.py.