ESPHome  2024.11.0
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::script::Script< Ts > Class Template Referenceabstract

The abstract base class for all script types. More...

#include <script.h>

Inheritance diagram for esphome::script::Script< Ts >:
esphome::script::ScriptLogger esphome::Trigger< Ts... >

Public Member Functions

virtual void execute (Ts...)=0
 Execute a new instance of this script. More...
 
virtual bool is_running ()
 Check if any instance of this script is currently running. More...
 
virtual void stop ()
 Stop all instances of this script. More...
 
void execute_tuple (const std::tuple< Ts... > &tuple)
 
void set_name (const std::string &name)
 
- Public Member Functions inherited from esphome::Trigger< Ts... >
void trigger (Ts... x)
 Inform the parent automation that the event has triggered. More...
 
void set_automation_parent (Automation< Ts... > *automation_parent)
 
void stop_action ()
 Stop any action connected to this trigger. More...
 
bool is_action_running ()
 Returns true if any action connected to this trigger is running. More...
 

Protected Member Functions

template<int... S>
void execute_tuple_ (const std::tuple< Ts... > &tuple, seq< S... >)
 
- Protected Member Functions inherited from esphome::script::ScriptLogger
void esp_logw_ (int line, const char *format, const char *param)
 
void esp_logd_ (int line, const char *format, const char *param)
 
void esp_log_ (int level, int line, const char *format, const char *param)
 

Protected Attributes

std::string name_
 
- Protected Attributes inherited from esphome::Trigger< Ts... >
Automation< Ts... > * automation_parent_
 

Detailed Description

template<typename... Ts>
class esphome::script::Script< Ts >

The abstract base class for all script types.

Definition at line 23 of file script.h.

Member Function Documentation

◆ execute()

template<typename... Ts>
virtual void esphome::script::Script< Ts >::execute ( Ts...  )
pure virtual

Execute a new instance of this script.

The behavior of this function when a script is already running is defined by the subtypes

Implemented in esphome::script::ParallelScript< Ts >, esphome::script::QueueingScript< Ts >, esphome::script::RestartScript< Ts >, and esphome::script::SingleScript< Ts >.

◆ execute_tuple()

template<typename... Ts>
void esphome::script::Script< Ts >::execute_tuple ( const std::tuple< Ts... > &  tuple)
inline

Definition at line 36 of file script.h.

◆ execute_tuple_()

template<typename... Ts>
template<int... S>
void esphome::script::Script< Ts >::execute_tuple_ ( const std::tuple< Ts... > &  tuple,
seq< S... >   
)
inlineprotected

Definition at line 44 of file script.h.

◆ is_running()

template<typename... Ts>
virtual bool esphome::script::Script< Ts >::is_running ( )
inlinevirtual

Check if any instance of this script is currently running.

Definition at line 31 of file script.h.

◆ set_name()

template<typename... Ts>
void esphome::script::Script< Ts >::set_name ( const std::string &  name)
inline

Definition at line 41 of file script.h.

◆ stop()

template<typename... Ts>
virtual void esphome::script::Script< Ts >::stop ( )
inlinevirtual

Stop all instances of this script.

Reimplemented in esphome::script::QueueingScript< Ts >.

Definition at line 33 of file script.h.

Field Documentation

◆ name_

template<typename... Ts>
std::string esphome::script::Script< Ts >::name_
protected

Definition at line 48 of file script.h.


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