ESPHome  2024.11.0
application.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
6 #include "esphome/core/defines.h"
7 #include "esphome/core/hal.h"
8 #include "esphome/core/helpers.h"
10 #include "esphome/core/scheduler.h"
11 
12 #ifdef USE_BINARY_SENSOR
14 #endif
15 #ifdef USE_SENSOR
17 #endif
18 #ifdef USE_SWITCH
20 #endif
21 #ifdef USE_BUTTON
23 #endif
24 #ifdef USE_TEXT_SENSOR
26 #endif
27 #ifdef USE_FAN
29 #endif
30 #ifdef USE_CLIMATE
32 #endif
33 #ifdef USE_LIGHT
35 #endif
36 #ifdef USE_COVER
38 #endif
39 #ifdef USE_NUMBER
41 #endif
42 #ifdef USE_DATETIME_DATE
44 #endif
45 #ifdef USE_DATETIME_TIME
47 #endif
48 #ifdef USE_DATETIME_DATETIME
50 #endif
51 #ifdef USE_TEXT
53 #endif
54 #ifdef USE_SELECT
56 #endif
57 #ifdef USE_LOCK
59 #endif
60 #ifdef USE_VALVE
62 #endif
63 #ifdef USE_MEDIA_PLAYER
65 #endif
66 #ifdef USE_ALARM_CONTROL_PANEL
68 #endif
69 #ifdef USE_EVENT
71 #endif
72 #ifdef USE_UPDATE
74 #endif
75 
76 namespace esphome {
77 
78 class Application {
79  public:
80  void pre_setup(const std::string &name, const std::string &friendly_name, const std::string &area,
81  const char *comment, const char *compilation_time, bool name_add_mac_suffix) {
82  arch_init();
83  this->name_add_mac_suffix_ = name_add_mac_suffix;
84  if (name_add_mac_suffix) {
85  this->name_ = name + "-" + get_mac_address().substr(6);
86  if (friendly_name.empty()) {
87  this->friendly_name_ = "";
88  } else {
89  this->friendly_name_ = friendly_name + " " + get_mac_address().substr(6);
90  }
91  } else {
92  this->name_ = name;
93  this->friendly_name_ = friendly_name;
94  }
95  this->area_ = area;
96  this->comment_ = comment;
97  this->compilation_time_ = compilation_time;
98  }
99 
100 #ifdef USE_BINARY_SENSOR
102  this->binary_sensors_.push_back(binary_sensor);
103  }
104 #endif
105 
106 #ifdef USE_SENSOR
107  void register_sensor(sensor::Sensor *sensor) { this->sensors_.push_back(sensor); }
108 #endif
109 
110 #ifdef USE_SWITCH
111  void register_switch(switch_::Switch *a_switch) { this->switches_.push_back(a_switch); }
112 #endif
113 
114 #ifdef USE_BUTTON
115  void register_button(button::Button *button) { this->buttons_.push_back(button); }
116 #endif
117 
118 #ifdef USE_TEXT_SENSOR
120 #endif
121 
122 #ifdef USE_FAN
123  void register_fan(fan::Fan *state) { this->fans_.push_back(state); }
124 #endif
125 
126 #ifdef USE_COVER
127  void register_cover(cover::Cover *cover) { this->covers_.push_back(cover); }
128 #endif
129 
130 #ifdef USE_CLIMATE
131  void register_climate(climate::Climate *climate) { this->climates_.push_back(climate); }
132 #endif
133 
134 #ifdef USE_LIGHT
135  void register_light(light::LightState *light) { this->lights_.push_back(light); }
136 #endif
137 
138 #ifdef USE_NUMBER
139  void register_number(number::Number *number) { this->numbers_.push_back(number); }
140 #endif
141 
142 #ifdef USE_DATETIME_DATE
143  void register_date(datetime::DateEntity *date) { this->dates_.push_back(date); }
144 #endif
145 
146 #ifdef USE_DATETIME_TIME
147  void register_time(datetime::TimeEntity *time) { this->times_.push_back(time); }
148 #endif
149 
150 #ifdef USE_DATETIME_DATETIME
151  void register_datetime(datetime::DateTimeEntity *datetime) { this->datetimes_.push_back(datetime); }
152 #endif
153 
154 #ifdef USE_TEXT
155  void register_text(text::Text *text) { this->texts_.push_back(text); }
156 #endif
157 
158 #ifdef USE_SELECT
159  void register_select(select::Select *select) { this->selects_.push_back(select); }
160 #endif
161 
162 #ifdef USE_LOCK
163  void register_lock(lock::Lock *a_lock) { this->locks_.push_back(a_lock); }
164 #endif
165 
166 #ifdef USE_VALVE
167  void register_valve(valve::Valve *valve) { this->valves_.push_back(valve); }
168 #endif
169 
170 #ifdef USE_MEDIA_PLAYER
171  void register_media_player(media_player::MediaPlayer *media_player) { this->media_players_.push_back(media_player); }
172 #endif
173 
174 #ifdef USE_ALARM_CONTROL_PANEL
176  this->alarm_control_panels_.push_back(a_alarm_control_panel);
177  }
178 #endif
179 
180 #ifdef USE_EVENT
181  void register_event(event::Event *event) { this->events_.push_back(event); }
182 #endif
183 
184 #ifdef USE_UPDATE
185  void register_update(update::UpdateEntity *update) { this->updates_.push_back(update); }
186 #endif
187 
189  template<class C> C *register_component(C *c) {
190  static_assert(std::is_base_of<Component, C>::value, "Only Component subclasses can be registered");
191  this->register_component_((Component *) c);
192  return c;
193  }
194 
196  void setup();
197 
199  void loop();
200 
202  const std::string &get_name() const { return this->name_; }
203 
205  const std::string &get_friendly_name() const { return this->friendly_name_; }
206 
208  const std::string &get_area() const { return this->area_; }
209 
211  std::string get_comment() const { return this->comment_; }
212 
214 
215  std::string get_compilation_time() const { return this->compilation_time_; }
216 
230  void set_loop_interval(uint32_t loop_interval) { this->loop_interval_ = loop_interval; }
231 
232  uint32_t get_loop_interval() const { return this->loop_interval_; }
233 
234  void schedule_dump_config() { this->dump_config_at_ = 0; }
235 
236  void feed_wdt();
237 
238  void reboot();
239 
240  void safe_reboot();
241 
243 
244  uint32_t get_app_state() const { return this->app_state_; }
245 
246 #ifdef USE_BINARY_SENSOR
247  const std::vector<binary_sensor::BinarySensor *> &get_binary_sensors() { return this->binary_sensors_; }
248  binary_sensor::BinarySensor *get_binary_sensor_by_key(uint32_t key, bool include_internal = false) {
249  for (auto *obj : this->binary_sensors_) {
250  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
251  return obj;
252  }
253  return nullptr;
254  }
255 #endif
256 #ifdef USE_SWITCH
257  const std::vector<switch_::Switch *> &get_switches() { return this->switches_; }
258  switch_::Switch *get_switch_by_key(uint32_t key, bool include_internal = false) {
259  for (auto *obj : this->switches_) {
260  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
261  return obj;
262  }
263  return nullptr;
264  }
265 #endif
266 #ifdef USE_BUTTON
267  const std::vector<button::Button *> &get_buttons() { return this->buttons_; }
268  button::Button *get_button_by_key(uint32_t key, bool include_internal = false) {
269  for (auto *obj : this->buttons_) {
270  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
271  return obj;
272  }
273  return nullptr;
274  }
275 #endif
276 #ifdef USE_SENSOR
277  const std::vector<sensor::Sensor *> &get_sensors() { return this->sensors_; }
278  sensor::Sensor *get_sensor_by_key(uint32_t key, bool include_internal = false) {
279  for (auto *obj : this->sensors_) {
280  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
281  return obj;
282  }
283  return nullptr;
284  }
285 #endif
286 #ifdef USE_TEXT_SENSOR
287  const std::vector<text_sensor::TextSensor *> &get_text_sensors() { return this->text_sensors_; }
288  text_sensor::TextSensor *get_text_sensor_by_key(uint32_t key, bool include_internal = false) {
289  for (auto *obj : this->text_sensors_) {
290  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
291  return obj;
292  }
293  return nullptr;
294  }
295 #endif
296 #ifdef USE_FAN
297  const std::vector<fan::Fan *> &get_fans() { return this->fans_; }
298  fan::Fan *get_fan_by_key(uint32_t key, bool include_internal = false) {
299  for (auto *obj : this->fans_) {
300  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
301  return obj;
302  }
303  return nullptr;
304  }
305 #endif
306 #ifdef USE_COVER
307  const std::vector<cover::Cover *> &get_covers() { return this->covers_; }
308  cover::Cover *get_cover_by_key(uint32_t key, bool include_internal = false) {
309  for (auto *obj : this->covers_) {
310  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
311  return obj;
312  }
313  return nullptr;
314  }
315 #endif
316 #ifdef USE_LIGHT
317  const std::vector<light::LightState *> &get_lights() { return this->lights_; }
318  light::LightState *get_light_by_key(uint32_t key, bool include_internal = false) {
319  for (auto *obj : this->lights_) {
320  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
321  return obj;
322  }
323  return nullptr;
324  }
325 #endif
326 #ifdef USE_CLIMATE
327  const std::vector<climate::Climate *> &get_climates() { return this->climates_; }
328  climate::Climate *get_climate_by_key(uint32_t key, bool include_internal = false) {
329  for (auto *obj : this->climates_) {
330  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
331  return obj;
332  }
333  return nullptr;
334  }
335 #endif
336 #ifdef USE_NUMBER
337  const std::vector<number::Number *> &get_numbers() { return this->numbers_; }
338  number::Number *get_number_by_key(uint32_t key, bool include_internal = false) {
339  for (auto *obj : this->numbers_) {
340  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
341  return obj;
342  }
343  return nullptr;
344  }
345 #endif
346 #ifdef USE_DATETIME_DATE
347  const std::vector<datetime::DateEntity *> &get_dates() { return this->dates_; }
348  datetime::DateEntity *get_date_by_key(uint32_t key, bool include_internal = false) {
349  for (auto *obj : this->dates_) {
350  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
351  return obj;
352  }
353  return nullptr;
354  }
355 #endif
356 #ifdef USE_DATETIME_TIME
357  const std::vector<datetime::TimeEntity *> &get_times() { return this->times_; }
358  datetime::TimeEntity *get_time_by_key(uint32_t key, bool include_internal = false) {
359  for (auto *obj : this->times_) {
360  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
361  return obj;
362  }
363  return nullptr;
364  }
365 #endif
366 #ifdef USE_DATETIME_DATETIME
367  const std::vector<datetime::DateTimeEntity *> &get_datetimes() { return this->datetimes_; }
368  datetime::DateTimeEntity *get_datetime_by_key(uint32_t key, bool include_internal = false) {
369  for (auto *obj : this->datetimes_) {
370  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
371  return obj;
372  }
373  return nullptr;
374  }
375 #endif
376 #ifdef USE_TEXT
377  const std::vector<text::Text *> &get_texts() { return this->texts_; }
378  text::Text *get_text_by_key(uint32_t key, bool include_internal = false) {
379  for (auto *obj : this->texts_) {
380  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
381  return obj;
382  }
383  return nullptr;
384  }
385 #endif
386 #ifdef USE_SELECT
387  const std::vector<select::Select *> &get_selects() { return this->selects_; }
388  select::Select *get_select_by_key(uint32_t key, bool include_internal = false) {
389  for (auto *obj : this->selects_) {
390  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
391  return obj;
392  }
393  return nullptr;
394  }
395 #endif
396 #ifdef USE_LOCK
397  const std::vector<lock::Lock *> &get_locks() { return this->locks_; }
398  lock::Lock *get_lock_by_key(uint32_t key, bool include_internal = false) {
399  for (auto *obj : this->locks_) {
400  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
401  return obj;
402  }
403  return nullptr;
404  }
405 #endif
406 #ifdef USE_VALVE
407  const std::vector<valve::Valve *> &get_valves() { return this->valves_; }
408  valve::Valve *get_valve_by_key(uint32_t key, bool include_internal = false) {
409  for (auto *obj : this->valves_) {
410  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
411  return obj;
412  }
413  return nullptr;
414  }
415 #endif
416 #ifdef USE_MEDIA_PLAYER
417  const std::vector<media_player::MediaPlayer *> &get_media_players() { return this->media_players_; }
418  media_player::MediaPlayer *get_media_player_by_key(uint32_t key, bool include_internal = false) {
419  for (auto *obj : this->media_players_) {
420  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
421  return obj;
422  }
423  return nullptr;
424  }
425 #endif
426 
427 #ifdef USE_ALARM_CONTROL_PANEL
428  const std::vector<alarm_control_panel::AlarmControlPanel *> &get_alarm_control_panels() {
429  return this->alarm_control_panels_;
430  }
431  alarm_control_panel::AlarmControlPanel *get_alarm_control_panel_by_key(uint32_t key, bool include_internal = false) {
432  for (auto *obj : this->alarm_control_panels_) {
433  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
434  return obj;
435  }
436  return nullptr;
437  }
438 #endif
439 
440 #ifdef USE_EVENT
441  const std::vector<event::Event *> &get_events() { return this->events_; }
442  event::Event *get_event_by_key(uint32_t key, bool include_internal = false) {
443  for (auto *obj : this->events_) {
444  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
445  return obj;
446  }
447  return nullptr;
448  }
449 #endif
450 
451 #ifdef USE_UPDATE
452  const std::vector<update::UpdateEntity *> &get_updates() { return this->updates_; }
453  update::UpdateEntity *get_update_by_key(uint32_t key, bool include_internal = false) {
454  for (auto *obj : this->updates_) {
455  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
456  return obj;
457  }
458  return nullptr;
459  }
460 #endif
461 
463 
464  protected:
465  friend Component;
466 
467  void register_component_(Component *comp);
468 
470 
471  void feed_wdt_arch_();
472 
473  std::vector<Component *> components_{};
474  std::vector<Component *> looping_components_{};
475 
476 #ifdef USE_BINARY_SENSOR
477  std::vector<binary_sensor::BinarySensor *> binary_sensors_{};
478 #endif
479 #ifdef USE_SWITCH
480  std::vector<switch_::Switch *> switches_{};
481 #endif
482 #ifdef USE_BUTTON
483  std::vector<button::Button *> buttons_{};
484 #endif
485 #ifdef USE_EVENT
486  std::vector<event::Event *> events_{};
487 #endif
488 #ifdef USE_SENSOR
489  std::vector<sensor::Sensor *> sensors_{};
490 #endif
491 #ifdef USE_TEXT_SENSOR
492  std::vector<text_sensor::TextSensor *> text_sensors_{};
493 #endif
494 #ifdef USE_FAN
495  std::vector<fan::Fan *> fans_{};
496 #endif
497 #ifdef USE_COVER
498  std::vector<cover::Cover *> covers_{};
499 #endif
500 #ifdef USE_CLIMATE
501  std::vector<climate::Climate *> climates_{};
502 #endif
503 #ifdef USE_LIGHT
504  std::vector<light::LightState *> lights_{};
505 #endif
506 #ifdef USE_NUMBER
507  std::vector<number::Number *> numbers_{};
508 #endif
509 #ifdef USE_DATETIME_DATE
510  std::vector<datetime::DateEntity *> dates_{};
511 #endif
512 #ifdef USE_DATETIME_TIME
513  std::vector<datetime::TimeEntity *> times_{};
514 #endif
515 #ifdef USE_DATETIME_DATETIME
516  std::vector<datetime::DateTimeEntity *> datetimes_{};
517 #endif
518 #ifdef USE_SELECT
519  std::vector<select::Select *> selects_{};
520 #endif
521 #ifdef USE_TEXT
522  std::vector<text::Text *> texts_{};
523 #endif
524 #ifdef USE_LOCK
525  std::vector<lock::Lock *> locks_{};
526 #endif
527 #ifdef USE_VALVE
528  std::vector<valve::Valve *> valves_{};
529 #endif
530 #ifdef USE_MEDIA_PLAYER
531  std::vector<media_player::MediaPlayer *> media_players_{};
532 #endif
533 #ifdef USE_ALARM_CONTROL_PANEL
534  std::vector<alarm_control_panel::AlarmControlPanel *> alarm_control_panels_{};
535 #endif
536 #ifdef USE_UPDATE
537  std::vector<update::UpdateEntity *> updates_{};
538 #endif
539 
540  std::string name_;
541  std::string friendly_name_;
542  std::string area_;
543  const char *comment_{nullptr};
544  const char *compilation_time_{nullptr};
546  uint32_t last_loop_{0};
547  uint32_t loop_interval_{16};
548  size_t dump_config_at_{SIZE_MAX};
549  uint32_t app_state_{0};
550 };
551 
553 extern Application App; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
554 
555 } // namespace esphome
Base class for all switches.
Definition: switch.h:39
std::vector< light::LightState * > lights_
Definition: application.h:504
void register_fan(fan::Fan *state)
Definition: application.h:123
std::vector< datetime::DateTimeEntity * > datetimes_
Definition: application.h:516
const std::vector< datetime::DateTimeEntity * > & get_datetimes()
Definition: application.h:367
const char * name
Definition: stm32flash.h:78
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:63
media_player::MediaPlayer * get_media_player_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:418
Base class for all cover devices.
Definition: cover.h:111
text_sensor::TextSensor * get_text_sensor_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:288
void register_button(button::Button *button)
Definition: application.h:115
void register_light(light::LightState *light)
Definition: application.h:135
const std::vector< climate::Climate * > & get_climates()
Definition: application.h:327
void register_climate(climate::Climate *climate)
Definition: application.h:131
climate::Climate * get_climate_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:328
void register_media_player(media_player::MediaPlayer *media_player)
Definition: application.h:171
const std::vector< update::UpdateEntity * > & get_updates()
Definition: application.h:452
const std::vector< alarm_control_panel::AlarmControlPanel * > & get_alarm_control_panels()
Definition: application.h:428
void register_valve(valve::Valve *valve)
Definition: application.h:167
std::vector< binary_sensor::BinarySensor * > binary_sensors_
Definition: application.h:477
select::Select * get_select_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:388
std::vector< update::UpdateEntity * > updates_
Definition: application.h:537
void register_text_sensor(text_sensor::TextSensor *sensor)
Definition: application.h:119
datetime::DateTimeEntity * get_datetime_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:368
const std::vector< valve::Valve * > & get_valves()
Definition: application.h:407
std::vector< alarm_control_panel::AlarmControlPanel * > alarm_control_panels_
Definition: application.h:534
void register_sensor(sensor::Sensor *sensor)
Definition: application.h:107
binary_sensor::BinarySensor * get_binary_sensor_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:248
Base class for all buttons.
Definition: button.h:29
std::vector< valve::Valve * > valves_
Definition: application.h:528
void register_time(datetime::TimeEntity *time)
Definition: application.h:147
C * register_component(C *c)
Register the component in this Application instance.
Definition: application.h:189
lock::Lock * get_lock_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:398
std::vector< datetime::DateEntity * > dates_
Definition: application.h:510
std::vector< number::Number * > numbers_
Definition: application.h:507
const std::vector< event::Event * > & get_events()
Definition: application.h:441
button::Button * get_button_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:268
std::vector< lock::Lock * > locks_
Definition: application.h:525
const std::string & get_area() const
Get the area of this Application set by pre_setup().
Definition: application.h:208
const std::string & get_friendly_name() const
Get the friendly name of this Application set by pre_setup().
Definition: application.h:205
const std::vector< fan::Fan * > & get_fans()
Definition: application.h:297
Base-class for all text inputs.
Definition: text.h:24
void setup()
Set up all the registered components. Call this at the end of your setup() function.
Definition: application.cpp:28
void register_alarm_control_panel(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
Definition: application.h:175
const std::vector< datetime::TimeEntity * > & get_times()
Definition: application.h:357
alarm_control_panel::AlarmControlPanel * get_alarm_control_panel_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:431
void register_cover(cover::Cover *cover)
Definition: application.h:127
void register_number(number::Number *number)
Definition: application.h:139
std::vector< cover::Cover * > covers_
Definition: application.h:498
cover::Cover * get_cover_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:308
const std::vector< lock::Lock * > & get_locks()
Definition: application.h:397
std::string friendly_name_
Definition: application.h:541
void pre_setup(const std::string &name, const std::string &friendly_name, const std::string &area, const char *comment, const char *compilation_time, bool name_add_mac_suffix)
Definition: application.h:80
std::vector< media_player::MediaPlayer * > media_players_
Definition: application.h:531
fan::Fan * get_fan_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:298
void register_date(datetime::DateEntity *date)
Definition: application.h:143
void loop()
Make a loop iteration. Call this in your loop() function.
Definition: application.cpp:66
void register_event(event::Event *event)
Definition: application.h:181
std::vector< sensor::Sensor * > sensors_
Definition: application.h:489
std::vector< button::Button * > buttons_
Definition: application.h:483
const std::vector< button::Button * > & get_buttons()
Definition: application.h:267
std::vector< climate::Climate * > climates_
Definition: application.h:501
std::vector< text_sensor::TextSensor * > text_sensors_
Definition: application.h:492
const std::vector< switch_::Switch * > & get_switches()
Definition: application.h:257
Base-class for all numbers.
Definition: number.h:39
std::vector< text::Text * > texts_
Definition: application.h:522
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition: helpers.cpp:706
void register_text(text::Text *text)
Definition: application.h:155
void register_select(select::Select *select)
Definition: application.h:159
const std::vector< text_sensor::TextSensor * > & get_text_sensors()
Definition: application.h:287
void calculate_looping_components_()
const std::vector< sensor::Sensor * > & get_sensors()
Definition: application.h:277
Application App
Global storage of Application pointer - only one Application can exist.
const std::vector< binary_sensor::BinarySensor * > & get_binary_sensors()
Definition: application.h:247
std::vector< datetime::TimeEntity * > times_
Definition: application.h:513
uint32_t get_loop_interval() const
Definition: application.h:232
std::vector< Component * > components_
Definition: application.h:473
void register_binary_sensor(binary_sensor::BinarySensor *binary_sensor)
Definition: application.h:101
light::LightState * get_light_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:318
const std::string & get_name() const
Get the name of this Application set by pre_setup().
Definition: application.h:202
void register_datetime(datetime::DateTimeEntity *datetime)
Definition: application.h:151
const std::vector< text::Text * > & get_texts()
Definition: application.h:377
switch_::Switch * get_switch_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:258
bool is_name_add_mac_suffix_enabled() const
Definition: application.h:213
std::vector< Component * > looping_components_
Definition: application.h:474
esphome::binary_sensor::BinarySensor * binary_sensor
Definition: statsd.h:41
std::vector< fan::Fan * > fans_
Definition: application.h:495
const std::vector< cover::Cover * > & get_covers()
Definition: application.h:307
void register_switch(switch_::Switch *a_switch)
Definition: application.h:111
std::vector< select::Select * > selects_
Definition: application.h:519
datetime::DateEntity * get_date_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:348
const std::vector< light::LightState * > & get_lights()
Definition: application.h:317
std::string get_comment() const
Get the comment of this Application set by pre_setup().
Definition: application.h:211
const char * compilation_time_
Definition: application.h:544
text::Text * get_text_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:378
number::Number * get_number_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:338
void register_component_(Component *comp)
Definition: application.cpp:14
void set_loop_interval(uint32_t loop_interval)
Set the target interval with which to run the loop() calls.
Definition: application.h:230
sensor::Sensor * get_sensor_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:278
event::Event * get_event_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:442
uint32_t get_app_state() const
Definition: application.h:244
const std::vector< media_player::MediaPlayer * > & get_media_players()
Definition: application.h:417
std::vector< event::Event * > events_
Definition: application.h:486
Base-class for all selects.
Definition: select.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all valve devices.
Definition: valve.h:105
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
void arch_init()
Definition: core.cpp:37
valve::Valve * get_valve_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:408
const char * comment_
Definition: application.h:543
void register_update(update::UpdateEntity *update)
Definition: application.h:185
const std::vector< datetime::DateEntity * > & get_dates()
Definition: application.h:347
update::UpdateEntity * get_update_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:453
const std::vector< select::Select * > & get_selects()
Definition: application.h:387
Base-class for all sensors.
Definition: sensor.h:57
datetime::TimeEntity * get_time_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:358
std::vector< switch_::Switch * > switches_
Definition: application.h:480
const std::vector< number::Number * > & get_numbers()
Definition: application.h:337
std::string get_compilation_time() const
Definition: application.h:215
esphome::sensor::Sensor * sensor
Definition: statsd.h:38
Base class for all locks.
Definition: lock.h:103
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168
bool state
Definition: fan.h:34
void register_lock(lock::Lock *a_lock)
Definition: application.h:163