esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
entity_registry.hpp
Go to the documentation of this file.
1#pragma once
2
6
10
11#include <cstdint>
12#include <optional>
13#include <string>
14#include <string_view>
15#include <vector>
16
17namespace esphome::api {
18
20template <class E>
22public:
23 explicit EntityList(std::vector<E> items) : items_(std::move(items)) {}
24 [[nodiscard]] std::size_t size() const noexcept {
25 return items_.size();
26 }
27 [[nodiscard]] bool empty() const noexcept {
28 return items_.empty();
29 }
30 [[nodiscard]] const E& operator[](std::size_t i) const {
31 return items_[i];
32 }
33 [[nodiscard]] const E& at(std::size_t i) const {
34 return items_.at(i);
35 }
36 [[nodiscard]] auto begin() const {
37 return items_.begin();
38 }
39 [[nodiscard]] auto end() const {
40 return items_.end();
41 }
42 [[nodiscard]] std::optional<E> find(std::uint32_t key) const {
43 for (const E& e : items_)
44 if (e.key() == key)
45 return e;
46 return std::nullopt;
47 }
48 [[nodiscard]] std::optional<E> find(std::string_view object_id) const {
49 for (const E& e : items_)
50 if (e.object_id() == object_id)
51 return e;
52 return std::nullopt;
53 }
54
55private:
56 std::vector<E> items_;
57};
58
61public:
62 explicit EntityRegistry(Client& client) : client_(&client) {}
63
65 [[nodiscard]] std::size_t size() const {
66 return client_->store().size();
67 }
68
70 return collect<BinarySensorEntity>(EntityType::BinarySensor);
71 }
72 [[nodiscard]] std::optional<BinarySensorEntity> binary_sensor(const std::uint32_t key) const {
73 return one<BinarySensorEntity>(EntityType::BinarySensor, client_->store().find(key));
74 }
75 [[nodiscard]] std::optional<BinarySensorEntity>
76 binary_sensor(const std::string_view object_id) const {
77 return one<BinarySensorEntity>(EntityType::BinarySensor,
78 client_->store().find_by_object_id(std::string(object_id)));
79 }
80 [[nodiscard]] EntityList<SensorEntity> sensors() const {
81 return collect<SensorEntity>(EntityType::Sensor);
82 }
83 [[nodiscard]] std::optional<SensorEntity> sensor(const std::uint32_t key) const {
84 return one<SensorEntity>(EntityType::Sensor, client_->store().find(key));
85 }
86 [[nodiscard]] std::optional<SensorEntity> sensor(const std::string_view object_id) const {
87 return one<SensorEntity>(EntityType::Sensor,
88 client_->store().find_by_object_id(std::string(object_id)));
89 }
91 return collect<TextSensorEntity>(EntityType::TextSensor);
92 }
93 [[nodiscard]] std::optional<TextSensorEntity> text_sensor(const std::uint32_t key) const {
94 return one<TextSensorEntity>(EntityType::TextSensor, client_->store().find(key));
95 }
96 [[nodiscard]] std::optional<TextSensorEntity>
97 text_sensor(const std::string_view object_id) const {
98 return one<TextSensorEntity>(EntityType::TextSensor,
99 client_->store().find_by_object_id(std::string(object_id)));
100 }
101 [[nodiscard]] EntityList<SwitchEntity> switches() const {
102 return collect<SwitchEntity>(EntityType::Switch);
103 }
104 // `switch` is a keyword, so the singular accessor is spelled `switch_`.
105 // NOLINTNEXTLINE(readability-identifier-naming)
106 [[nodiscard]] std::optional<SwitchEntity> switch_(const std::uint32_t key) const {
107 return one<SwitchEntity>(EntityType::Switch, client_->store().find(key));
108 }
109 // NOLINTNEXTLINE(readability-identifier-naming)
110 [[nodiscard]] std::optional<SwitchEntity> switch_(const std::string_view object_id) const {
111 return one<SwitchEntity>(EntityType::Switch,
112 client_->store().find_by_object_id(std::string(object_id)));
113 }
114 [[nodiscard]] EntityList<LightEntity> lights() const {
115 return collect<LightEntity>(EntityType::Light);
116 }
117 [[nodiscard]] std::optional<LightEntity> light(const std::uint32_t key) const {
118 return one<LightEntity>(EntityType::Light, client_->store().find(key));
119 }
120 [[nodiscard]] std::optional<LightEntity> light(const std::string_view object_id) const {
121 return one<LightEntity>(EntityType::Light,
122 client_->store().find_by_object_id(std::string(object_id)));
123 }
124 [[nodiscard]] EntityList<CoverEntity> covers() const {
125 return collect<CoverEntity>(EntityType::Cover);
126 }
127 [[nodiscard]] std::optional<CoverEntity> cover(const std::uint32_t key) const {
128 return one<CoverEntity>(EntityType::Cover, client_->store().find(key));
129 }
130 [[nodiscard]] std::optional<CoverEntity> cover(const std::string_view object_id) const {
131 return one<CoverEntity>(EntityType::Cover,
132 client_->store().find_by_object_id(std::string(object_id)));
133 }
134 [[nodiscard]] EntityList<FanEntity> fans() const {
135 return collect<FanEntity>(EntityType::Fan);
136 }
137 [[nodiscard]] std::optional<FanEntity> fan(const std::uint32_t key) const {
138 return one<FanEntity>(EntityType::Fan, client_->store().find(key));
139 }
140 [[nodiscard]] std::optional<FanEntity> fan(const std::string_view object_id) const {
141 return one<FanEntity>(EntityType::Fan,
142 client_->store().find_by_object_id(std::string(object_id)));
143 }
144 [[nodiscard]] EntityList<ClimateEntity> climates() const {
145 return collect<ClimateEntity>(EntityType::Climate);
146 }
147 [[nodiscard]] std::optional<ClimateEntity> climate(const std::uint32_t key) const {
148 return one<ClimateEntity>(EntityType::Climate, client_->store().find(key));
149 }
150 [[nodiscard]] std::optional<ClimateEntity> climate(const std::string_view object_id) const {
151 return one<ClimateEntity>(EntityType::Climate,
152 client_->store().find_by_object_id(std::string(object_id)));
153 }
154 [[nodiscard]] EntityList<NumberEntity> numbers() const {
155 return collect<NumberEntity>(EntityType::Number);
156 }
157 [[nodiscard]] std::optional<NumberEntity> number(const std::uint32_t key) const {
158 return one<NumberEntity>(EntityType::Number, client_->store().find(key));
159 }
160 [[nodiscard]] std::optional<NumberEntity> number(const std::string_view object_id) const {
161 return one<NumberEntity>(EntityType::Number,
162 client_->store().find_by_object_id(std::string(object_id)));
163 }
164 [[nodiscard]] EntityList<SelectEntity> selects() const {
165 return collect<SelectEntity>(EntityType::Select);
166 }
167 [[nodiscard]] std::optional<SelectEntity> select(const std::uint32_t key) const {
168 return one<SelectEntity>(EntityType::Select, client_->store().find(key));
169 }
170 [[nodiscard]] std::optional<SelectEntity> select(const std::string_view object_id) const {
171 return one<SelectEntity>(EntityType::Select,
172 client_->store().find_by_object_id(std::string(object_id)));
173 }
174 [[nodiscard]] EntityList<TextEntity> texts() const {
175 return collect<TextEntity>(EntityType::Text);
176 }
177 [[nodiscard]] std::optional<TextEntity> text(const std::uint32_t key) const {
178 return one<TextEntity>(EntityType::Text, client_->store().find(key));
179 }
180 [[nodiscard]] std::optional<TextEntity> text(const std::string_view object_id) const {
181 return one<TextEntity>(EntityType::Text,
182 client_->store().find_by_object_id(std::string(object_id)));
183 }
184 [[nodiscard]] EntityList<ButtonEntity> buttons() const {
185 return collect<ButtonEntity>(EntityType::Button);
186 }
187 [[nodiscard]] std::optional<ButtonEntity> button(const std::uint32_t key) const {
188 return one<ButtonEntity>(EntityType::Button, client_->store().find(key));
189 }
190 [[nodiscard]] std::optional<ButtonEntity> button(const std::string_view object_id) const {
191 return one<ButtonEntity>(EntityType::Button,
192 client_->store().find_by_object_id(std::string(object_id)));
193 }
194 [[nodiscard]] EntityList<LockEntity> locks() const {
195 return collect<LockEntity>(EntityType::Lock);
196 }
197 [[nodiscard]] std::optional<LockEntity> lock(const std::uint32_t key) const {
198 return one<LockEntity>(EntityType::Lock, client_->store().find(key));
199 }
200 [[nodiscard]] std::optional<LockEntity> lock(const std::string_view object_id) const {
201 return one<LockEntity>(EntityType::Lock,
202 client_->store().find_by_object_id(std::string(object_id)));
203 }
205 return collect<MediaPlayerEntity>(EntityType::MediaPlayer);
206 }
207 [[nodiscard]] std::optional<MediaPlayerEntity> media_player(const std::uint32_t key) const {
208 return one<MediaPlayerEntity>(EntityType::MediaPlayer, client_->store().find(key));
209 }
210 [[nodiscard]] std::optional<MediaPlayerEntity>
211 media_player(const std::string_view object_id) const {
212 return one<MediaPlayerEntity>(EntityType::MediaPlayer,
213 client_->store().find_by_object_id(std::string(object_id)));
214 }
215 [[nodiscard]] EntityList<CameraEntity> cameras() const {
216 return collect<CameraEntity>(EntityType::Camera);
217 }
218 [[nodiscard]] std::optional<CameraEntity> camera(const std::uint32_t key) const {
219 return one<CameraEntity>(EntityType::Camera, client_->store().find(key));
220 }
221 [[nodiscard]] std::optional<CameraEntity> camera(const std::string_view object_id) const {
222 return one<CameraEntity>(EntityType::Camera,
223 client_->store().find_by_object_id(std::string(object_id)));
224 }
225 [[nodiscard]] EntityList<SirenEntity> sirens() const {
226 return collect<SirenEntity>(EntityType::Siren);
227 }
228 [[nodiscard]] std::optional<SirenEntity> siren(const std::uint32_t key) const {
229 return one<SirenEntity>(EntityType::Siren, client_->store().find(key));
230 }
231 [[nodiscard]] std::optional<SirenEntity> siren(const std::string_view object_id) const {
232 return one<SirenEntity>(EntityType::Siren,
233 client_->store().find_by_object_id(std::string(object_id)));
234 }
236 return collect<AlarmControlPanelEntity>(EntityType::AlarmControlPanel);
237 }
238 [[nodiscard]] std::optional<AlarmControlPanelEntity>
239 alarm_control_panel(const std::uint32_t key) const {
240 return one<AlarmControlPanelEntity>(EntityType::AlarmControlPanel,
241 client_->store().find(key));
242 }
243 [[nodiscard]] std::optional<AlarmControlPanelEntity>
244 alarm_control_panel(const std::string_view object_id) const {
245 return one<AlarmControlPanelEntity>(
247 client_->store().find_by_object_id(std::string(object_id)));
248 }
249 [[nodiscard]] EntityList<DateEntity> dates() const {
250 return collect<DateEntity>(EntityType::Date);
251 }
252 [[nodiscard]] std::optional<DateEntity> date(const std::uint32_t key) const {
253 return one<DateEntity>(EntityType::Date, client_->store().find(key));
254 }
255 [[nodiscard]] std::optional<DateEntity> date(const std::string_view object_id) const {
256 return one<DateEntity>(EntityType::Date,
257 client_->store().find_by_object_id(std::string(object_id)));
258 }
259 [[nodiscard]] EntityList<TimeEntity> times() const {
260 return collect<TimeEntity>(EntityType::Time);
261 }
262 [[nodiscard]] std::optional<TimeEntity> time(const std::uint32_t key) const {
263 return one<TimeEntity>(EntityType::Time, client_->store().find(key));
264 }
265 [[nodiscard]] std::optional<TimeEntity> time(const std::string_view object_id) const {
266 return one<TimeEntity>(EntityType::Time,
267 client_->store().find_by_object_id(std::string(object_id)));
268 }
269 [[nodiscard]] EntityList<DateTimeEntity> datetimes() const {
270 return collect<DateTimeEntity>(EntityType::DateTime);
271 }
272 [[nodiscard]] std::optional<DateTimeEntity> datetime(const std::uint32_t key) const {
273 return one<DateTimeEntity>(EntityType::DateTime, client_->store().find(key));
274 }
275 [[nodiscard]] std::optional<DateTimeEntity> datetime(const std::string_view object_id) const {
276 return one<DateTimeEntity>(EntityType::DateTime,
277 client_->store().find_by_object_id(std::string(object_id)));
278 }
279 [[nodiscard]] EntityList<ValveEntity> valves() const {
280 return collect<ValveEntity>(EntityType::Valve);
281 }
282 [[nodiscard]] std::optional<ValveEntity> valve(const std::uint32_t key) const {
283 return one<ValveEntity>(EntityType::Valve, client_->store().find(key));
284 }
285 [[nodiscard]] std::optional<ValveEntity> valve(const std::string_view object_id) const {
286 return one<ValveEntity>(EntityType::Valve,
287 client_->store().find_by_object_id(std::string(object_id)));
288 }
289 [[nodiscard]] EntityList<EventEntity> events() const {
290 return collect<EventEntity>(EntityType::Event);
291 }
292 [[nodiscard]] std::optional<EventEntity> event(const std::uint32_t key) const {
293 return one<EventEntity>(EntityType::Event, client_->store().find(key));
294 }
295 [[nodiscard]] std::optional<EventEntity> event(const std::string_view object_id) const {
296 return one<EventEntity>(EntityType::Event,
297 client_->store().find_by_object_id(std::string(object_id)));
298 }
299 [[nodiscard]] EntityList<UpdateEntity> updates() const {
300 return collect<UpdateEntity>(EntityType::Update);
301 }
302 [[nodiscard]] std::optional<UpdateEntity> update(const std::uint32_t key) const {
303 return one<UpdateEntity>(EntityType::Update, client_->store().find(key));
304 }
305 [[nodiscard]] std::optional<UpdateEntity> update(const std::string_view object_id) const {
306 return one<UpdateEntity>(EntityType::Update,
307 client_->store().find_by_object_id(std::string(object_id)));
308 }
310 return collect<WaterHeaterEntity>(EntityType::WaterHeater);
311 }
312 [[nodiscard]] std::optional<WaterHeaterEntity> water_heater(const std::uint32_t key) const {
313 return one<WaterHeaterEntity>(EntityType::WaterHeater, client_->store().find(key));
314 }
315 [[nodiscard]] std::optional<WaterHeaterEntity>
316 water_heater(const std::string_view object_id) const {
317 return one<WaterHeaterEntity>(EntityType::WaterHeater,
318 client_->store().find_by_object_id(std::string(object_id)));
319 }
320 [[nodiscard]] EntityList<InfraredEntity> infrareds() const {
321 return collect<InfraredEntity>(EntityType::Infrared);
322 }
323 [[nodiscard]] std::optional<InfraredEntity> infrared(const std::uint32_t key) const {
324 return one<InfraredEntity>(EntityType::Infrared, client_->store().find(key));
325 }
326 [[nodiscard]] std::optional<InfraredEntity> infrared(const std::string_view object_id) const {
327 return one<InfraredEntity>(EntityType::Infrared,
328 client_->store().find_by_object_id(std::string(object_id)));
329 }
331 return collect<RadioFrequencyEntity>(EntityType::RadioFrequency);
332 }
333 [[nodiscard]] std::optional<RadioFrequencyEntity>
334 radio_frequency(const std::uint32_t key) const {
335 return one<RadioFrequencyEntity>(EntityType::RadioFrequency, client_->store().find(key));
336 }
337 [[nodiscard]] std::optional<RadioFrequencyEntity>
338 radio_frequency(const std::string_view object_id) const {
339 return one<RadioFrequencyEntity>(
340 EntityType::RadioFrequency, client_->store().find_by_object_id(std::string(object_id)));
341 }
342
343private:
344 template <class E>
345 EntityList<E> collect(const EntityType type) const {
346 std::vector<E> out;
347 for (const StoredEntity* e : client_->store().entities())
348 if (e->type == type)
349 out.emplace_back(*client_, e->key, e->object_id, e->name);
350 return EntityList<E>(std::move(out));
351 }
352 template <class E>
353 std::optional<E> one(const EntityType type, const StoredEntity* e) const {
354 if (e == nullptr || e->type != type)
355 return std::nullopt;
356 return E(*client_, e->key, e->object_id, e->name);
357 }
358 Client* client_;
359};
360
361} // namespace esphome::api
Async client for a single device.
Definition client.hpp:38
EntityStore & store()
The store of discovered entities and their latest states (auto-populated from every inbound message).
A snapshot list of entity handles of one domain, with index + lookup access.
Definition entity_registry.hpp:21
std::optional< E > find(std::string_view object_id) const
Definition entity_registry.hpp:48
std::size_t size() const noexcept
Definition entity_registry.hpp:24
auto begin() const
Definition entity_registry.hpp:36
std::optional< E > find(std::uint32_t key) const
Definition entity_registry.hpp:42
EntityList(std::vector< E > items)
Definition entity_registry.hpp:23
bool empty() const noexcept
Definition entity_registry.hpp:27
auto end() const
Definition entity_registry.hpp:39
const E & operator[](std::size_t i) const
Definition entity_registry.hpp:30
const E & at(std::size_t i) const
Definition entity_registry.hpp:33
Object-oriented façade over the entity store.
Definition entity_registry.hpp:60
std::optional< SwitchEntity > switch_(const std::uint32_t key) const
Definition entity_registry.hpp:106
std::optional< WaterHeaterEntity > water_heater(const std::uint32_t key) const
Definition entity_registry.hpp:312
std::optional< ButtonEntity > button(const std::string_view object_id) const
Definition entity_registry.hpp:190
EntityList< MediaPlayerEntity > media_players() const
Definition entity_registry.hpp:204
EntityList< BinarySensorEntity > binary_sensors() const
Definition entity_registry.hpp:69
std::optional< LockEntity > lock(const std::string_view object_id) const
Definition entity_registry.hpp:200
EntityList< UpdateEntity > updates() const
Definition entity_registry.hpp:299
EntityList< EventEntity > events() const
Definition entity_registry.hpp:289
EntityList< SwitchEntity > switches() const
Definition entity_registry.hpp:101
EntityList< WaterHeaterEntity > water_heaters() const
Definition entity_registry.hpp:309
std::optional< TextEntity > text(const std::uint32_t key) const
Definition entity_registry.hpp:177
std::optional< InfraredEntity > infrared(const std::string_view object_id) const
Definition entity_registry.hpp:326
std::optional< CameraEntity > camera(const std::string_view object_id) const
Definition entity_registry.hpp:221
std::optional< BinarySensorEntity > binary_sensor(const std::string_view object_id) const
Definition entity_registry.hpp:76
std::optional< DateEntity > date(const std::uint32_t key) const
Definition entity_registry.hpp:252
std::optional< TextEntity > text(const std::string_view object_id) const
Definition entity_registry.hpp:180
std::optional< CoverEntity > cover(const std::uint32_t key) const
Definition entity_registry.hpp:127
EntityList< SirenEntity > sirens() const
Definition entity_registry.hpp:225
std::size_t size() const
Total number of discovered entities (all domains).
Definition entity_registry.hpp:65
std::optional< LightEntity > light(const std::string_view object_id) const
Definition entity_registry.hpp:120
std::optional< LightEntity > light(const std::uint32_t key) const
Definition entity_registry.hpp:117
std::optional< MediaPlayerEntity > media_player(const std::uint32_t key) const
Definition entity_registry.hpp:207
std::optional< SirenEntity > siren(const std::uint32_t key) const
Definition entity_registry.hpp:228
std::optional< FanEntity > fan(const std::string_view object_id) const
Definition entity_registry.hpp:140
EntityList< LockEntity > locks() const
Definition entity_registry.hpp:194
EntityList< ValveEntity > valves() const
Definition entity_registry.hpp:279
std::optional< SirenEntity > siren(const std::string_view object_id) const
Definition entity_registry.hpp:231
std::optional< BinarySensorEntity > binary_sensor(const std::uint32_t key) const
Definition entity_registry.hpp:72
std::optional< CoverEntity > cover(const std::string_view object_id) const
Definition entity_registry.hpp:130
std::optional< RadioFrequencyEntity > radio_frequency(const std::uint32_t key) const
Definition entity_registry.hpp:334
EntityList< TimeEntity > times() const
Definition entity_registry.hpp:259
EntityList< LightEntity > lights() const
Definition entity_registry.hpp:114
std::optional< ValveEntity > valve(const std::uint32_t key) const
Definition entity_registry.hpp:282
std::optional< DateTimeEntity > datetime(const std::string_view object_id) const
Definition entity_registry.hpp:275
std::optional< SelectEntity > select(const std::uint32_t key) const
Definition entity_registry.hpp:167
std::optional< TimeEntity > time(const std::string_view object_id) const
Definition entity_registry.hpp:265
std::optional< WaterHeaterEntity > water_heater(const std::string_view object_id) const
Definition entity_registry.hpp:316
std::optional< EventEntity > event(const std::uint32_t key) const
Definition entity_registry.hpp:292
EntityList< DateEntity > dates() const
Definition entity_registry.hpp:249
EntityList< FanEntity > fans() const
Definition entity_registry.hpp:134
std::optional< ClimateEntity > climate(const std::string_view object_id) const
Definition entity_registry.hpp:150
std::optional< TextSensorEntity > text_sensor(const std::string_view object_id) const
Definition entity_registry.hpp:97
std::optional< SelectEntity > select(const std::string_view object_id) const
Definition entity_registry.hpp:170
std::optional< NumberEntity > number(const std::string_view object_id) const
Definition entity_registry.hpp:160
std::optional< ClimateEntity > climate(const std::uint32_t key) const
Definition entity_registry.hpp:147
std::optional< SensorEntity > sensor(const std::uint32_t key) const
Definition entity_registry.hpp:83
std::optional< RadioFrequencyEntity > radio_frequency(const std::string_view object_id) const
Definition entity_registry.hpp:338
std::optional< UpdateEntity > update(const std::string_view object_id) const
Definition entity_registry.hpp:305
std::optional< EventEntity > event(const std::string_view object_id) const
Definition entity_registry.hpp:295
std::optional< SwitchEntity > switch_(const std::string_view object_id) const
Definition entity_registry.hpp:110
EntityList< SensorEntity > sensors() const
Definition entity_registry.hpp:80
EntityList< AlarmControlPanelEntity > alarm_control_panels() const
Definition entity_registry.hpp:235
std::optional< LockEntity > lock(const std::uint32_t key) const
Definition entity_registry.hpp:197
EntityList< ClimateEntity > climates() const
Definition entity_registry.hpp:144
std::optional< DateEntity > date(const std::string_view object_id) const
Definition entity_registry.hpp:255
EntityList< ButtonEntity > buttons() const
Definition entity_registry.hpp:184
std::optional< InfraredEntity > infrared(const std::uint32_t key) const
Definition entity_registry.hpp:323
std::optional< ValveEntity > valve(const std::string_view object_id) const
Definition entity_registry.hpp:285
EntityList< InfraredEntity > infrareds() const
Definition entity_registry.hpp:320
EntityList< NumberEntity > numbers() const
Definition entity_registry.hpp:154
std::optional< ButtonEntity > button(const std::uint32_t key) const
Definition entity_registry.hpp:187
std::optional< UpdateEntity > update(const std::uint32_t key) const
Definition entity_registry.hpp:302
EntityList< SelectEntity > selects() const
Definition entity_registry.hpp:164
EntityList< TextSensorEntity > text_sensors() const
Definition entity_registry.hpp:90
std::optional< SensorEntity > sensor(const std::string_view object_id) const
Definition entity_registry.hpp:86
std::optional< FanEntity > fan(const std::uint32_t key) const
Definition entity_registry.hpp:137
std::optional< AlarmControlPanelEntity > alarm_control_panel(const std::uint32_t key) const
Definition entity_registry.hpp:239
std::optional< NumberEntity > number(const std::uint32_t key) const
Definition entity_registry.hpp:157
EntityList< DateTimeEntity > datetimes() const
Definition entity_registry.hpp:269
EntityRegistry(Client &client)
Definition entity_registry.hpp:62
std::optional< MediaPlayerEntity > media_player(const std::string_view object_id) const
Definition entity_registry.hpp:211
std::optional< TextSensorEntity > text_sensor(const std::uint32_t key) const
Definition entity_registry.hpp:93
std::optional< TimeEntity > time(const std::uint32_t key) const
Definition entity_registry.hpp:262
EntityList< CoverEntity > covers() const
Definition entity_registry.hpp:124
std::optional< CameraEntity > camera(const std::uint32_t key) const
Definition entity_registry.hpp:218
EntityList< RadioFrequencyEntity > radio_frequencys() const
Definition entity_registry.hpp:330
std::optional< DateTimeEntity > datetime(const std::uint32_t key) const
Definition entity_registry.hpp:272
EntityList< CameraEntity > cameras() const
Definition entity_registry.hpp:215
EntityList< TextEntity > texts() const
Definition entity_registry.hpp:174
std::optional< AlarmControlPanelEntity > alarm_control_panel(const std::string_view object_id) const
Definition entity_registry.hpp:244
std::size_t size() const noexcept
Definition entity_store.hpp:77
const StoredEntity * find_by_object_id(const std::string &object_id) const
const StoredEntity * find(std::uint32_t key) const
Asynchronous orchestrator: owns the event loop and a Connection, and exposes connect/send/subscribe p...
std::string name
Definition emit_registry.cpp:14
Object-oriented entity handles.
Typed store of a device's entities: ingest ListEntities*‍/State messages, query typed info/state per ...
Definition bytes.hpp:10
EntityType
One per ESPHome entity domain (the <X> in ListEntities<X>Response).
Definition entity_type.hpp:11
A single tracked entity: its domain, identity, and the latest raw info/ state protobuf messages (deco...
Definition entity_store.hpp:49