Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.script._ScriptRun Class Reference
Inheritance diagram for homeassistant.helpers.script._ScriptRun:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, Script script, dict[str, Any] variables, Context|None context, bool log_exceptions)
 
ScriptRunResult|None async_run (self)
 
None async_stop (self)
 

Private Member Functions

None _async_call_service_step (self)
 
None _async_choose_step (self)
 
None _async_condition_step (self)
 
None _async_delay_step (self)
 
None _async_device_step (self)
 
None _async_event_step (self)
 
tuple[ list[asyncio.Future[None]], asyncio.TimerHandle, asyncio.Future[None],] _async_futures_with_timeout (self, float timeout)
 
tuple[ list[asyncio.Future[None]], asyncio.TimerHandle|None, asyncio.Future[None]|None,] _async_futures_with_timeout (self, float|None timeout)
 
tuple[ list[asyncio.Future[None]], None, None,] _async_futures_with_timeout (self, None timeout)
 
ConditionCheckerType _async_get_condition (self, ConfigType config)
 
None _async_handle_timeout (self)
 
None _async_if_step (self)
 
None _async_parallel_step (self)
 
None _async_repeat_step (self)
 
None _async_run_script (self, Script script)
 
None _async_scene_step (self)
 
None _async_sequence_step (self)
 
None _async_set_conversation_response_step (self)
 
None _async_set_remaining_time_var (self, asyncio.TimerHandle|None timeout_handle)
 
None _async_step (self, bool log_exceptions)
 
None _async_stop_step (self)
 
None _async_variables_step (self)
 
None _async_wait_for_trigger_step (self)
 
None _async_wait_template_step (self)
 
None _async_wait_with_optional_timeout (self, list[asyncio.Future[None]] futures, asyncio.TimerHandle|None timeout_handle, asyncio.Future[None]|None timeout_future, Callable[[], None] unsub)
 
None _changed (self)
 
None _finish (self)
 
timedelta _get_pos_time_period_template (self, str key)
 
float|None _get_timeout_seconds_from_action (self)
 
None _handle_exception (self, Exception exception, bool continue_on_error, bool log_exceptions)
 
None _log (self, str msg, *Any args, int level=logging.INFO, **Any kwargs)
 
None _log_exception (self, Exception exception)
 
None _step_log (self, str default_message, float|None timeout=None)
 
_T|None _T (self, asyncio.Task[_T] long_task)
 
bool|None _test_conditions (self, list[ConditionCheckerType] conditions, str name, str|None condition_path=None)
 

Private Attributes

 _context
 
 _conversation_response
 
 _hass
 
 _log_exceptions
 
 _script
 
 _started
 
 _step
 
 _stop
 
 _stopped
 
 _variables
 

Detailed Description

Manage Script sequence run.

Definition at line 405 of file script.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.helpers.script._ScriptRun.__init__ (   self,
HomeAssistant  hass,
Script  script,
dict[str, Any]  variables,
Context | None  context,
bool  log_exceptions 
)

Definition at line 410 of file script.py.

Member Function Documentation

◆ _async_call_service_step()

None homeassistant.helpers.script._ScriptRun._async_call_service_step (   self)
private
Call the service specified in the action.

Definition at line 731 of file script.py.

◆ _async_choose_step()

None homeassistant.helpers.script._ScriptRun._async_choose_step (   self)
private
Choose a sequence.

Definition at line 1038 of file script.py.

◆ _async_condition_step()

None homeassistant.helpers.script._ScriptRun._async_condition_step (   self)
private
Test if condition is matching.

Definition at line 819 of file script.py.

◆ _async_delay_step()

None homeassistant.helpers.script._ScriptRun._async_delay_step (   self)
private
Handle delay.

Definition at line 632 of file script.py.

◆ _async_device_step()

None homeassistant.helpers.script._ScriptRun._async_device_step (   self)
private
Perform the device automation specified in the action.

Definition at line 778 of file script.py.

◆ _async_event_step()

None homeassistant.helpers.script._ScriptRun._async_event_step (   self)
private
Fire an event.

