ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
alarm_control_panel.h
Go to the documentation of this file.
1#pragma once
2
5
8#include "esphome/core/log.h"
9
11
13 // Matches Home Assistant values
20};
21
23 public:
28
34
40 void add_on_state_callback(std::function<void()> &&callback);
41
46 void add_on_cleared_callback(std::function<void()> &&callback);
47
52 void add_on_chime_callback(std::function<void()> &&callback);
53
58 void add_on_ready_callback(std::function<void()> &&callback);
59
63 virtual uint32_t get_supported_features() const = 0;
64
68 virtual bool get_requires_code() const = 0;
69
73 virtual bool get_requires_code_to_arm() const = 0;
74
80
86
92
98
104
110
115
116 // is the state one of the armed states
118
119 protected:
121 // in order to store last panel state in flash
123 // current state
125 // the desired (or previous) state
127 // last time the state was updated
128 uint32_t last_update_;
129 // the call control function
130 virtual void control(const AlarmControlPanelCall &call) = 0;
131 // state callback - triggers check get_state() for specific state
133 // clear callback - fires when leaving TRIGGERED state
135 // chime callback
137 // ready callback
139};
140
141} // namespace esphome::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.
bool is_state_armed(AlarmControlPanelState state)
void arm_vacation(optional< std::string > code=nullopt)
arm the alarm in vacation mode
virtual uint32_t get_supported_features() const =0
A numeric representation of the supported features as per HomeAssistant.
void arm_home(optional< std::string > code=nullopt)
arm the alarm in home mode
void arm_away(optional< std::string > code=nullopt)
arm the alarm in away mode
AlarmControlPanelState get_state() const
Get the state.
void arm_night(optional< std::string > code=nullopt)
arm the alarm in night mode
virtual bool get_requires_code_to_arm() const =0
Returns if the alarm_control_panel requires a code to arm.
void arm_custom_bypass(optional< std::string > code=nullopt)
arm the alarm in custom bypass mode
virtual bool get_requires_code() const =0
Returns if the alarm_control_panel has a code.
void publish_state(AlarmControlPanelState state)
Set the state of the alarm_control_panel.
void disarm(optional< std::string > code=nullopt)
disarm the alarm
void add_on_ready_callback(std::function< void()> &&callback)
Add a callback for when a ready state 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.
AlarmControlPanelCall make_call()
Make a AlarmControlPanelCall.
virtual void control(const AlarmControlPanelCall &call)=0
bool state
Definition fan.h:0
const nullopt_t nullopt((nullopt_t::init()))