mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Rename AutomationTrace.runid to AutomationTrace.run_id (#47669)
This commit is contained in:
parent
0c61cb555c
commit
fd1add8f15
@ -241,7 +241,7 @@ async def async_setup(hass, config):
|
|||||||
class AutomationTrace:
|
class AutomationTrace:
|
||||||
"""Container for automation trace."""
|
"""Container for automation trace."""
|
||||||
|
|
||||||
_runids = count(0)
|
_run_ids = count(0)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -257,7 +257,7 @@ class AutomationTrace:
|
|||||||
self._context: Context = context
|
self._context: Context = context
|
||||||
self._error: Optional[Exception] = None
|
self._error: Optional[Exception] = None
|
||||||
self._state: str = "running"
|
self._state: str = "running"
|
||||||
self.runid: str = str(next(self._runids))
|
self.run_id: str = str(next(self._run_ids))
|
||||||
self._timestamp_finish: Optional[dt.datetime] = None
|
self._timestamp_finish: Optional[dt.datetime] = None
|
||||||
self._timestamp_start: dt.datetime = dt_util.utcnow()
|
self._timestamp_start: dt.datetime = dt_util.utcnow()
|
||||||
self._trigger: Dict[str, Any] = trigger
|
self._trigger: Dict[str, Any] = trigger
|
||||||
@ -303,7 +303,7 @@ class AutomationTrace:
|
|||||||
"condition_trace": condition_traces,
|
"condition_trace": condition_traces,
|
||||||
"config": self._config,
|
"config": self._config,
|
||||||
"context": self._context,
|
"context": self._context,
|
||||||
"run_id": self.runid,
|
"run_id": self.run_id,
|
||||||
"state": self._state,
|
"state": self._state,
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"start": self._timestamp_start,
|
"start": self._timestamp_start,
|
||||||
@ -331,7 +331,7 @@ class AutomationTrace:
|
|||||||
result = {
|
result = {
|
||||||
"last_action": last_action,
|
"last_action": last_action,
|
||||||
"last_condition": last_condition,
|
"last_condition": last_condition,
|
||||||
"run_id": self.runid,
|
"run_id": self.run_id,
|
||||||
"state": self._state,
|
"state": self._state,
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"start": self._timestamp_start,
|
"start": self._timestamp_start,
|
||||||
@ -379,7 +379,7 @@ def trace_automation(hass, unique_id, config, trigger, context):
|
|||||||
automation_traces = hass.data[DATA_AUTOMATION_TRACE]
|
automation_traces = hass.data[DATA_AUTOMATION_TRACE]
|
||||||
if unique_id not in automation_traces:
|
if unique_id not in automation_traces:
|
||||||
automation_traces[unique_id] = LimitedSizeDict(size_limit=STORED_TRACES)
|
automation_traces[unique_id] = LimitedSizeDict(size_limit=STORED_TRACES)
|
||||||
automation_traces[unique_id][automation_trace.runid] = automation_trace
|
automation_traces[unique_id][automation_trace.run_id] = automation_trace
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield automation_trace
|
yield automation_trace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user