ESPHome  2024.12.2
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::template_::TemplateAlarmControlPanel Class Reference

#include <template_alarm_control_panel.h>

Inheritance diagram for esphome::template_::TemplateAlarmControlPanel:
esphome::alarm_control_panel::AlarmControlPanel esphome::Component esphome::EntityBase

Public Member Functions

 TemplateAlarmControlPanel ()
 
void dump_config () override
 
void setup () override
 
void loop () override
 
uint32_t get_supported_features () const override
 
bool get_requires_code () const override
 
bool get_requires_code_to_arm () const override
 
bool get_all_sensors_ready ()
 
void set_restore_mode (TemplateAlarmControlPanelRestoreMode restore_mode)
 
void add_sensor (binary_sensor::BinarySensor *sensor, uint16_t flags=0, AlarmSensorType type=ALARM_SENSOR_TYPE_DELAYED)
 Add a binary_sensor to the alarm_panel. More...
 
void add_code (const std::string &code)
 add a code More...
 
void set_requires_code_to_arm (bool code_to_arm)
 set requires a code to arm More...
 
void set_arming_away_time (uint32_t time)
 set the delay before arming away More...
 
void set_arming_home_time (uint32_t time)
 set the delay before arming home More...
 
void set_arming_night_time (uint32_t time)
 set the delay before arming night More...
 
void set_pending_time (uint32_t time)
 set the delay before triggering More...
 
void set_trigger_time (uint32_t time)
 set the delay before resetting after triggered More...
 
void set_supports_arm_home (bool supports_arm_home)
 
void set_supports_arm_night (bool supports_arm_night)
 
- Public Member Functions inherited from esphome::alarm_control_panel::AlarmControlPanel
AlarmControlPanelCall make_call ()
 Make a AlarmControlPanelCall. More...
 
void publish_state (AlarmControlPanelState state)
 Set the state of the alarm_control_panel. More...
 
void add_on_state_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes. More...
 
void add_on_triggered_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel chanes to triggered. More...
 
void add_on_arming_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel chanes to arming. More...
 
void add_on_pending_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes to pending. More...
 
void add_on_armed_home_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes to armed_home. More...
 
void add_on_armed_night_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes to armed_night. More...
 
void add_on_armed_away_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes to armed_away. More...
 
void add_on_disarmed_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel changes to disarmed. More...
 
void add_on_cleared_callback (std::function< void()> &&callback)
 Add a callback for when the state of the alarm_control_panel clears from triggered. More...
 
void add_on_chime_callback (std::function< void()> &&callback)
 Add a callback for when a chime zone goes from closed to open. More...
 
void add_on_ready_callback (std::function< void()> &&callback)
 Add a callback for when a ready state changes. More...
 
void arm_away (optional< std::string > code=nullopt)
 arm the alarm in away mode More...
 
void arm_home (optional< std::string > code=nullopt)
 arm the alarm in home mode More...
 
void arm_night (optional< std::string > code=nullopt)
 arm the alarm in night mode More...
 
void arm_vacation (optional< std::string > code=nullopt)
 arm the alarm in vacation mode More...
 
void arm_custom_bypass (optional< std::string > code=nullopt)
 arm the alarm in custom bypass mode More...
 
void disarm (optional< std::string > code=nullopt)
 disarm the alarm More...
 
AlarmControlPanelState get_state () const
 Get the state. More...
 
bool is_state_armed (AlarmControlPanelState state)
 
- Public Member Functions inherited from esphome::EntityBase
const StringRefget_name () const
 
void set_name (const char *name)
 
bool has_own_name () const
 
std::string get_object_id () const
 
void set_object_id (const char *object_id)
 
uint32_t get_object_id_hash ()
 
bool is_internal () const
 
void set_internal (bool internal)
 
bool is_disabled_by_default () const
 
void set_disabled_by_default (bool disabled_by_default)
 
EntityCategory get_entity_category () const
 
void set_entity_category (EntityCategory entity_category)
 
std::string get_icon () const
 
void set_icon (const char *icon)
 
- Public Member Functions inherited from esphome::Component
virtual float get_setup_priority () const
 priority of setup(). More...
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed () const
 
bool is_ready () const
 
virtual bool can_proceed ()
 
bool status_has_warning () const
 
bool status_has_error () const
 
void status_set_warning (const char *message="unspecified")
 
void status_set_error (const char *message="unspecified")
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
 
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
 

Protected Member Functions

void control (const alarm_control_panel::AlarmControlPanelCall &call) override
 
bool is_code_valid_ (optional< std::string > code)
 
void arm_ (optional< std::string > code, alarm_control_panel::AlarmControlPanelState state, uint32_t delay)
 
- Protected Member Functions inherited from esphome::EntityBase
virtual uint32_t hash_base ()
 The hash_base() function has been deprecated. More...
 
void calc_object_id_ ()
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_setup ()
 
virtual void call_dump_config ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name. More...
 
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 
bool cancel_retry (const std::string &name)
 Cancel a retry function. More...
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 

