ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::IfAction< HasElse, Ts > Class Template Reference

#include <base_automation.h>

Inheritance diagram for esphome::IfAction< HasElse, Ts >:
esphome::Action< Ts... >

Data Structures

struct  NoElse
 

Public Member Functions

 IfAction (Condition< Ts... > *condition)
 
void add_then (const std::initializer_list< Action< Ts... > * > &actions)
 
void add_else (const std::initializer_list< Action< Ts... > * > &actions)
 
void add_then_action (Action< Ts... > *action)
 
void finish_then ()
 
void add_else_action (Action< Ts... > *action)
 
void finish_else ()
 
void play_complex (const Ts &...x) final
 
void play (const Ts &...x) override
 
void stop () override
 
- Public Member Functions inherited from esphome::Action< Ts... >
void stop_complex ()
 
bool is_running ()
 Check if this or any of the following actions are currently running.
 
int num_running_total ()
 The total number of actions that are currently running in this plus any of the following actions in the chain.
 

Protected Attributes

Condition< Ts... > * condition_
 
ActionList< Ts... > then_
 
std::conditional_t< HasElse, ActionList< Ts... >, NoElse > else_
 
- Protected Attributes inherited from esphome::Action< Ts... >
friend ActionList< Ts... >
 
Action< Ts... > * next_
 
int num_running_
 The number of instances of this sequence in the list of actions that is currently being executed.
 

Additional Inherited Members

- Protected Member Functions inherited from esphome::Action< Ts... >
void play_next_ (const Ts &...x)
 
void play_next_tuple_ (const std::tuple< Ts... > &tuple, std::index_sequence< S... >)
 
void play_next_tuple_ (const std::tuple< Ts... > &tuple)
 
void stop_next_ ()
 
bool is_running_next_ ()
 
bool next_is_owner_ () const
 
Action * owner_ () const
 Only valid when next_is_owner_().
 
Action * chain_next_ () const
 
- Static Protected Member Functions inherited from esphome::Action< Ts... >
static Action * tag_owner (Action *owner)
 
- Static Protected Attributes inherited from esphome::Action< Ts... >
static constexpr uintptr_t OWNER_TAG
 

Detailed Description

template<bool HasElse, typename... Ts>
class esphome::IfAction< HasElse, Ts >

Definition at line 284 of file base_automation.h.

Constructor & Destructor Documentation

◆ IfAction()

template<bool HasElse, typename... Ts>
esphome::IfAction< HasElse, Ts >::IfAction ( Condition< Ts... > * condition)
inlineexplicit

Definition at line 286 of file base_automation.h.

Member Function Documentation

◆ add_else()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::add_else ( const std::initializer_list< Action< Ts... > * > & actions)
inline

Definition at line 296 of file base_automation.h.

◆ add_else_action()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::add_else_action ( Action< Ts... > * action)
inline

Definition at line 307 of file base_automation.h.

◆ add_then()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::add_then ( const std::initializer_list< Action< Ts... > * > & actions)
inline

Definition at line 291 of file base_automation.h.

◆ add_then_action()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::add_then_action ( Action< Ts... > * action)
inline

Definition at line 305 of file base_automation.h.

◆ finish_else()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::finish_else ( )
inline

Definition at line 312 of file base_automation.h.

◆ finish_then()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::finish_then ( )
inline

Definition at line 306 of file base_automation.h.

◆ play()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::play ( const Ts &... x)
inlineoverridevirtual

Implements esphome::Action< Ts... >.

Definition at line 336 of file base_automation.h.

◆ play_complex()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::play_complex ( const Ts &... x)
inlinefinalvirtual

Reimplemented from esphome::Action< Ts... >.

Definition at line 318 of file base_automation.h.

◆ stop()

template<bool HasElse, typename... Ts>
void esphome::IfAction< HasElse, Ts >::stop ( )
inlineoverridevirtual

Reimplemented from esphome::Action< Ts... >.

Definition at line 338 of file base_automation.h.

Field Documentation

◆ condition_

template<bool HasElse, typename... Ts>
Condition<Ts...>* esphome::IfAction< HasElse, Ts >::condition_
protected

Definition at line 346 of file base_automation.h.

◆ else_

template<bool HasElse, typename... Ts>
std::conditional_t<HasElse, ActionList<Ts...>, NoElse> esphome::IfAction< HasElse, Ts >::else_
protected

Definition at line 349 of file base_automation.h.

◆ then_

template<bool HasElse, typename... Ts>
ActionList<Ts...> esphome::IfAction< HasElse, Ts >::then_
protected

Definition at line 347 of file base_automation.h.


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