ESPHome  2024.7.1
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
119  void register_text_sensor(text_sensor::TextSensor *sensor) { this->text_sensors_.push_back(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  return nullptr;
253  }
254 #endif
255 #ifdef USE_SWITCH
256  const std::vector<switch_::Switch *> &get_switches() { return this->switches_; }
257  switch_::Switch *get_switch_by_key(uint32_t key, bool include_internal = false) {
258  for (auto *obj : this->switches_)
259  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
260  return obj;
261  return nullptr;
262  }
263 #endif
264 #ifdef USE_BUTTON
265  const std::vector<button::Button *> &get_buttons() { return this->buttons_; }
266  button::Button *get_button_by_key(uint32_t key, bool include_internal = false) {
267  for (auto *obj : this->buttons_)
268  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
269  return obj;
270  return nullptr;
271  }
272 #endif
273 #ifdef USE_SENSOR
274  const std::vector<sensor::Sensor *> &get_sensors() { return this->sensors_; }
275  sensor::Sensor *get_sensor_by_key(uint32_t key, bool include_internal = false) {
276  for (auto *obj : this->sensors_)
277  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
278  return obj;
279  return nullptr;
280  }
281 #endif
282 #ifdef USE_TEXT_SENSOR
283  const std::vector<text_sensor::TextSensor *> &get_text_sensors() { return this->text_sensors_; }
284  text_sensor::TextSensor *get_text_sensor_by_key(uint32_t key, bool include_internal = false) {
285  for (auto *obj : this->text_sensors_)
286  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
287  return obj;
288  return nullptr;
289  }
290 #endif
291 #ifdef USE_FAN
292  const std::vector<fan::Fan *> &get_fans() { return this->fans_; }
293  fan::Fan *get_fan_by_key(uint32_t key, bool include_internal = false) {
294  for (auto *obj : this->fans_)
295  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
296  return obj;
297  return nullptr;
298  }
299 #endif
300 #ifdef USE_COVER
301  const std::vector<cover::Cover *> &get_covers() { return this->covers_; }
302  cover::Cover *get_cover_by_key(uint32_t key, bool include_internal = false) {
303  for (auto *obj : this->covers_)
304  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
305  return obj;
306  return nullptr;
307  }
308 #endif
309 #ifdef USE_LIGHT
310  const std::vector<light::LightState *> &get_lights() { return this->lights_; }
311  light::LightState *get_light_by_key(uint32_t key, bool include_internal = false) {
312  for (auto *obj : this->lights_)
313  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
314  return obj;
315  return nullptr;
316  }
317 #endif
318 #ifdef USE_CLIMATE
319  const std::vector<climate::Climate *> &get_climates() { return this->climates_; }
320  climate::Climate *get_climate_by_key(uint32_t key, bool include_internal = false) {
321  for (auto *obj : this->climates_)
322  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
323  return obj;
324  return nullptr;
325  }
326 #endif
327 #ifdef USE_NUMBER
328  const std::vector<number::Number *> &get_numbers() { return this->numbers_; }
329  number::Number *get_number_by_key(uint32_t key, bool include_internal = false) {
330  for (auto *obj : this->numbers_)
331  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
332  return obj;
333  return nullptr;
334  }
335 #endif
336 #ifdef USE_DATETIME_DATE
337  const std::vector<datetime::DateEntity *> &get_dates() { return this->dates_; }
338  datetime::DateEntity *get_date_by_key(uint32_t key, bool include_internal = false) {
339  for (auto *obj : this->dates_)
340  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
341  return obj;
342  return nullptr;
343  }
344 #endif
345 #ifdef USE_DATETIME_TIME
346  const std::vector<datetime::TimeEntity *> &get_times() { return this->times_; }
347  datetime::TimeEntity *get_time_by_key(uint32_t key, bool include_internal = false) {
348  for (auto *obj : this->times_)
349  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
350  return obj;
351  return nullptr;
352  }
353 #endif
354 #ifdef USE_DATETIME_DATETIME
355  const std::vector<datetime::DateTimeEntity *> &get_datetimes() { return this->datetimes_; }
356  datetime::DateTimeEntity *get_datetime_by_key(uint32_t key, bool include_internal = false) {
357  for (auto *obj : this->datetimes_)
358  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
359  return obj;
360  return nullptr;
361  }
362 #endif
363 #ifdef USE_TEXT
364  const std::vector<text::Text *> &get_texts() { return this->texts_; }
365  text::Text *get_text_by_key(uint32_t key, bool include_internal = false) {
366  for (auto *obj : this->texts_)
367  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
368  return obj;
369  return nullptr;
370  }
371 #endif
372 #ifdef USE_SELECT
373  const std::vector<select::Select *> &get_selects() { return this->selects_; }
374  select::Select *get_select_by_key(uint32_t key, bool include_internal = false) {
375  for (auto *obj : this->selects_)
376  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
377  return obj;
378  return nullptr;
379  }
380 #endif
381 #ifdef USE_LOCK
382  const std::vector<lock::Lock *> &get_locks() { return this->locks_; }
383  lock::Lock *get_lock_by_key(uint32_t key, bool include_internal = false) {
384  for (auto *obj : this->locks_)
385  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
386  return obj;
387  return nullptr;
388  }
389 #endif
390 #ifdef USE_VALVE
391  const std::vector<valve::Valve *> &get_valves() { return this->valves_; }
392  valve::Valve *get_valve_by_key(uint32_t key, bool include_internal = false) {
393  for (auto *obj : this->valves_)
394  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
395  return obj;
396  return nullptr;
397  }
398 #endif
399 #ifdef USE_MEDIA_PLAYER
400  const std::vector<media_player::MediaPlayer *> &get_media_players() { return this->media_players_; }
401  media_player::MediaPlayer *get_media_player_by_key(uint32_t key, bool include_internal = false) {
402  for (auto *obj : this->media_players_)
403  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
404  return obj;
405  return nullptr;
406  }
407 #endif
408 
409 #ifdef USE_ALARM_CONTROL_PANEL
410  const std::vector<alarm_control_panel::AlarmControlPanel *> &get_alarm_control_panels() {
411  return this->alarm_control_panels_;
412  }
413  alarm_control_panel::AlarmControlPanel *get_alarm_control_panel_by_key(uint32_t key, bool include_internal = false) {
414  for (auto *obj : this->alarm_control_panels_)
415  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
416  return obj;
417  return nullptr;
418  }
419 #endif
420 
421 #ifdef USE_EVENT
422  const std::vector<event::Event *> &get_events() { return this->events_; }
423  event::Event *get_event_by_key(uint32_t key, bool include_internal = false) {
424  for (auto *obj : this->events_)
425  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
426  return obj;
427  return nullptr;
428  }
429 #endif
430 
431 #ifdef USE_UPDATE
432  const std::vector<update::UpdateEntity *> &get_updates() { return this->updates_; }
433  update::UpdateEntity *get_update_by_key(uint32_t key, bool include_internal = false) {
434  for (auto *obj : this->updates_)
435  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
436  return obj;
437  return nullptr;
438  }
439 #endif
440 
442 
443  protected:
444  friend Component;
445 
446  void register_component_(Component *comp);
447 
449 
450  void feed_wdt_arch_();
451 
452  std::vector<Component *> components_{};
453  std::vector<Component *> looping_components_{};
454 
455 #ifdef USE_BINARY_SENSOR
456  std::vector<binary_sensor::BinarySensor *> binary_sensors_{};
457 #endif
458 #ifdef USE_SWITCH
459  std::vector<switch_::Switch *> switches_{};
460 #endif
461 #ifdef USE_BUTTON
462  std::vector<button::Button *> buttons_{};
463 #endif
464 #ifdef USE_EVENT
465  std::vector<event::Event *> events_{};
466 #endif
467 #ifdef USE_SENSOR
468  std::vector<sensor::Sensor *> sensors_{};
469 #endif
470 #ifdef USE_TEXT_SENSOR
471  std::vector<text_sensor::TextSensor *> text_sensors_{};
472 #endif
473 #ifdef USE_FAN
474  std::vector<fan::Fan *> fans_{};
475 #endif
476 #ifdef USE_COVER
477  std::vector<cover::Cover *> covers_{};
478 #endif
479 #ifdef USE_CLIMATE
480  std::vector<climate::Climate *> climates_{};
481 #endif
482 #ifdef USE_LIGHT
483  std::vector<light::LightState *> lights_{};
484 #endif
485 #ifdef USE_NUMBER
486  std::vector<number::Number *> numbers_{};
487 #endif
488 #ifdef USE_DATETIME_DATE
489  std::vector<datetime::DateEntity *> dates_{};
490 #endif
491 #ifdef USE_DATETIME_TIME
492  std::vector<datetime::TimeEntity *> times_{};
493 #endif
494 #ifdef USE_DATETIME_DATETIME
495  std::vector<datetime::DateTimeEntity *> datetimes_{};
496 #endif
497 #ifdef USE_SELECT
498  std::vector<select::Select *> selects_{};
499 #endif
500 #ifdef USE_TEXT
501  std::vector<text::Text *> texts_{};
502 #endif
503 #ifdef USE_LOCK
504  std::vector<lock::Lock *> locks_{};
505 #endif
506 #ifdef USE_VALVE
507  std::vector<valve::Valve *> valves_{};
508 #endif
509 #ifdef USE_MEDIA_PLAYER
510  std::vector<media_player::MediaPlayer *> media_players_{};
511 #endif
512 #ifdef USE_ALARM_CONTROL_PANEL
513  std::vector<alarm_control_panel::AlarmControlPanel *> alarm_control_panels_{};
514 #endif
515 #ifdef USE_UPDATE
516  std::vector<update::UpdateEntity *> updates_{};
517 #endif
518 
519  std::string name_;
520  std::string friendly_name_;
521  std::string area_;
522  const char *comment_{nullptr};
523  const char *compilation_time_{nullptr};
525  uint32_t last_loop_{0};
526  uint32_t loop_interval_{16};
527  size_t dump_config_at_{SIZE_MAX};
528  uint32_t app_state_{0};
529 };
530 
532 extern Application App; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
533 
534 } // namespace esphome
Base class for all switches.
Definition: switch.h:39
std::vector< light::LightState * > lights_
Definition: application.h:483
void register_fan(fan::Fan *state)
Definition: application.h:123
std::vector< datetime::DateTimeEntity * > datetimes_
Definition: application.h:495
const std::vector< datetime::DateTimeEntity * > & get_datetimes()
Definition: application.h:355
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:34
media_player::MediaPlayer * get_media_player_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:401
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:284
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:319
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:320
void register_media_player(media_player::MediaPlayer *media_player)
Definition: application.h:171
const std::vector< update::UpdateEntity * > & get_updates()
Definition: application.h:432
const std::vector< alarm_control_panel::AlarmControlPanel * > & get_alarm_control_panels()
Definition: application.h:410
void register_valve(valve::Valve *valve)
Definition: application.h:167
std::vector< binary_sensor::BinarySensor * > binary_sensors_
Definition: application.h:456
select::Select * get_select_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:374
std::vector< update::UpdateEntity * > updates_
Definition: application.h:516
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:356
const std::vector< valve::Valve * > & get_valves()
Definition: application.h:391
std::vector< alarm_control_panel::AlarmControlPanel * > alarm_control_panels_
Definition: application.h:513
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:507
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:383
std::vector< datetime::DateEntity * > dates_
Definition: application.h:489
std::vector< number::Number * > numbers_
Definition: application.h:486
const std::vector< event::Event * > & get_events()
Definition: application.h:422
button::Button * get_button_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:266
std::vector< lock::Lock * > locks_
Definition: application.h:504
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:292
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:346
alarm_control_panel::AlarmControlPanel * get_alarm_control_panel_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:413
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:477
cover::Cover * get_cover_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:302
const std::vector< lock::Lock * > & get_locks()
Definition: application.h:382
std::string friendly_name_
Definition: application.h:520
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:510
fan::Fan * get_fan_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:293
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:468
std::vector< button::Button * > buttons_
Definition: application.h:462
const std::vector< button::Button * > & get_buttons()
Definition: application.h:265
std::vector< climate::Climate * > climates_
Definition: application.h:480
std::vector< text_sensor::TextSensor * > text_sensors_
Definition: application.h:471
const std::vector< switch_::Switch * > & get_switches()
Definition: application.h:256
Base-class for all numbers.
Definition: number.h:39
std::vector< text::Text * > texts_
Definition: application.h:501
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition: helpers.cpp:688
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:283
void calculate_looping_components_()
const std::vector< sensor::Sensor * > & get_sensors()
Definition: application.h:274
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:492
uint32_t get_loop_interval() const
Definition: application.h:232
std::vector< Component * > components_
Definition: application.h:452
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:311
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:364
switch_::Switch * get_switch_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:257
bool is_name_add_mac_suffix_enabled() const
Definition: application.h:213
std::vector< Component * > looping_components_
Definition: application.h:453
std::vector< fan::Fan * > fans_
Definition: application.h:474
const std::vector< cover::Cover * > & get_covers()
Definition: application.h:301
void register_switch(switch_::Switch *a_switch)
Definition: application.h:111
std::vector< select::Select * > selects_
Definition: application.h:498
datetime::DateEntity * get_date_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:338
const std::vector< light::LightState * > & get_lights()
Definition: application.h:310
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:523
text::Text * get_text_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:365
number::Number * get_number_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:329
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:275
event::Event * get_event_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:423
uint32_t get_app_state() const
Definition: application.h:244
const std::vector< media_player::MediaPlayer * > & get_media_players()
Definition: application.h:400
std::vector< event::Event * > events_
Definition: application.h:465
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:392
const char * comment_
Definition: application.h:522
void register_update(update::UpdateEntity *update)
Definition: application.h:185
const std::vector< datetime::DateEntity * > & get_dates()
Definition: application.h:337
update::UpdateEntity * get_update_by_key(uint32_t key, bool include_internal=false)
Definition: application.h:433
const std::vector< select::Select * > & get_selects()
Definition: application.h:373
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:347
std::vector< switch_::Switch * > switches_
Definition: application.h:459
const std::vector< number::Number * > & get_numbers()
Definition: application.h:328
std::string get_compilation_time() const
Definition: application.h:215
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