Definition at line 797 of file script.py.

◆ _async_futures_with_timeout() [1/3]

tuple[ list[asyncio.Future[None]], asyncio.TimerHandle, asyncio.Future[None], ] homeassistant.helpers.script._ScriptRun._async_futures_with_timeout (   self,
float  timeout 
)
private

Definition at line 1084 of file script.py.

◆ _async_futures_with_timeout() [2/3]

tuple[ list[asyncio.Future[None]], asyncio.TimerHandle | None, asyncio.Future[None] | None, ] homeassistant.helpers.script._ScriptRun._async_futures_with_timeout (   self,
float | None  timeout 
)
private
Return a list of futures to wait for.

The list will contain the stop future.

If timeout is set, a timeout future and handle will be created
and will be added to the list of futures.

Definition at line 1103 of file script.py.

◆ _async_futures_with_timeout() [3/3]

tuple[ list[asyncio.Future[None]], None, None, ] homeassistant.helpers.script._ScriptRun._async_futures_with_timeout (   self,
None  timeout 
)
private

Definition at line 1094 of file script.py.

◆ _async_get_condition()

ConditionCheckerType homeassistant.helpers.script._ScriptRun._async_get_condition (   self,
ConfigType  config 
)
private

Definition at line 433 of file script.py.

◆ _async_handle_timeout()

None homeassistant.helpers.script._ScriptRun._async_handle_timeout (   self)
private
Handle timeout.

Definition at line 1181 of file script.py.

◆ _async_if_step()

None homeassistant.helpers.script._ScriptRun._async_if_step (   self)
private
If sequence.

Definition at line 1059 of file script.py.

◆ _async_parallel_step()

None homeassistant.helpers.script._ScriptRun._async_parallel_step (   self)
private
Run a sequence in parallel.

Definition at line 1254 of file script.py.

◆ _async_repeat_step()

None homeassistant.helpers.script._ScriptRun._async_repeat_step (   self)
private
Repeat a sequence.

Definition at line 867 of file script.py.

◆ _async_run_script()

None homeassistant.helpers.script._ScriptRun._async_run_script (   self,
Script  script 
)
private
Execute a script.

Definition at line 1272 of file script.py.

◆ _async_scene_step()

None homeassistant.helpers.script._ScriptRun._async_scene_step (   self)
private
Activate the scene specified in the action.

Definition at line 785 of file script.py.

◆ _async_sequence_step()

None homeassistant.helpers.script._ScriptRun._async_sequence_step (   self)
private
Run a sequence.

Definition at line 1248 of file script.py.

◆ _async_set_conversation_response_step()

None homeassistant.helpers.script._ScriptRun._async_set_conversation_response_step (   self)
private
Set conversation response.

Definition at line 1213 of file script.py.

◆ _async_set_remaining_time_var()

None homeassistant.helpers.script._ScriptRun._async_set_remaining_time_var (   self,
asyncio.TimerHandle | None   timeout_handle 
)
private
Set the remaining time variable for a wait step.

Definition at line 708 of file script.py.

◆ _async_step()

None homeassistant.helpers.script._ScriptRun._async_step (   self,
bool  log_exceptions 
)
private

Definition at line 493 of file script.py.

◆ _async_stop_step()

None homeassistant.helpers.script._ScriptRun._async_stop_step (   self)
private
Stop script execution.

Definition at line 1225 of file script.py.

◆ _async_variables_step()

None homeassistant.helpers.script._ScriptRun._async_variables_step (   self)
private
Set a variable value.

Definition at line 1206 of file script.py.

◆ _async_wait_for_trigger_step()

None homeassistant.helpers.script._ScriptRun._async_wait_for_trigger_step (   self)
private
Wait for a trigger event.

Definition at line 1129 of file script.py.

◆ _async_wait_template_step()

None homeassistant.helpers.script._ScriptRun._async_wait_template_step (   self)
private
Handle a wait template.

Definition at line 664 of file script.py.

◆ _async_wait_with_optional_timeout()

