|
ESPHome 2026.2.1
|
#include <alarm_control_panel.h>
Public Member Functions | |
| AlarmControlPanelCall | make_call () |
| Make a AlarmControlPanelCall. | |
| void | publish_state (AlarmControlPanelState state) |
| Set the state of the alarm_control_panel. | |
| void | add_on_state_callback (std::function< void()> &&callback) |
| Add a callback for when the state of the alarm_control_panel changes. | |
| void | add_on_cleared_callback (std::function< void()> &&callback) |
| Add a callback for when the state of the alarm_control_panel clears from triggered. | |
| void | add_on_chime_callback (std::function< void()> &&callback) |
| Add a callback for when a chime zone goes from closed to open. | |
| void | add_on_ready_callback (std::function< void()> &&callback) |
| Add a callback for when a ready state changes. | |
| virtual uint32_t | get_supported_features () const =0 |
| A numeric representation of the supported features as per HomeAssistant. | |
| virtual bool | get_requires_code () const =0 |
| Returns if the alarm_control_panel has a code. | |
| virtual bool | get_requires_code_to_arm () const =0 |
| Returns if the alarm_control_panel requires a code to arm. | |
| void | arm_away (const char *code=nullptr) |
| arm the alarm in away mode | |
| void | arm_away (const optional< std::string > &code) |
| void | arm_home (const char *code=nullptr) |
| arm the alarm in home mode | |
| void | arm_home (const optional< std::string > &code) |
| void | arm_night (const char *code=nullptr) |
| arm the alarm in night mode | |
| void | arm_night (const optional< std::string > &code) |
| void | arm_vacation (const char *code=nullptr) |
| arm the alarm in vacation mode | |
| void | arm_vacation (const optional< std::string > &code) |
| void | arm_custom_bypass (const char *code=nullptr) |
| arm the alarm in custom bypass mode | |
| void | arm_custom_bypass (const optional< std::string > &code) |
| void | disarm (const char *code=nullptr) |
| disarm the alarm | |
| void | disarm (const optional< std::string > &code) |
| AlarmControlPanelState | get_state () const |
| Get the state. | |
| bool | is_state_armed (AlarmControlPanelState state) |
Public Member Functions inherited from esphome::EntityBase | |
| const StringRef & | get_name () const |
| void | set_name (const char *name) |
| void | set_name (const char *name, uint32_t object_id_hash) |
| Set name with pre-computed object_id hash (avoids runtime hash calculation) Use hash=0 for dynamic names that need runtime calculation. | |
| bool | has_own_name () const |
| ESPDEPRECATED("object_id mangles names and all object_id methods are planned for removal " "(see https://github.com/esphome/backlog/issues/76). " "Now is the time to stop using object_id. If still needed, use get_object_id_to() " "which will remain available longer. get_object_id() will be removed in 2026.7.0", "2025.12.0") std uint32_t | get_object_id_hash () |
| StringRef | get_object_id_to (std::span< char, OBJECT_ID_MAX_LEN > buf) const |
| Get object_id with zero heap allocation For static case: returns StringRef to internal storage (buffer unused) For dynamic case: formats into buffer and returns StringRef to buffer. | |
| size_t | write_object_id_to (char *buf, size_t buf_size) const |
| Write object_id directly to buffer, returns length written (excluding null) Useful for building compound strings without intermediate buffer. | |
| 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) |
| ESPDEPRECATED("Use get_icon_ref() instead for better performance (avoids string copy). Will be removed in ESPHome 2026.5.0", "2025.11.0") std void | set_icon (const char *icon) |
| StringRef | get_icon_ref () const |
| uint32_t | get_device_id () const |
| void | set_device (Device *device) |
| Device * | get_device () const |
| bool | has_state () const |
| void | set_has_state (bool state) |
| ESPDEPRECATED ("Use make_entity_preference<T>() instead, or preferences won't be migrated. " "See https://github.com/esphome/backlog/issues/85. Will be removed in 2027.1.0.", "2026.7.0") uint32_t get_preference_hash() | |
| Get a unique hash for storing preferences/settings for this entity. | |
| template<typename T > | |
| ESPPreferenceObject | make_entity_preference (uint32_t version=0) |
| Create a preference object for storing this entity's state/settings. | |
Protected Member Functions | |
| void | arm_with_code_ (AlarmControlPanelCall &(AlarmControlPanelCall::*arm_method)(), const char *code) |
| virtual void | control (const AlarmControlPanelCall &call)=0 |
Protected Member Functions inherited from esphome::EntityBase | |
| ESPPreferenceObject | make_entity_preference_ (size_t size, uint32_t version) |
| Non-template helper for make_entity_preference() to avoid code bloat. | |
| void | calc_object_id_ () |
Protected Attributes | |
| friend | AlarmControlPanelCall |
| ESPPreferenceObject | pref_ |
| AlarmControlPanelState | current_state_ |
| AlarmControlPanelState | desired_state_ |
| uint32_t | last_update_ |
| LazyCallbackManager< void()> | state_callback_ {} |
| LazyCallbackManager< void()> | cleared_callback_ {} |
| LazyCallbackManager< void()> | chime_callback_ {} |
| LazyCallbackManager< void()> | ready_callback_ {} |
Protected Attributes inherited from esphome::EntityBase | |
| StringRef | name_ |
| const char * | icon_c_str_ {nullptr} |
| uint32_t | object_id_hash_ {} |
| Device * | device_ {} |
| struct esphome::EntityBase::EntityFlags | flags_ |
Definition at line 22 of file alarm_control_panel.h.
| void esphome::alarm_control_panel::AlarmControlPanel::add_on_chime_callback | ( | std::function< void()> && | callback | ) |
Add a callback for when a chime zone goes from closed to open.
| callback | The callback function |
Definition at line 62 of file alarm_control_panel.cpp.
| void esphome::alarm_control_panel::AlarmControlPanel::add_on_cleared_callback | ( | std::function< void()> && | callback | ) |
Add a callback for when the state of the alarm_control_panel clears from triggered.
| callback | The callback function |
Definition at line 58 of file alarm_control_panel.cpp.
| void esphome::alarm_control_panel::AlarmControlPanel::add_on_ready_callback | ( | std::function< void()> && | callback | ) |
Add a callback for when a ready state changes.
| callback | The callback function |
Definition at line 66 of file alarm_control_panel.cpp.
| void esphome::alarm_control_panel::AlarmControlPanel::add_on_state_callback | ( | std::function< void()> && | callback | ) |
Add a callback for when the state of the alarm_control_panel changes.
Triggers can check get_state() to determine the new state.
| callback | The callback function |
Definition at line 54 of file alarm_control_panel.cpp.
| void esphome::alarm_control_panel::AlarmControlPanel::arm_away | ( | const char * | code = nullptr | ) |
arm the alarm in away mode
| code | The code |
Definition at line 79 of file alarm_control_panel.cpp.
|
inline |
Definition at line 80 of file alarm_control_panel.h.
| void esphome::alarm_control_panel::AlarmControlPanel::arm_custom_bypass | ( | const char * | code = nullptr | ) |
arm the alarm in custom bypass mode
| code | The code |
Definition at line 89 of file alarm_control_panel.cpp.
|
inline |
Definition at line 116 of file alarm_control_panel.h.
| void esphome::alarm_control_panel::AlarmControlPanel::arm_home | ( | const char * | code = nullptr | ) |
arm the alarm in home mode
| code | The code |
Definition at line 81 of file alarm_control_panel.cpp.
|
inline |
Definition at line 89 of file alarm_control_panel.h.
| void esphome::alarm_control_panel::AlarmControlPanel::arm_night | ( | const char * | code = nullptr | ) |
arm the alarm in night mode
| code | The code |
Definition at line 83 of file alarm_control_panel.cpp.
|
inline |
Definition at line 98 of file alarm_control_panel.h.
| void esphome::alarm_control_panel::AlarmControlPanel::arm_vacation | ( | const char * | code = nullptr | ) |
arm the alarm in vacation mode
| code | The code |
Definition at line 85 of file alarm_control_panel.cpp.
|
inline |
Definition at line 107 of file alarm_control_panel.h.
|
protected |
Definition at line 70 of file alarm_control_panel.cpp.
|
protectedpure virtual |
Implemented in esphome::demo::DemoAlarmControlPanel, and esphome::template_::TemplateAlarmControlPanel.
| void esphome::alarm_control_panel::AlarmControlPanel::disarm | ( | const char * | code = nullptr | ) |
|
inline |
Definition at line 125 of file alarm_control_panel.h.
|
pure virtual |
Returns if the alarm_control_panel has a code.
Implemented in esphome::demo::DemoAlarmControlPanel, and esphome::template_::TemplateAlarmControlPanel.
|
pure virtual |
Returns if the alarm_control_panel requires a code to arm.
Implemented in esphome::demo::DemoAlarmControlPanel, and esphome::template_::TemplateAlarmControlPanel.
|
inline |
Get the state.
Definition at line 130 of file alarm_control_panel.h.
|
pure virtual |
A numeric representation of the supported features as per HomeAssistant.
Implemented in esphome::demo::DemoAlarmControlPanel, and esphome::template_::TemplateAlarmControlPanel.
| bool esphome::alarm_control_panel::AlarmControlPanel::is_state_armed | ( | AlarmControlPanelState | state | ) |
Definition at line 17 of file alarm_control_panel.cpp.
| AlarmControlPanelCall esphome::alarm_control_panel::AlarmControlPanel::make_call | ( | ) |
Make a AlarmControlPanelCall.
Definition at line 15 of file alarm_control_panel.cpp.
| void esphome::alarm_control_panel::AlarmControlPanel::publish_state | ( | AlarmControlPanelState | state | ) |
Set the state of the alarm_control_panel.
| state | The AlarmControlPanelState. |
Definition at line 30 of file alarm_control_panel.cpp.
|
protected |
Definition at line 136 of file alarm_control_panel.h.
|
protected |
Definition at line 154 of file alarm_control_panel.h.
|
protected |
Definition at line 152 of file alarm_control_panel.h.
|
protected |
Definition at line 142 of file alarm_control_panel.h.
|
protected |
Definition at line 144 of file alarm_control_panel.h.
|
protected |
Definition at line 146 of file alarm_control_panel.h.
|
protected |
Definition at line 140 of file alarm_control_panel.h.
|
protected |
Definition at line 156 of file alarm_control_panel.h.
|
protected |
Definition at line 150 of file alarm_control_panel.h.