Protected Attributes

std::map< binary_sensor::BinarySensor *, SensorInfosensor_map_
 
TemplateAlarmControlPanelRestoreMode restore_mode_ {}
 
uint32_t arming_away_time_
 
uint32_t arming_home_time_ {0}
 
uint32_t arming_night_time_ {0}
 
uint32_t pending_time_
 
uint32_t trigger_time_
 
std::vector< std::string > codes_
 
std::vector< SensorDataStoresensor_data_
 
bool requires_code_to_arm_ = false
 
bool supports_arm_home_ = false
 
bool supports_arm_night_ = false
 
bool sensors_ready_ = false
 
bool sensors_ready_last_ = false
 
uint8_t next_store_index_ = 0
 
- Protected Attributes inherited from esphome::alarm_control_panel::AlarmControlPanel
friend AlarmControlPanelCall
 
ESPPreferenceObject pref_
 
AlarmControlPanelState current_state_
 
AlarmControlPanelState desired_state_
 
uint32_t last_update_
 
CallbackManager< void()> state_callback_ {}
 
CallbackManager< void()> triggered_callback_ {}
 
CallbackManager< void()> arming_callback_ {}
 
CallbackManager< void()> pending_callback_ {}
 
CallbackManager< void()> armed_home_callback_ {}
 
CallbackManager< void()> armed_night_callback_ {}
 
CallbackManager< void()> armed_away_callback_ {}
 
CallbackManager< void()> disarmed_callback_ {}
 
CallbackManager< void()> cleared_callback_ {}
 
CallbackManager< void()> chime_callback_ {}
 
CallbackManager< void()> ready_callback_ {}
 
- Protected Attributes inherited from esphome::EntityBase
StringRef name_
 
const char * object_id_c_str_ {nullptr}
 
const char * icon_c_str_ {nullptr}
 
uint32_t object_id_hash_
 
bool has_own_name_ {false}
 
bool internal_ {false}
 
bool disabled_by_default_ {false}
 
EntityCategory entity_category_ {ENTITY_CATEGORY_NONE}
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 
const char * component_source_ {nullptr}
 

Detailed Description

Definition at line 50 of file template_alarm_control_panel.h.

Constructor & Destructor Documentation

◆ TemplateAlarmControlPanel()

esphome::template_::TemplateAlarmControlPanel::TemplateAlarmControlPanel ( )

Definition at line 16 of file template_alarm_control_panel.cpp.

Member Function Documentation

◆ add_code()

void esphome::template_::TemplateAlarmControlPanel::add_code ( const std::string &  code)
inline

add a code

Parameters
codeThe code

Definition at line 76 of file template_alarm_control_panel.h.

◆ add_sensor()

void esphome::template_::TemplateAlarmControlPanel::add_sensor ( binary_sensor::BinarySensor sensor,
uint16_t  flags = 0,
AlarmSensorType  type = ALARM_SENSOR_TYPE_DELAYED 
)

Add a binary_sensor to the alarm_panel.

Parameters
sensorThe BinarySensor instance.
ignore_when_homeif this should be ignored when armed_home mode

Definition at line 19 of file template_alarm_control_panel.cpp.

◆ arm_()

void esphome::template_::TemplateAlarmControlPanel::arm_ ( optional< std::string >  code,
alarm_control_panel::AlarmControlPanelState  state,
uint32_t  delay 
)
protected

Definition at line 221 of file template_alarm_control_panel.cpp.

◆ control()

void esphome::template_::TemplateAlarmControlPanel::control ( const alarm_control_panel::AlarmControlPanelCall call)
overrideprotectedvirtual

◆ dump_config()

void esphome::template_::TemplateAlarmControlPanel::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 30 of file template_alarm_control_panel.cpp.

◆ get_all_sensors_ready()

bool esphome::template_::TemplateAlarmControlPanel::get_all_sensors_ready ( )
inline

Definition at line 59 of file template_alarm_control_panel.h.

◆ get_requires_code()

bool esphome::template_::TemplateAlarmControlPanel::get_requires_code ( ) const
overridevirtual

◆ get_requires_code_to_arm()

bool esphome::template_::TemplateAlarmControlPanel::get_requires_code_to_arm ( ) const
inlineoverridevirtual

◆ get_supported_features()

uint32_t esphome::template_::TemplateAlarmControlPanel::get_supported_features ( ) const
overridevirtual

◆ is_code_valid_()

bool esphome::template_::TemplateAlarmControlPanel::is_code_valid_ ( optional< std::string >  code)
protected

Definition at line 196 of file template_alarm_control_panel.cpp.

◆ loop()

void esphome::template_::TemplateAlarmControlPanel::loop ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 90 of file template_alarm_control_panel.cpp.

◆ set_arming_away_time()

void esphome::template_::TemplateAlarmControlPanel::set_arming_away_time ( uint32_t  time)
inline

set the delay before arming away

Parameters
timeThe milliseconds

Definition at line 88 of file template_alarm_control_panel.h.

◆ set_arming_home_time()

void esphome::template_::TemplateAlarmControlPanel::set_arming_home_time ( uint32_t  time)
inline

set the delay before arming home

Parameters
timeThe milliseconds

Definition at line 94 of file template_alarm_control_panel.h.

◆ set_arming_night_time()

void esphome::template_::TemplateAlarmControlPanel::set_arming_night_time ( uint32_t  time)
inline

set the delay before arming night

Parameters
timeThe milliseconds

Definition at line 100 of file template_alarm_control_panel.h.

◆ set_pending_time()

void esphome::template_::TemplateAlarmControlPanel::set_pending_time ( uint32_t  time)
inline

set the delay before triggering

Parameters
timeThe milliseconds

Definition at line 106 of file template_alarm_control_panel.h.

◆ set_requires_code_to_arm()

void esphome::template_::TemplateAlarmControlPanel::set_requires_code_to_arm ( bool  code_to_arm)
inline

set requires a code to arm

Parameters
code_to_armThe requires code to arm

Definition at line 82 of file template_alarm_control_panel.h.

◆ set_restore_mode()

void esphome::template_::TemplateAlarmControlPanel::set_restore_mode ( TemplateAlarmControlPanelRestoreMode  restore_mode)
inline

Definition at line 60 of file template_alarm_control_panel.h.

◆ set_supports_arm_home()

void esphome::template_::TemplateAlarmControlPanel::set_supports_arm_home ( bool  supports_arm_home)
inline

Definition at line 114 of file template_alarm_control_panel.h.

◆ set_supports_arm_night()

void esphome::template_::TemplateAlarmControlPanel::set_supports_arm_night ( bool  supports_arm_night)
inline

Definition at line 116 of file template_alarm_control_panel.h.

◆ set_trigger_time()

void esphome::template_::TemplateAlarmControlPanel::set_trigger_time ( uint32_t  time)
inline

set the delay before resetting after triggered

Parameters
timeThe milliseconds

Definition at line 112 of file template_alarm_control_panel.h.

◆ setup()

void esphome::template_::TemplateAlarmControlPanel::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 70 of file template_alarm_control_panel.cpp.

Field Documentation

◆ arming_away_time_

uint32_t esphome::template_::TemplateAlarmControlPanel::arming_away_time_
protected

Definition at line 128 of file template_alarm_control_panel.h.

◆ arming_home_time_

uint32_t esphome::template_::TemplateAlarmControlPanel::arming_home_time_ {0}
protected

Definition at line 130 of file template_alarm_control_panel.h.

◆ arming_night_time_

uint32_t esphome::template_::TemplateAlarmControlPanel::arming_night_time_ {0}
protected

Definition at line 132 of file template_alarm_control_panel.h.

◆ codes_

std::vector<std::string> esphome::template_::TemplateAlarmControlPanel::codes_
protected

Definition at line 138 of file template_alarm_control_panel.h.

◆ next_store_index_

uint8_t esphome::template_::TemplateAlarmControlPanel::next_store_index_ = 0
protected

Definition at line 147 of file template_alarm_control_panel.h.

◆ pending_time_

uint32_t esphome::template_::TemplateAlarmControlPanel::pending_time_
protected

Definition at line 134 of file template_alarm_control_panel.h.

◆ requires_code_to_arm_

bool esphome::template_::TemplateAlarmControlPanel::requires_code_to_arm_ = false
protected

Definition at line 142 of file template_alarm_control_panel.h.

◆ restore_mode_

TemplateAlarmControlPanelRestoreMode esphome::template_::TemplateAlarmControlPanel::restore_mode_ {}
protected

Definition at line 125 of file template_alarm_control_panel.h.

◆ sensor_data_

std::vector<SensorDataStore> esphome::template_::TemplateAlarmControlPanel::sensor_data_
protected

Definition at line 140 of file template_alarm_control_panel.h.

◆ sensor_map_

std::map<binary_sensor::BinarySensor *, SensorInfo> esphome::template_::TemplateAlarmControlPanel::sensor_map_
protected

Definition at line 122 of file template_alarm_control_panel.h.

◆ sensors_ready_

bool esphome::template_::TemplateAlarmControlPanel::sensors_ready_ = false
protected

Definition at line 145 of file template_alarm_control_panel.h.

◆ sensors_ready_last_

bool esphome::template_::TemplateAlarmControlPanel::sensors_ready_last_ = false
protected

Definition at line 146 of file template_alarm_control_panel.h.

◆ supports_arm_home_

bool esphome::template_::TemplateAlarmControlPanel::supports_arm_home_ = false
protected

Definition at line 143 of file template_alarm_control_panel.h.

◆ supports_arm_night_

bool esphome::template_::TemplateAlarmControlPanel::supports_arm_night_ = false
protected

Definition at line 144 of file template_alarm_control_panel.h.

◆ trigger_time_

uint32_t esphome::template_::TemplateAlarmControlPanel::trigger_time_
protected

Definition at line 136 of file template_alarm_control_panel.h.


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