None homeassistant.helpers.script._ScriptRun._async_wait_with_optional_timeout (   self,
list[asyncio.Future[None]]  futures,
asyncio.TimerHandle | None  timeout_handle,
asyncio.Future[None] | None  timeout_future,
Callable[[], None]  unsub 
)
private

Definition at line 1189 of file script.py.

◆ _changed()

None homeassistant.helpers.script._ScriptRun._changed (   self)
private

Definition at line 429 of file script.py.

◆ _finish()

None homeassistant.helpers.script._ScriptRun._finish (   self)
private

Reimplemented in homeassistant.helpers.script._QueuedScriptRun.

Definition at line 534 of file script.py.

◆ _get_pos_time_period_template()

timedelta homeassistant.helpers.script._ScriptRun._get_pos_time_period_template (   self,
str  key 
)
private

Definition at line 617 of file script.py.

◆ _get_timeout_seconds_from_action()

float | None homeassistant.helpers.script._ScriptRun._get_timeout_seconds_from_action (   self)
private
Get the timeout from the action.

Definition at line 658 of file script.py.

◆ _handle_exception()

None homeassistant.helpers.script._ScriptRun._handle_exception (   self,
Exception  exception,
bool  continue_on_error,
bool   log_exceptions 
)
private

Definition at line 551 of file script.py.

◆ _log()

None homeassistant.helpers.script._ScriptRun._log (   self,
str  msg,
*Any  args,
int   level = logging.INFO,
**Any   kwargs 
)
private

Definition at line 436 of file script.py.

◆ _log_exception()

None homeassistant.helpers.script._ScriptRun._log_exception (   self,
Exception  exception 
)
private

Definition at line 583 of file script.py.

◆ _step_log()

None homeassistant.helpers.script._ScriptRun._step_log (   self,
str  default_message,
float | None   timeout = None 
)
private

Definition at line 441 of file script.py.

◆ _T()

_T | None homeassistant.helpers.script._ScriptRun._T (   self,
asyncio.Task[_T]   long_task 
)
private
Run a long task while monitoring for stop request.

Definition at line 718 of file script.py.

◆ _test_conditions()

bool | None homeassistant.helpers.script._ScriptRun._test_conditions (   self,
list[ConditionCheckerType]  conditions,
str  name,
str | None   condition_path = None 
)
private

Definition at line 839 of file script.py.

◆ async_run()

ScriptRunResult | None homeassistant.helpers.script._ScriptRun.async_run (   self)
Run script.

Reimplemented in homeassistant.helpers.script._QueuedScriptRun.

Definition at line 448 of file script.py.

◆ async_stop()

None homeassistant.helpers.script._ScriptRun.async_stop (   self)
Stop script run.

Definition at line 541 of file script.py.

Member Data Documentation

◆ _context

homeassistant.helpers.script._ScriptRun._context
private

Definition at line 421 of file script.py.

◆ _conversation_response

homeassistant.helpers.script._ScriptRun._conversation_response
private

Definition at line 1218 of file script.py.

◆ _hass

homeassistant.helpers.script._ScriptRun._hass
private

Definition at line 418 of file script.py.

◆ _log_exceptions

homeassistant.helpers.script._ScriptRun._log_exceptions
private

Definition at line 422 of file script.py.

◆ _script

homeassistant.helpers.script._ScriptRun._script
private

Definition at line 419 of file script.py.

◆ _started

homeassistant.helpers.script._ScriptRun._started
private

Definition at line 424 of file script.py.

◆ _step

homeassistant.helpers.script._ScriptRun._step
private

Definition at line 423 of file script.py.

◆ _stop

homeassistant.helpers.script._ScriptRun._stop
private

Definition at line 425 of file script.py.

◆ _stopped

homeassistant.helpers.script._ScriptRun._stopped
private

Definition at line 426 of file script.py.

◆ _variables

homeassistant.helpers.script._ScriptRun._variables
private

Definition at line 420 of file script.py.


The documentation for this class was generated from the following file: