ESPHome
2024.10.2
esphome
esphome
core
component_iterator.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/core/controller.h
"
5
#include "
esphome/core/helpers.h
"
6
7
#ifdef USE_ESP32_CAMERA
8
#include "
esphome/components/esp32_camera/esp32_camera.h
"
9
#endif
10
11
namespace
esphome
{
12
13
#ifdef USE_API
14
namespace
api {
15
class
UserServiceDescriptor;
16
}
// namespace api
17
#endif
18
19
class
ComponentIterator
{
20
public
:
21
void
begin(
bool
include_internal =
false
);
22
void
advance();
23
virtual
bool
on_begin();
24
#ifdef USE_BINARY_SENSOR
25
virtual
bool
on_binary_sensor(
binary_sensor::BinarySensor
*
binary_sensor
) = 0;
26
#endif
27
#ifdef USE_COVER
28
virtual
bool
on_cover(
cover::Cover
*cover) = 0;
29
#endif
30
#ifdef USE_FAN
31
virtual
bool
on_fan(
fan::Fan
*fan) = 0;
32
#endif
33
#ifdef USE_LIGHT
34
virtual
bool
on_light(
light::LightState
*light) = 0;
35
#endif
36
#ifdef USE_SENSOR
37
virtual
bool
on_sensor(
sensor::Sensor
*
sensor
) = 0;
38
#endif
39
#ifdef USE_SWITCH
40
virtual
bool
on_switch(
switch_::Switch
*a_switch) = 0;
41
#endif
42
#ifdef USE_BUTTON
43
virtual
bool
on_button(
button::Button
*button) = 0;
44
#endif
45
#ifdef USE_TEXT_SENSOR
46
virtual
bool
on_text_sensor(
text_sensor::TextSensor
*text_sensor) = 0;
47
#endif
48
#ifdef USE_API
49
virtual
bool
on_service(
api::UserServiceDescriptor
*service);
50
#endif
51
#ifdef USE_ESP32_CAMERA
52
virtual
bool
on_camera(
esp32_camera::ESP32Camera
*camera);
53
#endif
54
#ifdef USE_CLIMATE
55
virtual
bool
on_climate(
climate::Climate
*climate) = 0;
56
#endif
57
#ifdef USE_NUMBER
58
virtual
bool
on_number(
number::Number
*number) = 0;
59
#endif
60
#ifdef USE_DATETIME_DATE
61
virtual
bool
on_date(
datetime::DateEntity
*date) = 0;
62
#endif
63
#ifdef USE_DATETIME_TIME
64
virtual
bool
on_time(
datetime::TimeEntity
*time) = 0;
65
#endif
66
#ifdef USE_DATETIME_DATETIME
67
virtual
bool
on_datetime(
datetime::DateTimeEntity
*datetime) = 0;
68
#endif
69
#ifdef USE_TEXT
70
virtual
bool
on_text(
text::Text
*text) = 0;
71
#endif
72
#ifdef USE_SELECT
73
virtual
bool
on_select(
select::Select
*select) = 0;
74
#endif
75
#ifdef USE_LOCK
76
virtual
bool
on_lock(
lock::Lock
*a_lock) = 0;
77
#endif
78
#ifdef USE_VALVE
79
virtual
bool
on_valve(
valve::Valve
*valve) = 0;
80
#endif
81
#ifdef USE_MEDIA_PLAYER
82
virtual
bool
on_media_player(
media_player::MediaPlayer
*media_player);
83
#endif
84
#ifdef USE_ALARM_CONTROL_PANEL
85
virtual
bool
on_alarm_control_panel(
alarm_control_panel::AlarmControlPanel
*a_alarm_control_panel) = 0;
86
#endif
87
#ifdef USE_EVENT
88
virtual
bool
on_event(
event::Event
*event) = 0;
89
#endif
90
#ifdef USE_UPDATE
91
virtual
bool
on_update(
update::UpdateEntity
*update) = 0;
92
#endif
93
virtual
bool
on_end();
94
95
protected
:
96
enum class
IteratorState
{
97
NONE = 0,
98
BEGIN,
99
#ifdef USE_BINARY_SENSOR
100
BINARY_SENSOR
,
101
#endif
102
#ifdef USE_COVER
103
COVER,
104
#endif
105
#ifdef USE_FAN
106
FAN,
107
#endif
108
#ifdef USE_LIGHT
109
LIGHT,
110
#endif
111
#ifdef USE_SENSOR
112
SENSOR
,
113
#endif
114
#ifdef USE_SWITCH
115
SWITCH
,
116
#endif
117
#ifdef USE_BUTTON
118
BUTTON,
119
#endif
120
#ifdef USE_TEXT_SENSOR
121
TEXT_SENSOR
,
122
#endif
123
#ifdef USE_API
124
SERVICE,
125
#endif
126
#ifdef USE_ESP32_CAMERA
127
CAMERA,
128
#endif
129
#ifdef USE_CLIMATE
130
CLIMATE,
131
#endif
132
#ifdef USE_NUMBER
133
NUMBER,
134
#endif
135
#ifdef USE_DATETIME_DATE
136
DATETIME_DATE,
137
#endif
138
#ifdef USE_DATETIME_TIME
139
DATETIME_TIME,
140
#endif
141
#ifdef USE_DATETIME_DATETIME
142
DATETIME_DATETIME,
143
#endif
144
#ifdef USE_TEXT
145
TEXT,
146
#endif
147
#ifdef USE_SELECT
148
SELECT,
149
#endif
150
#ifdef USE_LOCK
151
LOCK,
152
#endif
153
#ifdef USE_VALVE
154
VALVE,
155
#endif
156
#ifdef USE_MEDIA_PLAYER
157
MEDIA_PLAYER,
158
#endif
159
#ifdef USE_ALARM_CONTROL_PANEL
160
ALARM_CONTROL_PANEL,
161
#endif
162
#ifdef USE_EVENT
163
EVENT,
164
#endif
165
#ifdef USE_UPDATE
166
UPDATE,
167
#endif
168
MAX,
169
} state_{
IteratorState::NONE
};
170
size_t
at_{0};
171
bool
include_internal_{
false
};
172
};
173
174
}
// namespace esphome
esphome::switch_::Switch
Base class for all switches.
Definition:
switch.h:39
esphome::light::LightState
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition:
light_state.h:34
esphome::alarm_control_panel::AlarmControlPanel
Definition:
alarm_control_panel.h:25
esphome::cover::Cover
Base class for all cover devices.
Definition:
cover.h:111
esphome::ComponentIterator::IteratorState
IteratorState
Definition:
component_iterator.h:96
esp32_camera.h
esphome::datetime::DateTimeEntity
Definition:
datetime_entity.h:39
esphome::ComponentIterator
Definition:
component_iterator.h:19
esphome::button::Button
Base class for all buttons.
Definition:
button.h:29
esphome::nextion::TEXT_SENSOR
Definition:
nextion_component_base.h:14
esphome::esp32_camera::ESP32Camera
Definition:
esp32_camera.h:109
esphome::datetime::TimeEntity
Definition:
time_entity.h:37
esphome::text::Text
Base-class for all text inputs.
Definition:
text.h:24
esphome::nextion::SWITCH
Definition:
nextion_component_base.h:13
esphome::update::UpdateEntity
Definition:
update_entity.h:29
esphome::nextion::SENSOR
Definition:
nextion_component_base.h:11
esphome::anova::NONE
Definition:
anova_base.h:10
esphome::text_sensor::TextSensor
Definition:
text_sensor.h:34
esphome::number::Number
Base-class for all numbers.
Definition:
number.h:39
esphome::media_player::MediaPlayer
Definition:
media_player.h:89
esphome::fan::Fan
Definition:
fan.h:107
controller.h
esphome::statsd::binary_sensor
esphome::binary_sensor::BinarySensor * binary_sensor
Definition:
statsd.h:40
esphome::event::Event
Definition:
event.h:24
esphome::datetime::DateEntity
Definition:
date_entity.h:36
esphome::nextion::BINARY_SENSOR
Definition:
nextion_component_base.h:12
esphome::select::Select
Base-class for all selects.
Definition:
select.h:31
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::valve::Valve
Base class for all valve devices.
Definition:
valve.h:105
component.h
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition:
binary_sensor.h:37
helpers.h
esphome::sensor::Sensor
Base-class for all sensors.
Definition:
sensor.h:57
esphome::api::UserServiceDescriptor
Definition:
user_services.h:13
esphome::statsd::sensor
esphome::sensor::Sensor * sensor
Definition:
statsd.h:37
esphome::lock::Lock
Base class for all locks.
Definition:
lock.h:103
esphome::climate::Climate
ClimateDevice - This is the base class for all climate integrations.
Definition:
climate.h:168
Generated by
1.8.13