ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
api_pb2.cpp
Go to the documentation of this file.
1// This file was automatically generated with a tool.
2// See script/api_protobuf/api_protobuf.py
3#include "api_pb2.h"
4#include "esphome/core/log.h"
6#include <cstring>
7
8namespace esphome::api {
9
10bool HelloRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
11 switch (field_id) {
12 case 2:
13 this->api_version_major = value.as_uint32();
14 break;
15 case 3:
16 this->api_version_minor = value.as_uint32();
17 break;
18 default:
19 return false;
20 }
21 return true;
22}
23bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
24 switch (field_id) {
25 case 1: {
26 // Use raw data directly to avoid allocation
27 this->client_info = value.data();
28 this->client_info_len = value.size();
29 break;
30 }
31 default:
32 return false;
33 }
34 return true;
35}
37 buffer.encode_uint32(1, this->api_version_major);
38 buffer.encode_uint32(2, this->api_version_minor);
39 buffer.encode_string(3, this->server_info_ref_);
40 buffer.encode_string(4, this->name_ref_);
41}
43 size.add_uint32(1, this->api_version_major);
44 size.add_uint32(1, this->api_version_minor);
45 size.add_length(1, this->server_info_ref_.size());
46 size.add_length(1, this->name_ref_.size());
47}
48#ifdef USE_API_PASSWORD
50 switch (field_id) {
51 case 1: {
52 // Use raw data directly to avoid allocation
53 this->password = value.data();
54 this->password_len = value.size();
55 break;
56 }
57 default:
58 return false;
59 }
60 return true;
61}
64#endif
65#ifdef USE_AREAS
67 buffer.encode_uint32(1, this->area_id);
68 buffer.encode_string(2, this->name_ref_);
69}
71 size.add_uint32(1, this->area_id);
72 size.add_length(1, this->name_ref_.size());
73}
74#endif
75#ifdef USE_DEVICES
77 buffer.encode_uint32(1, this->device_id);
78 buffer.encode_string(2, this->name_ref_);
79 buffer.encode_uint32(3, this->area_id);
80}
82 size.add_uint32(1, this->device_id);
83 size.add_length(1, this->name_ref_.size());
84 size.add_uint32(1, this->area_id);
85}
86#endif
88#ifdef USE_API_PASSWORD
89 buffer.encode_bool(1, this->uses_password);
90#endif
91 buffer.encode_string(2, this->name_ref_);
92 buffer.encode_string(3, this->mac_address_ref_);
93 buffer.encode_string(4, this->esphome_version_ref_);
94 buffer.encode_string(5, this->compilation_time_ref_);
95 buffer.encode_string(6, this->model_ref_);
96#ifdef USE_DEEP_SLEEP
97 buffer.encode_bool(7, this->has_deep_sleep);
98#endif
99#ifdef ESPHOME_PROJECT_NAME
100 buffer.encode_string(8, this->project_name_ref_);
101#endif
102#ifdef ESPHOME_PROJECT_NAME
103 buffer.encode_string(9, this->project_version_ref_);
104#endif
105#ifdef USE_WEBSERVER
106 buffer.encode_uint32(10, this->webserver_port);
107#endif
108#ifdef USE_BLUETOOTH_PROXY
110#endif
111 buffer.encode_string(12, this->manufacturer_ref_);
112 buffer.encode_string(13, this->friendly_name_ref_);
113#ifdef USE_VOICE_ASSISTANT
115#endif
116#ifdef USE_AREAS
117 buffer.encode_string(16, this->suggested_area_ref_);
118#endif
119#ifdef USE_BLUETOOTH_PROXY
121#endif
122#ifdef USE_API_NOISE
123 buffer.encode_bool(19, this->api_encryption_supported);
124#endif
125#ifdef USE_DEVICES
126 for (const auto &it : this->devices) {
127 buffer.encode_message(20, it);
128 }
129#endif
130#ifdef USE_AREAS
131 for (const auto &it : this->areas) {
132 buffer.encode_message(21, it);
133 }
134#endif
135#ifdef USE_AREAS
136 buffer.encode_message(22, this->area);
137#endif
138#ifdef USE_ZWAVE_PROXY
140#endif
141#ifdef USE_ZWAVE_PROXY
142 buffer.encode_uint32(24, this->zwave_home_id);
143#endif
144}
146#ifdef USE_API_PASSWORD
147 size.add_bool(1, this->uses_password);
148#endif
149 size.add_length(1, this->name_ref_.size());
150 size.add_length(1, this->mac_address_ref_.size());
151 size.add_length(1, this->esphome_version_ref_.size());
152 size.add_length(1, this->compilation_time_ref_.size());
153 size.add_length(1, this->model_ref_.size());
154#ifdef USE_DEEP_SLEEP
155 size.add_bool(1, this->has_deep_sleep);
156#endif
157#ifdef ESPHOME_PROJECT_NAME
158 size.add_length(1, this->project_name_ref_.size());
159#endif
160#ifdef ESPHOME_PROJECT_NAME
161 size.add_length(1, this->project_version_ref_.size());
162#endif
163#ifdef USE_WEBSERVER
164 size.add_uint32(1, this->webserver_port);
165#endif
166#ifdef USE_BLUETOOTH_PROXY
168#endif
169 size.add_length(1, this->manufacturer_ref_.size());
170 size.add_length(1, this->friendly_name_ref_.size());
171#ifdef USE_VOICE_ASSISTANT
173#endif
174#ifdef USE_AREAS
175 size.add_length(2, this->suggested_area_ref_.size());
176#endif
177#ifdef USE_BLUETOOTH_PROXY
179#endif
180#ifdef USE_API_NOISE
181 size.add_bool(2, this->api_encryption_supported);
182#endif
183#ifdef USE_DEVICES
184 for (const auto &it : this->devices) {
185 size.add_message_object_force(2, it);
186 }
187#endif
188#ifdef USE_AREAS
189 for (const auto &it : this->areas) {
190 size.add_message_object_force(2, it);
191 }
192#endif
193#ifdef USE_AREAS
194 size.add_message_object(2, this->area);
195#endif
196#ifdef USE_ZWAVE_PROXY
198#endif
199#ifdef USE_ZWAVE_PROXY
200 size.add_uint32(2, this->zwave_home_id);
201#endif
202}
203#ifdef USE_BINARY_SENSOR
205 buffer.encode_string(1, this->object_id_ref_);
206 buffer.encode_fixed32(2, this->key);
207 buffer.encode_string(3, this->name_ref_);
208 buffer.encode_string(5, this->device_class_ref_);
209 buffer.encode_bool(6, this->is_status_binary_sensor);
210 buffer.encode_bool(7, this->disabled_by_default);
211#ifdef USE_ENTITY_ICON
212 buffer.encode_string(8, this->icon_ref_);
213#endif
214 buffer.encode_uint32(9, static_cast<uint32_t>(this->entity_category));
215#ifdef USE_DEVICES
216 buffer.encode_uint32(10, this->device_id);
217#endif
218}
220 size.add_length(1, this->object_id_ref_.size());
221 size.add_fixed32(1, this->key);
222 size.add_length(1, this->name_ref_.size());
223 size.add_length(1, this->device_class_ref_.size());
224 size.add_bool(1, this->is_status_binary_sensor);
225 size.add_bool(1, this->disabled_by_default);
226#ifdef USE_ENTITY_ICON
227 size.add_length(1, this->icon_ref_.size());
228#endif
229 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
230#ifdef USE_DEVICES
231 size.add_uint32(1, this->device_id);
232#endif
233}
235 buffer.encode_fixed32(1, this->key);
236 buffer.encode_bool(2, this->state);
237 buffer.encode_bool(3, this->missing_state);
238#ifdef USE_DEVICES
239 buffer.encode_uint32(4, this->device_id);
240#endif
241}
243 size.add_fixed32(1, this->key);
244 size.add_bool(1, this->state);
245 size.add_bool(1, this->missing_state);
246#ifdef USE_DEVICES
247 size.add_uint32(1, this->device_id);
248#endif
249}
250#endif
251#ifdef USE_COVER
253 buffer.encode_string(1, this->object_id_ref_);
254 buffer.encode_fixed32(2, this->key);
255 buffer.encode_string(3, this->name_ref_);
256 buffer.encode_bool(5, this->assumed_state);
257 buffer.encode_bool(6, this->supports_position);
258 buffer.encode_bool(7, this->supports_tilt);
259 buffer.encode_string(8, this->device_class_ref_);
260 buffer.encode_bool(9, this->disabled_by_default);
261#ifdef USE_ENTITY_ICON
262 buffer.encode_string(10, this->icon_ref_);
263#endif
264 buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
265 buffer.encode_bool(12, this->supports_stop);
266#ifdef USE_DEVICES
267 buffer.encode_uint32(13, this->device_id);
268#endif
269}
271 size.add_length(1, this->object_id_ref_.size());
272 size.add_fixed32(1, this->key);
273 size.add_length(1, this->name_ref_.size());
274 size.add_bool(1, this->assumed_state);
275 size.add_bool(1, this->supports_position);
276 size.add_bool(1, this->supports_tilt);
277 size.add_length(1, this->device_class_ref_.size());
278 size.add_bool(1, this->disabled_by_default);
279#ifdef USE_ENTITY_ICON
280 size.add_length(1, this->icon_ref_.size());
281#endif
282 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
283 size.add_bool(1, this->supports_stop);
284#ifdef USE_DEVICES
285 size.add_uint32(1, this->device_id);
286#endif
287}
289 buffer.encode_fixed32(1, this->key);
290 buffer.encode_float(3, this->position);
291 buffer.encode_float(4, this->tilt);
292 buffer.encode_uint32(5, static_cast<uint32_t>(this->current_operation));
293#ifdef USE_DEVICES
294 buffer.encode_uint32(6, this->device_id);
295#endif
296}
298 size.add_fixed32(1, this->key);
299 size.add_float(1, this->position);
300 size.add_float(1, this->tilt);
301 size.add_uint32(1, static_cast<uint32_t>(this->current_operation));
302#ifdef USE_DEVICES
303 size.add_uint32(1, this->device_id);
304#endif
305}
306bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
307 switch (field_id) {
308 case 4:
309 this->has_position = value.as_bool();
310 break;
311 case 6:
312 this->has_tilt = value.as_bool();
313 break;
314 case 8:
315 this->stop = value.as_bool();
316 break;
317#ifdef USE_DEVICES
318 case 9:
319 this->device_id = value.as_uint32();
320 break;
321#endif
322 default:
323 return false;
324 }
325 return true;
326}
327bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
328 switch (field_id) {
329 case 1:
330 this->key = value.as_fixed32();
331 break;
332 case 5:
333 this->position = value.as_float();
334 break;
335 case 7:
336 this->tilt = value.as_float();
337 break;
338 default:
339 return false;
340 }
341 return true;
342}
343#endif
344#ifdef USE_FAN
346 buffer.encode_string(1, this->object_id_ref_);
347 buffer.encode_fixed32(2, this->key);
348 buffer.encode_string(3, this->name_ref_);
349 buffer.encode_bool(5, this->supports_oscillation);
350 buffer.encode_bool(6, this->supports_speed);
351 buffer.encode_bool(7, this->supports_direction);
352 buffer.encode_int32(8, this->supported_speed_count);
353 buffer.encode_bool(9, this->disabled_by_default);
354#ifdef USE_ENTITY_ICON
355 buffer.encode_string(10, this->icon_ref_);
356#endif
357 buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
358 for (const char *it : *this->supported_preset_modes) {
359 buffer.encode_string(12, it, strlen(it), true);
360 }
361#ifdef USE_DEVICES
362 buffer.encode_uint32(13, this->device_id);
363#endif
364}
366 size.add_length(1, this->object_id_ref_.size());
367 size.add_fixed32(1, this->key);
368 size.add_length(1, this->name_ref_.size());
369 size.add_bool(1, this->supports_oscillation);
370 size.add_bool(1, this->supports_speed);
371 size.add_bool(1, this->supports_direction);
372 size.add_int32(1, this->supported_speed_count);
373 size.add_bool(1, this->disabled_by_default);
374#ifdef USE_ENTITY_ICON
375 size.add_length(1, this->icon_ref_.size());
376#endif
377 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
378 if (!this->supported_preset_modes->empty()) {
379 for (const char *it : *this->supported_preset_modes) {
380 size.add_length_force(1, strlen(it));
381 }
382 }
383#ifdef USE_DEVICES
384 size.add_uint32(1, this->device_id);
385#endif
386}
388 buffer.encode_fixed32(1, this->key);
389 buffer.encode_bool(2, this->state);
390 buffer.encode_bool(3, this->oscillating);
391 buffer.encode_uint32(5, static_cast<uint32_t>(this->direction));
392 buffer.encode_int32(6, this->speed_level);
393 buffer.encode_string(7, this->preset_mode_ref_);
394#ifdef USE_DEVICES
395 buffer.encode_uint32(8, this->device_id);
396#endif
397}
399 size.add_fixed32(1, this->key);
400 size.add_bool(1, this->state);
401 size.add_bool(1, this->oscillating);
402 size.add_uint32(1, static_cast<uint32_t>(this->direction));
403 size.add_int32(1, this->speed_level);
404 size.add_length(1, this->preset_mode_ref_.size());
405#ifdef USE_DEVICES
406 size.add_uint32(1, this->device_id);
407#endif
408}
409bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
410 switch (field_id) {
411 case 2:
412 this->has_state = value.as_bool();
413 break;
414 case 3:
415 this->state = value.as_bool();
416 break;
417 case 6:
418 this->has_oscillating = value.as_bool();
419 break;
420 case 7:
421 this->oscillating = value.as_bool();
422 break;
423 case 8:
424 this->has_direction = value.as_bool();
425 break;
426 case 9:
427 this->direction = static_cast<enums::FanDirection>(value.as_uint32());
428 break;
429 case 10:
430 this->has_speed_level = value.as_bool();
431 break;
432 case 11:
433 this->speed_level = value.as_int32();
434 break;
435 case 12:
436 this->has_preset_mode = value.as_bool();
437 break;
438#ifdef USE_DEVICES
439 case 14:
440 this->device_id = value.as_uint32();
441 break;
442#endif
443 default:
444 return false;
445 }
446 return true;
447}
449 switch (field_id) {
450 case 13: {
451 // Use raw data directly to avoid allocation
452 this->preset_mode = value.data();
453 this->preset_mode_len = value.size();
454 break;
455 }
456 default:
457 return false;
458 }
459 return true;
460}
461bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
462 switch (field_id) {
463 case 1:
464 this->key = value.as_fixed32();
465 break;
466 default:
467 return false;
468 }
469 return true;
470}
471#endif
472#ifdef USE_LIGHT
474 buffer.encode_string(1, this->object_id_ref_);
475 buffer.encode_fixed32(2, this->key);
476 buffer.encode_string(3, this->name_ref_);
477 for (const auto &it : *this->supported_color_modes) {
478 buffer.encode_uint32(12, static_cast<uint32_t>(it), true);
479 }
480 buffer.encode_float(9, this->min_mireds);
481 buffer.encode_float(10, this->max_mireds);
482 for (const char *it : *this->effects) {
483 buffer.encode_string(11, it, strlen(it), true);
484 }
485 buffer.encode_bool(13, this->disabled_by_default);
486#ifdef USE_ENTITY_ICON
487 buffer.encode_string(14, this->icon_ref_);
488#endif
489 buffer.encode_uint32(15, static_cast<uint32_t>(this->entity_category));
490#ifdef USE_DEVICES
491 buffer.encode_uint32(16, this->device_id);
492#endif
493}
495 size.add_length(1, this->object_id_ref_.size());
496 size.add_fixed32(1, this->key);
497 size.add_length(1, this->name_ref_.size());
498 if (!this->supported_color_modes->empty()) {
499 for (const auto &it : *this->supported_color_modes) {
500 size.add_uint32_force(1, static_cast<uint32_t>(it));
501 }
502 }
503 size.add_float(1, this->min_mireds);
504 size.add_float(1, this->max_mireds);
505 if (!this->effects->empty()) {
506 for (const char *it : *this->effects) {
507 size.add_length_force(1, strlen(it));
508 }
509 }
510 size.add_bool(1, this->disabled_by_default);
511#ifdef USE_ENTITY_ICON
512 size.add_length(1, this->icon_ref_.size());
513#endif
514 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
515#ifdef USE_DEVICES
516 size.add_uint32(2, this->device_id);
517#endif
518}
520 buffer.encode_fixed32(1, this->key);
521 buffer.encode_bool(2, this->state);
522 buffer.encode_float(3, this->brightness);
523 buffer.encode_uint32(11, static_cast<uint32_t>(this->color_mode));
524 buffer.encode_float(10, this->color_brightness);
525 buffer.encode_float(4, this->red);
526 buffer.encode_float(5, this->green);
527 buffer.encode_float(6, this->blue);
528 buffer.encode_float(7, this->white);
529 buffer.encode_float(8, this->color_temperature);
530 buffer.encode_float(12, this->cold_white);
531 buffer.encode_float(13, this->warm_white);
532 buffer.encode_string(9, this->effect_ref_);
533#ifdef USE_DEVICES
534 buffer.encode_uint32(14, this->device_id);
535#endif
536}
538 size.add_fixed32(1, this->key);
539 size.add_bool(1, this->state);
540 size.add_float(1, this->brightness);
541 size.add_uint32(1, static_cast<uint32_t>(this->color_mode));
542 size.add_float(1, this->color_brightness);
543 size.add_float(1, this->red);
544 size.add_float(1, this->green);
545 size.add_float(1, this->blue);
546 size.add_float(1, this->white);
547 size.add_float(1, this->color_temperature);
548 size.add_float(1, this->cold_white);
549 size.add_float(1, this->warm_white);
550 size.add_length(1, this->effect_ref_.size());
551#ifdef USE_DEVICES
552 size.add_uint32(1, this->device_id);
553#endif
554}
555bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
556 switch (field_id) {
557 case 2:
558 this->has_state = value.as_bool();
559 break;
560 case 3:
561 this->state = value.as_bool();
562 break;
563 case 4:
564 this->has_brightness = value.as_bool();
565 break;
566 case 22:
567 this->has_color_mode = value.as_bool();
568 break;
569 case 23:
570 this->color_mode = static_cast<enums::ColorMode>(value.as_uint32());
571 break;
572 case 20:
573 this->has_color_brightness = value.as_bool();
574 break;
575 case 6:
576 this->has_rgb = value.as_bool();
577 break;
578 case 10:
579 this->has_white = value.as_bool();
580 break;
581 case 12:
582 this->has_color_temperature = value.as_bool();
583 break;
584 case 24:
585 this->has_cold_white = value.as_bool();
586 break;
587 case 26:
588 this->has_warm_white = value.as_bool();
589 break;
590 case 14:
591 this->has_transition_length = value.as_bool();
592 break;
593 case 15:
594 this->transition_length = value.as_uint32();
595 break;
596 case 16:
597 this->has_flash_length = value.as_bool();
598 break;
599 case 17:
600 this->flash_length = value.as_uint32();
601 break;
602 case 18:
603 this->has_effect = value.as_bool();
604 break;
605#ifdef USE_DEVICES
606 case 28:
607 this->device_id = value.as_uint32();
608 break;
609#endif
610 default:
611 return false;
612 }
613 return true;
614}
616 switch (field_id) {
617 case 19: {
618 // Use raw data directly to avoid allocation
619 this->effect = value.data();
620 this->effect_len = value.size();
621 break;
622 }
623 default:
624 return false;
625 }
626 return true;
627}
628bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
629 switch (field_id) {
630 case 1:
631 this->key = value.as_fixed32();
632 break;
633 case 5:
634 this->brightness = value.as_float();
635 break;
636 case 21:
637 this->color_brightness = value.as_float();
638 break;
639 case 7:
640 this->red = value.as_float();
641 break;
642 case 8:
643 this->green = value.as_float();
644 break;
645 case 9:
646 this->blue = value.as_float();
647 break;
648 case 11:
649 this->white = value.as_float();
650 break;
651 case 13:
652 this->color_temperature = value.as_float();
653 break;
654 case 25:
655 this->cold_white = value.as_float();
656 break;
657 case 27:
658 this->warm_white = value.as_float();
659 break;
660 default:
661 return false;
662 }
663 return true;
664}
665#endif
666#ifdef USE_SENSOR
668 buffer.encode_string(1, this->object_id_ref_);
669 buffer.encode_fixed32(2, this->key);
670 buffer.encode_string(3, this->name_ref_);
671#ifdef USE_ENTITY_ICON
672 buffer.encode_string(5, this->icon_ref_);
673#endif
675 buffer.encode_int32(7, this->accuracy_decimals);
676 buffer.encode_bool(8, this->force_update);
677 buffer.encode_string(9, this->device_class_ref_);
678 buffer.encode_uint32(10, static_cast<uint32_t>(this->state_class));
679 buffer.encode_bool(12, this->disabled_by_default);
680 buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category));
681#ifdef USE_DEVICES
682 buffer.encode_uint32(14, this->device_id);
683#endif
684}
686 size.add_length(1, this->object_id_ref_.size());
687 size.add_fixed32(1, this->key);
688 size.add_length(1, this->name_ref_.size());
689#ifdef USE_ENTITY_ICON
690 size.add_length(1, this->icon_ref_.size());
691#endif
693 size.add_int32(1, this->accuracy_decimals);
694 size.add_bool(1, this->force_update);
695 size.add_length(1, this->device_class_ref_.size());
696 size.add_uint32(1, static_cast<uint32_t>(this->state_class));
697 size.add_bool(1, this->disabled_by_default);
698 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
699#ifdef USE_DEVICES
700 size.add_uint32(1, this->device_id);
701#endif
702}
704 buffer.encode_fixed32(1, this->key);
705 buffer.encode_float(2, this->state);
706 buffer.encode_bool(3, this->missing_state);
707#ifdef USE_DEVICES
708 buffer.encode_uint32(4, this->device_id);
709#endif
710}
712 size.add_fixed32(1, this->key);
713 size.add_float(1, this->state);
714 size.add_bool(1, this->missing_state);
715#ifdef USE_DEVICES
716 size.add_uint32(1, this->device_id);
717#endif
718}
719#endif
720#ifdef USE_SWITCH
722 buffer.encode_string(1, this->object_id_ref_);
723 buffer.encode_fixed32(2, this->key);
724 buffer.encode_string(3, this->name_ref_);
725#ifdef USE_ENTITY_ICON
726 buffer.encode_string(5, this->icon_ref_);
727#endif
728 buffer.encode_bool(6, this->assumed_state);
729 buffer.encode_bool(7, this->disabled_by_default);
730 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
731 buffer.encode_string(9, this->device_class_ref_);
732#ifdef USE_DEVICES
733 buffer.encode_uint32(10, this->device_id);
734#endif
735}
737 size.add_length(1, this->object_id_ref_.size());
738 size.add_fixed32(1, this->key);
739 size.add_length(1, this->name_ref_.size());
740#ifdef USE_ENTITY_ICON
741 size.add_length(1, this->icon_ref_.size());
742#endif
743 size.add_bool(1, this->assumed_state);
744 size.add_bool(1, this->disabled_by_default);
745 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
746 size.add_length(1, this->device_class_ref_.size());
747#ifdef USE_DEVICES
748 size.add_uint32(1, this->device_id);
749#endif
750}
752 buffer.encode_fixed32(1, this->key);
753 buffer.encode_bool(2, this->state);
754#ifdef USE_DEVICES
755 buffer.encode_uint32(3, this->device_id);
756#endif
757}
759 size.add_fixed32(1, this->key);
760 size.add_bool(1, this->state);
761#ifdef USE_DEVICES
762 size.add_uint32(1, this->device_id);
763#endif
764}
765bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
766 switch (field_id) {
767 case 2:
768 this->state = value.as_bool();
769 break;
770#ifdef USE_DEVICES
771 case 3:
772 this->device_id = value.as_uint32();
773 break;
774#endif
775 default:
776 return false;
777 }
778 return true;
779}
780bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
781 switch (field_id) {
782 case 1:
783 this->key = value.as_fixed32();
784 break;
785 default:
786 return false;
787 }
788 return true;
789}
790#endif
791#ifdef USE_TEXT_SENSOR
793 buffer.encode_string(1, this->object_id_ref_);
794 buffer.encode_fixed32(2, this->key);
795 buffer.encode_string(3, this->name_ref_);
796#ifdef USE_ENTITY_ICON
797 buffer.encode_string(5, this->icon_ref_);
798#endif
799 buffer.encode_bool(6, this->disabled_by_default);
800 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
801 buffer.encode_string(8, this->device_class_ref_);
802#ifdef USE_DEVICES
803 buffer.encode_uint32(9, this->device_id);
804#endif
805}
807 size.add_length(1, this->object_id_ref_.size());
808 size.add_fixed32(1, this->key);
809 size.add_length(1, this->name_ref_.size());
810#ifdef USE_ENTITY_ICON
811 size.add_length(1, this->icon_ref_.size());
812#endif
813 size.add_bool(1, this->disabled_by_default);
814 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
815 size.add_length(1, this->device_class_ref_.size());
816#ifdef USE_DEVICES
817 size.add_uint32(1, this->device_id);
818#endif
819}
821 buffer.encode_fixed32(1, this->key);
822 buffer.encode_string(2, this->state_ref_);
823 buffer.encode_bool(3, this->missing_state);
824#ifdef USE_DEVICES
825 buffer.encode_uint32(4, this->device_id);
826#endif
827}
829 size.add_fixed32(1, this->key);
830 size.add_length(1, this->state_ref_.size());
831 size.add_bool(1, this->missing_state);
832#ifdef USE_DEVICES
833 size.add_uint32(1, this->device_id);
834#endif
835}
836#endif
837bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
838 switch (field_id) {
839 case 1:
840 this->level = static_cast<enums::LogLevel>(value.as_uint32());
841 break;
842 case 2:
843 this->dump_config = value.as_bool();
844 break;
845 default:
846 return false;
847 }
848 return true;
849}
851 buffer.encode_uint32(1, static_cast<uint32_t>(this->level));
852 buffer.encode_bytes(3, this->message_ptr_, this->message_len_);
853}
855 size.add_uint32(1, static_cast<uint32_t>(this->level));
856 size.add_length(1, this->message_len_);
857}
858#ifdef USE_API_NOISE
860 switch (field_id) {
861 case 1: {
862 // Use raw data directly to avoid allocation
863 this->key = value.data();
864 this->key_len = value.size();
865 break;
866 }
867 default:
868 return false;
869 }
870 return true;
871}
874#endif
875#ifdef USE_API_HOMEASSISTANT_SERVICES
877 buffer.encode_string(1, this->key_ref_);
878 buffer.encode_string(2, this->value);
879}
881 size.add_length(1, this->key_ref_.size());
882 size.add_length(1, this->value.size());
883}
885 buffer.encode_string(1, this->service_ref_);
886 for (auto &it : this->data) {
887 buffer.encode_message(2, it);
888 }
889 for (auto &it : this->data_template) {
890 buffer.encode_message(3, it);
891 }
892 for (auto &it : this->variables) {
893 buffer.encode_message(4, it);
894 }
895 buffer.encode_bool(5, this->is_event);
896#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
897 buffer.encode_uint32(6, this->call_id);
898#endif
899#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
900 buffer.encode_bool(7, this->wants_response);
901#endif
902#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
903 buffer.encode_string(8, this->response_template);
904#endif
905}
907 size.add_length(1, this->service_ref_.size());
908 size.add_repeated_message(1, this->data);
909 size.add_repeated_message(1, this->data_template);
910 size.add_repeated_message(1, this->variables);
911 size.add_bool(1, this->is_event);
912#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
913 size.add_uint32(1, this->call_id);
914#endif
915#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
916 size.add_bool(1, this->wants_response);
917#endif
918#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
919 size.add_length(1, this->response_template.size());
920#endif
921}
922#endif
923#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
925 switch (field_id) {
926 case 1:
927 this->call_id = value.as_uint32();
928 break;
929 case 2:
930 this->success = value.as_bool();
931 break;
932 default:
933 return false;
934 }
935 return true;
936}
938 switch (field_id) {
939 case 3:
940 this->error_message = value.as_string();
941 break;
942#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
943 case 4: {
944 // Use raw data directly to avoid allocation
945 this->response_data = value.data();
946 this->response_data_len = value.size();
947 break;
948 }
949#endif
950 default:
951 return false;
952 }
953 return true;
954}
955#endif
956#ifdef USE_API_HOMEASSISTANT_STATES
958 buffer.encode_string(1, this->entity_id_ref_);
959 buffer.encode_string(2, this->attribute_ref_);
960 buffer.encode_bool(3, this->once);
961}
963 size.add_length(1, this->entity_id_ref_.size());
964 size.add_length(1, this->attribute_ref_.size());
965 size.add_bool(1, this->once);
966}
968 switch (field_id) {
969 case 1: {
970 // Use raw data directly to avoid allocation
971 this->entity_id = value.data();
972 this->entity_id_len = value.size();
973 break;
974 }
975 case 2: {
976 // Use raw data directly to avoid allocation
977 this->state = value.data();
978 this->state_len = value.size();
979 break;
980 }
981 case 3: {
982 // Use raw data directly to avoid allocation
983 this->attribute = value.data();
984 this->attribute_len = value.size();
985 break;
986 }
987 default:
988 return false;
989 }
990 return true;
991}
992#endif
994 switch (field_id) {
995 case 2: {
996 // Use raw data directly to avoid allocation
997 this->timezone = value.data();
998 this->timezone_len = value.size();
999 break;
1000 }
1001 default:
1002 return false;
1003 }
1004 return true;
1005}
1006bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1007 switch (field_id) {
1008 case 1:
1009 this->epoch_seconds = value.as_fixed32();
1010 break;
1011 default:
1012 return false;
1013 }
1014 return true;
1015}
1016#ifdef USE_API_USER_DEFINED_ACTIONS
1018 buffer.encode_string(1, this->name_ref_);
1019 buffer.encode_uint32(2, static_cast<uint32_t>(this->type));
1020}
1022 size.add_length(1, this->name_ref_.size());
1023 size.add_uint32(1, static_cast<uint32_t>(this->type));
1024}
1026 buffer.encode_string(1, this->name_ref_);
1027 buffer.encode_fixed32(2, this->key);
1028 for (auto &it : this->args) {
1029 buffer.encode_message(3, it);
1030 }
1031 buffer.encode_uint32(4, static_cast<uint32_t>(this->supports_response));
1032}
1034 size.add_length(1, this->name_ref_.size());
1035 size.add_fixed32(1, this->key);
1036 size.add_repeated_message(1, this->args);
1037 size.add_uint32(1, static_cast<uint32_t>(this->supports_response));
1038}
1040 switch (field_id) {
1041 case 1:
1042 this->bool_ = value.as_bool();
1043 break;
1044 case 2:
1045 this->legacy_int = value.as_int32();
1046 break;
1047 case 5:
1048 this->int_ = value.as_sint32();
1049 break;
1050 case 6:
1051 this->bool_array.push_back(value.as_bool());
1052 break;
1053 case 7:
1054 this->int_array.push_back(value.as_sint32());
1055 break;
1056 default:
1057 return false;
1058 }
1059 return true;
1060}
1062 switch (field_id) {
1063 case 4:
1064 this->string_ = value.as_string();
1065 break;
1066 case 9:
1067 this->string_array.push_back(value.as_string());
1068 break;
1069 default:
1070 return false;
1071 }
1072 return true;
1073}
1074bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
1075 switch (field_id) {
1076 case 3:
1077 this->float_ = value.as_float();
1078 break;
1079 case 8:
1080 this->float_array.push_back(value.as_float());
1081 break;
1082 default:
1083 return false;
1084 }
1085 return true;
1086}
1087void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) {
1088 uint32_t count_bool_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 6);
1089 this->bool_array.init(count_bool_array);
1090 uint32_t count_int_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 7);
1091 this->int_array.init(count_int_array);
1092 uint32_t count_float_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 8);
1093 this->float_array.init(count_float_array);
1094 uint32_t count_string_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 9);
1095 this->string_array.init(count_string_array);
1097}
1099 switch (field_id) {
1100#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1101 case 3:
1102 this->call_id = value.as_uint32();
1103 break;
1104#endif
1105#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1106 case 4:
1107 this->return_response = value.as_bool();
1108 break;
1109#endif
1110 default:
1111 return false;
1112 }
1113 return true;
1114}
1116 switch (field_id) {
1117 case 2:
1118 this->args.emplace_back();
1119 value.decode_to_message(this->args.back());
1120 break;
1121 default:
1122 return false;
1123 }
1124 return true;
1125}
1126bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1127 switch (field_id) {
1128 case 1:
1129 this->key = value.as_fixed32();
1130 break;
1131 default:
1132 return false;
1133 }
1134 return true;
1135}
1136void ExecuteServiceRequest::decode(const uint8_t *buffer, size_t length) {
1137 uint32_t count_args = ProtoDecodableMessage::count_repeated_field(buffer, length, 2);
1138 this->args.init(count_args);
1140}
1141#endif
1142#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1144 buffer.encode_uint32(1, this->call_id);
1145 buffer.encode_bool(2, this->success);
1146 buffer.encode_string(3, this->error_message_ref_);
1147#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
1148 buffer.encode_bytes(4, this->response_data, this->response_data_len);
1149#endif
1150}
1152 size.add_uint32(1, this->call_id);
1153 size.add_bool(1, this->success);
1154 size.add_length(1, this->error_message_ref_.size());
1155#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
1156 size.add_length(4, this->response_data_len);
1157#endif
1158}
1159#endif
1160#ifdef USE_CAMERA
1162 buffer.encode_string(1, this->object_id_ref_);
1163 buffer.encode_fixed32(2, this->key);
1164 buffer.encode_string(3, this->name_ref_);
1165 buffer.encode_bool(5, this->disabled_by_default);
1166#ifdef USE_ENTITY_ICON
1167 buffer.encode_string(6, this->icon_ref_);
1168#endif
1169 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1170#ifdef USE_DEVICES
1171 buffer.encode_uint32(8, this->device_id);
1172#endif
1173}
1175 size.add_length(1, this->object_id_ref_.size());
1176 size.add_fixed32(1, this->key);
1177 size.add_length(1, this->name_ref_.size());
1178 size.add_bool(1, this->disabled_by_default);
1179#ifdef USE_ENTITY_ICON
1180 size.add_length(1, this->icon_ref_.size());
1181#endif
1182 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1183#ifdef USE_DEVICES
1184 size.add_uint32(1, this->device_id);
1185#endif
1186}
1188 buffer.encode_fixed32(1, this->key);
1189 buffer.encode_bytes(2, this->data_ptr_, this->data_len_);
1190 buffer.encode_bool(3, this->done);
1191#ifdef USE_DEVICES
1192 buffer.encode_uint32(4, this->device_id);
1193#endif
1194}
1196 size.add_fixed32(1, this->key);
1197 size.add_length(1, this->data_len_);
1198 size.add_bool(1, this->done);
1199#ifdef USE_DEVICES
1200 size.add_uint32(1, this->device_id);
1201#endif
1202}
1203bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1204 switch (field_id) {
1205 case 1:
1206 this->single = value.as_bool();
1207 break;
1208 case 2:
1209 this->stream = value.as_bool();
1210 break;
1211 default:
1212 return false;
1213 }
1214 return true;
1215}
1216#endif
1217#ifdef USE_CLIMATE
1219 buffer.encode_string(1, this->object_id_ref_);
1220 buffer.encode_fixed32(2, this->key);
1221 buffer.encode_string(3, this->name_ref_);
1224 for (const auto &it : *this->supported_modes) {
1225 buffer.encode_uint32(7, static_cast<uint32_t>(it), true);
1226 }
1227 buffer.encode_float(8, this->visual_min_temperature);
1228 buffer.encode_float(9, this->visual_max_temperature);
1230 buffer.encode_bool(12, this->supports_action);
1231 for (const auto &it : *this->supported_fan_modes) {
1232 buffer.encode_uint32(13, static_cast<uint32_t>(it), true);
1233 }
1234 for (const auto &it : *this->supported_swing_modes) {
1235 buffer.encode_uint32(14, static_cast<uint32_t>(it), true);
1236 }
1237 for (const char *it : *this->supported_custom_fan_modes) {
1238 buffer.encode_string(15, it, strlen(it), true);
1239 }
1240 for (const auto &it : *this->supported_presets) {
1241 buffer.encode_uint32(16, static_cast<uint32_t>(it), true);
1242 }
1243 for (const char *it : *this->supported_custom_presets) {
1244 buffer.encode_string(17, it, strlen(it), true);
1245 }
1246 buffer.encode_bool(18, this->disabled_by_default);
1247#ifdef USE_ENTITY_ICON
1248 buffer.encode_string(19, this->icon_ref_);
1249#endif
1250 buffer.encode_uint32(20, static_cast<uint32_t>(this->entity_category));
1252 buffer.encode_bool(22, this->supports_current_humidity);
1253 buffer.encode_bool(23, this->supports_target_humidity);
1254 buffer.encode_float(24, this->visual_min_humidity);
1255 buffer.encode_float(25, this->visual_max_humidity);
1256#ifdef USE_DEVICES
1257 buffer.encode_uint32(26, this->device_id);
1258#endif
1259 buffer.encode_uint32(27, this->feature_flags);
1260}
1262 size.add_length(1, this->object_id_ref_.size());
1263 size.add_fixed32(1, this->key);
1264 size.add_length(1, this->name_ref_.size());
1267 if (!this->supported_modes->empty()) {
1268 for (const auto &it : *this->supported_modes) {
1269 size.add_uint32_force(1, static_cast<uint32_t>(it));
1270 }
1271 }
1272 size.add_float(1, this->visual_min_temperature);
1273 size.add_float(1, this->visual_max_temperature);
1275 size.add_bool(1, this->supports_action);
1276 if (!this->supported_fan_modes->empty()) {
1277 for (const auto &it : *this->supported_fan_modes) {
1278 size.add_uint32_force(1, static_cast<uint32_t>(it));
1279 }
1280 }
1281 if (!this->supported_swing_modes->empty()) {
1282 for (const auto &it : *this->supported_swing_modes) {
1283 size.add_uint32_force(1, static_cast<uint32_t>(it));
1284 }
1285 }
1286 if (!this->supported_custom_fan_modes->empty()) {
1287 for (const char *it : *this->supported_custom_fan_modes) {
1288 size.add_length_force(1, strlen(it));
1289 }
1290 }
1291 if (!this->supported_presets->empty()) {
1292 for (const auto &it : *this->supported_presets) {
1293 size.add_uint32_force(2, static_cast<uint32_t>(it));
1294 }
1295 }
1296 if (!this->supported_custom_presets->empty()) {
1297 for (const char *it : *this->supported_custom_presets) {
1298 size.add_length_force(2, strlen(it));
1299 }
1300 }
1301 size.add_bool(2, this->disabled_by_default);
1302#ifdef USE_ENTITY_ICON
1303 size.add_length(2, this->icon_ref_.size());
1304#endif
1305 size.add_uint32(2, static_cast<uint32_t>(this->entity_category));
1307 size.add_bool(2, this->supports_current_humidity);
1308 size.add_bool(2, this->supports_target_humidity);
1309 size.add_float(2, this->visual_min_humidity);
1310 size.add_float(2, this->visual_max_humidity);
1311#ifdef USE_DEVICES
1312 size.add_uint32(2, this->device_id);
1313#endif
1314 size.add_uint32(2, this->feature_flags);
1315}
1317 buffer.encode_fixed32(1, this->key);
1318 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
1319 buffer.encode_float(3, this->current_temperature);
1320 buffer.encode_float(4, this->target_temperature);
1321 buffer.encode_float(5, this->target_temperature_low);
1322 buffer.encode_float(6, this->target_temperature_high);
1323 buffer.encode_uint32(8, static_cast<uint32_t>(this->action));
1324 buffer.encode_uint32(9, static_cast<uint32_t>(this->fan_mode));
1325 buffer.encode_uint32(10, static_cast<uint32_t>(this->swing_mode));
1326 buffer.encode_string(11, this->custom_fan_mode_ref_);
1327 buffer.encode_uint32(12, static_cast<uint32_t>(this->preset));
1328 buffer.encode_string(13, this->custom_preset_ref_);
1329 buffer.encode_float(14, this->current_humidity);
1330 buffer.encode_float(15, this->target_humidity);
1331#ifdef USE_DEVICES
1332 buffer.encode_uint32(16, this->device_id);
1333#endif
1334}
1336 size.add_fixed32(1, this->key);
1337 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1338 size.add_float(1, this->current_temperature);
1339 size.add_float(1, this->target_temperature);
1340 size.add_float(1, this->target_temperature_low);
1341 size.add_float(1, this->target_temperature_high);
1342 size.add_uint32(1, static_cast<uint32_t>(this->action));
1343 size.add_uint32(1, static_cast<uint32_t>(this->fan_mode));
1344 size.add_uint32(1, static_cast<uint32_t>(this->swing_mode));
1345 size.add_length(1, this->custom_fan_mode_ref_.size());
1346 size.add_uint32(1, static_cast<uint32_t>(this->preset));
1347 size.add_length(1, this->custom_preset_ref_.size());
1348 size.add_float(1, this->current_humidity);
1349 size.add_float(1, this->target_humidity);
1350#ifdef USE_DEVICES
1351 size.add_uint32(2, this->device_id);
1352#endif
1353}
1355 switch (field_id) {
1356 case 2:
1357 this->has_mode = value.as_bool();
1358 break;
1359 case 3:
1360 this->mode = static_cast<enums::ClimateMode>(value.as_uint32());
1361 break;
1362 case 4:
1363 this->has_target_temperature = value.as_bool();
1364 break;
1365 case 6:
1366 this->has_target_temperature_low = value.as_bool();
1367 break;
1368 case 8:
1369 this->has_target_temperature_high = value.as_bool();
1370 break;
1371 case 12:
1372 this->has_fan_mode = value.as_bool();
1373 break;
1374 case 13:
1375 this->fan_mode = static_cast<enums::ClimateFanMode>(value.as_uint32());
1376 break;
1377 case 14:
1378 this->has_swing_mode = value.as_bool();
1379 break;
1380 case 15:
1381 this->swing_mode = static_cast<enums::ClimateSwingMode>(value.as_uint32());
1382 break;
1383 case 16:
1384 this->has_custom_fan_mode = value.as_bool();
1385 break;
1386 case 18:
1387 this->has_preset = value.as_bool();
1388 break;
1389 case 19:
1390 this->preset = static_cast<enums::ClimatePreset>(value.as_uint32());
1391 break;
1392 case 20:
1393 this->has_custom_preset = value.as_bool();
1394 break;
1395 case 22:
1396 this->has_target_humidity = value.as_bool();
1397 break;
1398#ifdef USE_DEVICES
1399 case 24:
1400 this->device_id = value.as_uint32();
1401 break;
1402#endif
1403 default:
1404 return false;
1405 }
1406 return true;
1407}
1409 switch (field_id) {
1410 case 17: {
1411 // Use raw data directly to avoid allocation
1412 this->custom_fan_mode = value.data();
1413 this->custom_fan_mode_len = value.size();
1414 break;
1415 }
1416 case 21: {
1417 // Use raw data directly to avoid allocation
1418 this->custom_preset = value.data();
1419 this->custom_preset_len = value.size();
1420 break;
1421 }
1422 default:
1423 return false;
1424 }
1425 return true;
1426}
1427bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1428 switch (field_id) {
1429 case 1:
1430 this->key = value.as_fixed32();
1431 break;
1432 case 5:
1433 this->target_temperature = value.as_float();
1434 break;
1435 case 7:
1436 this->target_temperature_low = value.as_float();
1437 break;
1438 case 9:
1439 this->target_temperature_high = value.as_float();
1440 break;
1441 case 23:
1442 this->target_humidity = value.as_float();
1443 break;
1444 default:
1445 return false;
1446 }
1447 return true;
1448}
1449#endif
1450#ifdef USE_WATER_HEATER
1452 buffer.encode_string(1, this->object_id_ref_);
1453 buffer.encode_fixed32(2, this->key);
1454 buffer.encode_string(3, this->name_ref_);
1455#ifdef USE_ENTITY_ICON
1456 buffer.encode_string(4, this->icon_ref_);
1457#endif
1458 buffer.encode_bool(5, this->disabled_by_default);
1459 buffer.encode_uint32(6, static_cast<uint32_t>(this->entity_category));
1460#ifdef USE_DEVICES
1461 buffer.encode_uint32(7, this->device_id);
1462#endif
1463 buffer.encode_float(8, this->min_temperature);
1464 buffer.encode_float(9, this->max_temperature);
1465 buffer.encode_float(10, this->target_temperature_step);
1466 for (const auto &it : *this->supported_modes) {
1467 buffer.encode_uint32(11, static_cast<uint32_t>(it), true);
1468 }
1469 buffer.encode_uint32(12, this->supported_features);
1470}
1472 size.add_length(1, this->object_id_ref_.size());
1473 size.add_fixed32(1, this->key);
1474 size.add_length(1, this->name_ref_.size());
1475#ifdef USE_ENTITY_ICON
1476 size.add_length(1, this->icon_ref_.size());
1477#endif
1478 size.add_bool(1, this->disabled_by_default);
1479 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1480#ifdef USE_DEVICES
1481 size.add_uint32(1, this->device_id);
1482#endif
1483 size.add_float(1, this->min_temperature);
1484 size.add_float(1, this->max_temperature);
1485 size.add_float(1, this->target_temperature_step);
1486 if (!this->supported_modes->empty()) {
1487 for (const auto &it : *this->supported_modes) {
1488 size.add_uint32_force(1, static_cast<uint32_t>(it));
1489 }
1490 }
1491 size.add_uint32(1, this->supported_features);
1492}
1494 buffer.encode_fixed32(1, this->key);
1495 buffer.encode_float(2, this->current_temperature);
1496 buffer.encode_float(3, this->target_temperature);
1497 buffer.encode_uint32(4, static_cast<uint32_t>(this->mode));
1498#ifdef USE_DEVICES
1499 buffer.encode_uint32(5, this->device_id);
1500#endif
1501 buffer.encode_uint32(6, this->state);
1502 buffer.encode_float(7, this->target_temperature_low);
1503 buffer.encode_float(8, this->target_temperature_high);
1504}
1506 size.add_fixed32(1, this->key);
1507 size.add_float(1, this->current_temperature);
1508 size.add_float(1, this->target_temperature);
1509 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1510#ifdef USE_DEVICES
1511 size.add_uint32(1, this->device_id);
1512#endif
1513 size.add_uint32(1, this->state);
1514 size.add_float(1, this->target_temperature_low);
1515 size.add_float(1, this->target_temperature_high);
1516}
1518 switch (field_id) {
1519 case 2:
1520 this->has_fields = value.as_uint32();
1521 break;
1522 case 3:
1523 this->mode = static_cast<enums::WaterHeaterMode>(value.as_uint32());
1524 break;
1525#ifdef USE_DEVICES
1526 case 5:
1527 this->device_id = value.as_uint32();
1528 break;
1529#endif
1530 case 6:
1531 this->state = value.as_uint32();
1532 break;
1533 default:
1534 return false;
1535 }
1536 return true;
1537}
1539 switch (field_id) {
1540 case 1:
1541 this->key = value.as_fixed32();
1542 break;
1543 case 4:
1544 this->target_temperature = value.as_float();
1545 break;
1546 case 7:
1547 this->target_temperature_low = value.as_float();
1548 break;
1549 case 8:
1550 this->target_temperature_high = value.as_float();
1551 break;
1552 default:
1553 return false;
1554 }
1555 return true;
1556}
1557#endif
1558#ifdef USE_NUMBER
1560 buffer.encode_string(1, this->object_id_ref_);
1561 buffer.encode_fixed32(2, this->key);
1562 buffer.encode_string(3, this->name_ref_);
1563#ifdef USE_ENTITY_ICON
1564 buffer.encode_string(5, this->icon_ref_);
1565#endif
1566 buffer.encode_float(6, this->min_value);
1567 buffer.encode_float(7, this->max_value);
1568 buffer.encode_float(8, this->step);
1569 buffer.encode_bool(9, this->disabled_by_default);
1570 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1571 buffer.encode_string(11, this->unit_of_measurement_ref_);
1572 buffer.encode_uint32(12, static_cast<uint32_t>(this->mode));
1573 buffer.encode_string(13, this->device_class_ref_);
1574#ifdef USE_DEVICES
1575 buffer.encode_uint32(14, this->device_id);
1576#endif
1577}
1579 size.add_length(1, this->object_id_ref_.size());
1580 size.add_fixed32(1, this->key);
1581 size.add_length(1, this->name_ref_.size());
1582#ifdef USE_ENTITY_ICON
1583 size.add_length(1, this->icon_ref_.size());
1584#endif
1585 size.add_float(1, this->min_value);
1586 size.add_float(1, this->max_value);
1587 size.add_float(1, this->step);
1588 size.add_bool(1, this->disabled_by_default);
1589 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1590 size.add_length(1, this->unit_of_measurement_ref_.size());
1591 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1592 size.add_length(1, this->device_class_ref_.size());
1593#ifdef USE_DEVICES
1594 size.add_uint32(1, this->device_id);
1595#endif
1596}
1598 buffer.encode_fixed32(1, this->key);
1599 buffer.encode_float(2, this->state);
1600 buffer.encode_bool(3, this->missing_state);
1601#ifdef USE_DEVICES
1602 buffer.encode_uint32(4, this->device_id);
1603#endif
1604}
1606 size.add_fixed32(1, this->key);
1607 size.add_float(1, this->state);
1608 size.add_bool(1, this->missing_state);
1609#ifdef USE_DEVICES
1610 size.add_uint32(1, this->device_id);
1611#endif
1612}
1613bool NumberCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1614 switch (field_id) {
1615#ifdef USE_DEVICES
1616 case 3:
1617 this->device_id = value.as_uint32();
1618 break;
1619#endif
1620 default:
1621 return false;
1622 }
1623 return true;
1624}
1625bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1626 switch (field_id) {
1627 case 1:
1628 this->key = value.as_fixed32();
1629 break;
1630 case 2:
1631 this->state = value.as_float();
1632 break;
1633 default:
1634 return false;
1635 }
1636 return true;
1637}
1638#endif
1639#ifdef USE_SELECT
1641 buffer.encode_string(1, this->object_id_ref_);
1642 buffer.encode_fixed32(2, this->key);
1643 buffer.encode_string(3, this->name_ref_);
1644#ifdef USE_ENTITY_ICON
1645 buffer.encode_string(5, this->icon_ref_);
1646#endif
1647 for (const char *it : *this->options) {
1648 buffer.encode_string(6, it, strlen(it), true);
1649 }
1650 buffer.encode_bool(7, this->disabled_by_default);
1651 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
1652#ifdef USE_DEVICES
1653 buffer.encode_uint32(9, this->device_id);
1654#endif
1655}
1657 size.add_length(1, this->object_id_ref_.size());
1658 size.add_fixed32(1, this->key);
1659 size.add_length(1, this->name_ref_.size());
1660#ifdef USE_ENTITY_ICON
1661 size.add_length(1, this->icon_ref_.size());
1662#endif
1663 if (!this->options->empty()) {
1664 for (const char *it : *this->options) {
1665 size.add_length_force(1, strlen(it));
1666 }
1667 }
1668 size.add_bool(1, this->disabled_by_default);
1669 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1670#ifdef USE_DEVICES
1671 size.add_uint32(1, this->device_id);
1672#endif
1673}
1675 buffer.encode_fixed32(1, this->key);
1676 buffer.encode_string(2, this->state_ref_);
1677 buffer.encode_bool(3, this->missing_state);
1678#ifdef USE_DEVICES
1679 buffer.encode_uint32(4, this->device_id);
1680#endif
1681}
1683 size.add_fixed32(1, this->key);
1684 size.add_length(1, this->state_ref_.size());
1685 size.add_bool(1, this->missing_state);
1686#ifdef USE_DEVICES
1687 size.add_uint32(1, this->device_id);
1688#endif
1689}
1690bool SelectCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1691 switch (field_id) {
1692#ifdef USE_DEVICES
1693 case 3:
1694 this->device_id = value.as_uint32();
1695 break;
1696#endif
1697 default:
1698 return false;
1699 }
1700 return true;
1701}
1703 switch (field_id) {
1704 case 2: {
1705 // Use raw data directly to avoid allocation
1706 this->state = value.data();
1707 this->state_len = value.size();
1708 break;
1709 }
1710 default:
1711 return false;
1712 }
1713 return true;
1714}
1715bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1716 switch (field_id) {
1717 case 1:
1718 this->key = value.as_fixed32();
1719 break;
1720 default:
1721 return false;
1722 }
1723 return true;
1724}
1725#endif
1726#ifdef USE_SIREN
1728 buffer.encode_string(1, this->object_id_ref_);
1729 buffer.encode_fixed32(2, this->key);
1730 buffer.encode_string(3, this->name_ref_);
1731#ifdef USE_ENTITY_ICON
1732 buffer.encode_string(5, this->icon_ref_);
1733#endif
1734 buffer.encode_bool(6, this->disabled_by_default);
1735 for (auto &it : this->tones) {
1736 buffer.encode_string(7, it, true);
1737 }
1738 buffer.encode_bool(8, this->supports_duration);
1739 buffer.encode_bool(9, this->supports_volume);
1740 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1741#ifdef USE_DEVICES
1742 buffer.encode_uint32(11, this->device_id);
1743#endif
1744}
1746 size.add_length(1, this->object_id_ref_.size());
1747 size.add_fixed32(1, this->key);
1748 size.add_length(1, this->name_ref_.size());
1749#ifdef USE_ENTITY_ICON
1750 size.add_length(1, this->icon_ref_.size());
1751#endif
1752 size.add_bool(1, this->disabled_by_default);
1753 if (!this->tones.empty()) {
1754 for (const auto &it : this->tones) {
1755 size.add_length_force(1, it.size());
1756 }
1757 }
1758 size.add_bool(1, this->supports_duration);
1759 size.add_bool(1, this->supports_volume);
1760 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1761#ifdef USE_DEVICES
1762 size.add_uint32(1, this->device_id);
1763#endif
1764}
1766 buffer.encode_fixed32(1, this->key);
1767 buffer.encode_bool(2, this->state);
1768#ifdef USE_DEVICES
1769 buffer.encode_uint32(3, this->device_id);
1770#endif
1771}
1773 size.add_fixed32(1, this->key);
1774 size.add_bool(1, this->state);
1775#ifdef USE_DEVICES
1776 size.add_uint32(1, this->device_id);
1777#endif
1778}
1779bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1780 switch (field_id) {
1781 case 2:
1782 this->has_state = value.as_bool();
1783 break;
1784 case 3:
1785 this->state = value.as_bool();
1786 break;
1787 case 4:
1788 this->has_tone = value.as_bool();
1789 break;
1790 case 6:
1791 this->has_duration = value.as_bool();
1792 break;
1793 case 7:
1794 this->duration = value.as_uint32();
1795 break;
1796 case 8:
1797 this->has_volume = value.as_bool();
1798 break;
1799#ifdef USE_DEVICES
1800 case 10:
1801 this->device_id = value.as_uint32();
1802 break;
1803#endif
1804 default:
1805 return false;
1806 }
1807 return true;
1808}
1810 switch (field_id) {
1811 case 5:
1812 this->tone = value.as_string();
1813 break;
1814 default:
1815 return false;
1816 }
1817 return true;
1818}
1819bool SirenCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1820 switch (field_id) {
1821 case 1:
1822 this->key = value.as_fixed32();
1823 break;
1824 case 9:
1825 this->volume = value.as_float();
1826 break;
1827 default:
1828 return false;
1829 }
1830 return true;
1831}
1832#endif
1833#ifdef USE_LOCK
1835 buffer.encode_string(1, this->object_id_ref_);
1836 buffer.encode_fixed32(2, this->key);
1837 buffer.encode_string(3, this->name_ref_);
1838#ifdef USE_ENTITY_ICON
1839 buffer.encode_string(5, this->icon_ref_);
1840#endif
1841 buffer.encode_bool(6, this->disabled_by_default);
1842 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1843 buffer.encode_bool(8, this->assumed_state);
1844 buffer.encode_bool(9, this->supports_open);
1845 buffer.encode_bool(10, this->requires_code);
1846 buffer.encode_string(11, this->code_format_ref_);
1847#ifdef USE_DEVICES
1848 buffer.encode_uint32(12, this->device_id);
1849#endif
1850}
1852 size.add_length(1, this->object_id_ref_.size());
1853 size.add_fixed32(1, this->key);
1854 size.add_length(1, this->name_ref_.size());
1855#ifdef USE_ENTITY_ICON
1856 size.add_length(1, this->icon_ref_.size());
1857#endif
1858 size.add_bool(1, this->disabled_by_default);
1859 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1860 size.add_bool(1, this->assumed_state);
1861 size.add_bool(1, this->supports_open);
1862 size.add_bool(1, this->requires_code);
1863 size.add_length(1, this->code_format_ref_.size());
1864#ifdef USE_DEVICES
1865 size.add_uint32(1, this->device_id);
1866#endif
1867}
1869 buffer.encode_fixed32(1, this->key);
1870 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
1871#ifdef USE_DEVICES
1872 buffer.encode_uint32(3, this->device_id);
1873#endif
1874}
1876 size.add_fixed32(1, this->key);
1877 size.add_uint32(1, static_cast<uint32_t>(this->state));
1878#ifdef USE_DEVICES
1879 size.add_uint32(1, this->device_id);
1880#endif
1881}
1882bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1883 switch (field_id) {
1884 case 2:
1885 this->command = static_cast<enums::LockCommand>(value.as_uint32());
1886 break;
1887 case 3:
1888 this->has_code = value.as_bool();
1889 break;
1890#ifdef USE_DEVICES
1891 case 5:
1892 this->device_id = value.as_uint32();
1893 break;
1894#endif
1895 default:
1896 return false;
1897 }
1898 return true;
1899}
1901 switch (field_id) {
1902 case 4:
1903 this->code = value.as_string();
1904 break;
1905 default:
1906 return false;
1907 }
1908 return true;
1909}
1910bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1911 switch (field_id) {
1912 case 1:
1913 this->key = value.as_fixed32();
1914 break;
1915 default:
1916 return false;
1917 }
1918 return true;
1919}
1920#endif
1921#ifdef USE_BUTTON
1923 buffer.encode_string(1, this->object_id_ref_);
1924 buffer.encode_fixed32(2, this->key);
1925 buffer.encode_string(3, this->name_ref_);
1926#ifdef USE_ENTITY_ICON
1927 buffer.encode_string(5, this->icon_ref_);
1928#endif
1929 buffer.encode_bool(6, this->disabled_by_default);
1930 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1931 buffer.encode_string(8, this->device_class_ref_);
1932#ifdef USE_DEVICES
1933 buffer.encode_uint32(9, this->device_id);
1934#endif
1935}
1937 size.add_length(1, this->object_id_ref_.size());
1938 size.add_fixed32(1, this->key);
1939 size.add_length(1, this->name_ref_.size());
1940#ifdef USE_ENTITY_ICON
1941 size.add_length(1, this->icon_ref_.size());
1942#endif
1943 size.add_bool(1, this->disabled_by_default);
1944 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1945 size.add_length(1, this->device_class_ref_.size());
1946#ifdef USE_DEVICES
1947 size.add_uint32(1, this->device_id);
1948#endif
1949}
1950bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1951 switch (field_id) {
1952#ifdef USE_DEVICES
1953 case 2:
1954 this->device_id = value.as_uint32();
1955 break;
1956#endif
1957 default:
1958 return false;
1959 }
1960 return true;
1961}
1962bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1963 switch (field_id) {
1964 case 1:
1965 this->key = value.as_fixed32();
1966 break;
1967 default:
1968 return false;
1969 }
1970 return true;
1971}
1972#endif
1973#ifdef USE_MEDIA_PLAYER
1975 buffer.encode_string(1, this->format_ref_);
1976 buffer.encode_uint32(2, this->sample_rate);
1977 buffer.encode_uint32(3, this->num_channels);
1978 buffer.encode_uint32(4, static_cast<uint32_t>(this->purpose));
1979 buffer.encode_uint32(5, this->sample_bytes);
1980}
1982 size.add_length(1, this->format_ref_.size());
1983 size.add_uint32(1, this->sample_rate);
1984 size.add_uint32(1, this->num_channels);
1985 size.add_uint32(1, static_cast<uint32_t>(this->purpose));
1986 size.add_uint32(1, this->sample_bytes);
1987}
1989 buffer.encode_string(1, this->object_id_ref_);
1990 buffer.encode_fixed32(2, this->key);
1991 buffer.encode_string(3, this->name_ref_);
1992#ifdef USE_ENTITY_ICON
1993 buffer.encode_string(5, this->icon_ref_);
1994#endif
1995 buffer.encode_bool(6, this->disabled_by_default);
1996 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1997 buffer.encode_bool(8, this->supports_pause);
1998 for (auto &it : this->supported_formats) {
1999 buffer.encode_message(9, it);
2000 }
2001#ifdef USE_DEVICES
2002 buffer.encode_uint32(10, this->device_id);
2003#endif
2004 buffer.encode_uint32(11, this->feature_flags);
2005}
2007 size.add_length(1, this->object_id_ref_.size());
2008 size.add_fixed32(1, this->key);
2009 size.add_length(1, this->name_ref_.size());
2010#ifdef USE_ENTITY_ICON
2011 size.add_length(1, this->icon_ref_.size());
2012#endif
2013 size.add_bool(1, this->disabled_by_default);
2014 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2015 size.add_bool(1, this->supports_pause);
2017#ifdef USE_DEVICES
2018 size.add_uint32(1, this->device_id);
2019#endif
2020 size.add_uint32(1, this->feature_flags);
2021}
2023 buffer.encode_fixed32(1, this->key);
2024 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
2025 buffer.encode_float(3, this->volume);
2026 buffer.encode_bool(4, this->muted);
2027#ifdef USE_DEVICES
2028 buffer.encode_uint32(5, this->device_id);
2029#endif
2030}
2032 size.add_fixed32(1, this->key);
2033 size.add_uint32(1, static_cast<uint32_t>(this->state));
2034 size.add_float(1, this->volume);
2035 size.add_bool(1, this->muted);
2036#ifdef USE_DEVICES
2037 size.add_uint32(1, this->device_id);
2038#endif
2039}
2041 switch (field_id) {
2042 case 2:
2043 this->has_command = value.as_bool();
2044 break;
2045 case 3:
2046 this->command = static_cast<enums::MediaPlayerCommand>(value.as_uint32());
2047 break;
2048 case 4:
2049 this->has_volume = value.as_bool();
2050 break;
2051 case 6:
2052 this->has_media_url = value.as_bool();
2053 break;
2054 case 8:
2055 this->has_announcement = value.as_bool();
2056 break;
2057 case 9:
2058 this->announcement = value.as_bool();
2059 break;
2060#ifdef USE_DEVICES
2061 case 10:
2062 this->device_id = value.as_uint32();
2063 break;
2064#endif
2065 default:
2066 return false;
2067 }
2068 return true;
2069}
2071 switch (field_id) {
2072 case 7:
2073 this->media_url = value.as_string();
2074 break;
2075 default:
2076 return false;
2077 }
2078 return true;
2079}
2081 switch (field_id) {
2082 case 1:
2083 this->key = value.as_fixed32();
2084 break;
2085 case 5:
2086 this->volume = value.as_float();
2087 break;
2088 default:
2089 return false;
2090 }
2091 return true;
2092}
2093#endif
2094#ifdef USE_BLUETOOTH_PROXY
2096 switch (field_id) {
2097 case 1:
2098 this->flags = value.as_uint32();
2099 break;
2100 default:
2101 return false;
2102 }
2103 return true;
2104}
2106 buffer.encode_uint64(1, this->address);
2107 buffer.encode_sint32(2, this->rssi);
2108 buffer.encode_uint32(3, this->address_type);
2109 buffer.encode_bytes(4, this->data, this->data_len);
2110}
2112 size.add_uint64(1, this->address);
2113 size.add_sint32(1, this->rssi);
2114 size.add_uint32(1, this->address_type);
2115 size.add_length(1, this->data_len);
2116}
2118 for (uint16_t i = 0; i < this->advertisements_len; i++) {
2119 buffer.encode_message(1, this->advertisements[i]);
2120 }
2121}
2123 for (uint16_t i = 0; i < this->advertisements_len; i++) {
2124 size.add_message_object_force(1, this->advertisements[i]);
2125 }
2126}
2128 switch (field_id) {
2129 case 1:
2130 this->address = value.as_uint64();
2131 break;
2132 case 2:
2133 this->request_type = static_cast<enums::BluetoothDeviceRequestType>(value.as_uint32());
2134 break;
2135 case 3:
2136 this->has_address_type = value.as_bool();
2137 break;
2138 case 4:
2139 this->address_type = value.as_uint32();
2140 break;
2141 default:
2142 return false;
2143 }
2144 return true;
2145}
2147 buffer.encode_uint64(1, this->address);
2148 buffer.encode_bool(2, this->connected);
2149 buffer.encode_uint32(3, this->mtu);
2150 buffer.encode_int32(4, this->error);
2151}
2153 size.add_uint64(1, this->address);
2154 size.add_bool(1, this->connected);
2155 size.add_uint32(1, this->mtu);
2156 size.add_int32(1, this->error);
2157}
2159 switch (field_id) {
2160 case 1:
2161 this->address = value.as_uint64();
2162 break;
2163 default:
2164 return false;
2165 }
2166 return true;
2167}
2169 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2170 buffer.encode_uint64(1, this->uuid[0], true);
2171 buffer.encode_uint64(1, this->uuid[1], true);
2172 }
2173 buffer.encode_uint32(2, this->handle);
2174 buffer.encode_uint32(3, this->short_uuid);
2175}
2177 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2178 size.add_uint64_force(1, this->uuid[0]);
2179 size.add_uint64_force(1, this->uuid[1]);
2180 }
2181 size.add_uint32(1, this->handle);
2182 size.add_uint32(1, this->short_uuid);
2183}
2185 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2186 buffer.encode_uint64(1, this->uuid[0], true);
2187 buffer.encode_uint64(1, this->uuid[1], true);
2188 }
2189 buffer.encode_uint32(2, this->handle);
2190 buffer.encode_uint32(3, this->properties);
2191 for (auto &it : this->descriptors) {
2192 buffer.encode_message(4, it);
2193 }
2194 buffer.encode_uint32(5, this->short_uuid);
2195}
2197 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2198 size.add_uint64_force(1, this->uuid[0]);
2199 size.add_uint64_force(1, this->uuid[1]);
2200 }
2201 size.add_uint32(1, this->handle);
2202 size.add_uint32(1, this->properties);
2203 size.add_repeated_message(1, this->descriptors);
2204 size.add_uint32(1, this->short_uuid);
2205}
2207 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2208 buffer.encode_uint64(1, this->uuid[0], true);
2209 buffer.encode_uint64(1, this->uuid[1], true);
2210 }
2211 buffer.encode_uint32(2, this->handle);
2212 for (auto &it : this->characteristics) {
2213 buffer.encode_message(3, it);
2214 }
2215 buffer.encode_uint32(4, this->short_uuid);
2216}
2218 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2219 size.add_uint64_force(1, this->uuid[0]);
2220 size.add_uint64_force(1, this->uuid[1]);
2221 }
2222 size.add_uint32(1, this->handle);
2224 size.add_uint32(1, this->short_uuid);
2225}
2227 buffer.encode_uint64(1, this->address);
2228 for (auto &it : this->services) {
2229 buffer.encode_message(2, it);
2230 }
2231}
2233 size.add_uint64(1, this->address);
2234 size.add_repeated_message(1, this->services);
2235}
2241 switch (field_id) {
2242 case 1:
2243 this->address = value.as_uint64();
2244 break;
2245 case 2:
2246 this->handle = value.as_uint32();
2247 break;
2248 default:
2249 return false;
2250 }
2251 return true;
2252}
2254 buffer.encode_uint64(1, this->address);
2255 buffer.encode_uint32(2, this->handle);
2256 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2257}
2259 size.add_uint64(1, this->address);
2260 size.add_uint32(1, this->handle);
2261 size.add_length(1, this->data_len_);
2262}
2264 switch (field_id) {
2265 case 1:
2266 this->address = value.as_uint64();
2267 break;
2268 case 2:
2269 this->handle = value.as_uint32();
2270 break;
2271 case 3:
2272 this->response = value.as_bool();
2273 break;
2274 default:
2275 return false;
2276 }
2277 return true;
2278}
2280 switch (field_id) {
2281 case 4: {
2282 // Use raw data directly to avoid allocation
2283 this->data = value.data();
2284 this->data_len = value.size();
2285 break;
2286 }
2287 default:
2288 return false;
2289 }
2290 return true;
2291}
2293 switch (field_id) {
2294 case 1:
2295 this->address = value.as_uint64();
2296 break;
2297 case 2:
2298 this->handle = value.as_uint32();
2299 break;
2300 default:
2301 return false;
2302 }
2303 return true;
2304}
2306 switch (field_id) {
2307 case 1:
2308 this->address = value.as_uint64();
2309 break;
2310 case 2:
2311 this->handle = value.as_uint32();
2312 break;
2313 default:
2314 return false;
2315 }
2316 return true;
2317}
2319 switch (field_id) {
2320 case 3: {
2321 // Use raw data directly to avoid allocation
2322 this->data = value.data();
2323 this->data_len = value.size();
2324 break;
2325 }
2326 default:
2327 return false;
2328 }
2329 return true;
2330}
2332 switch (field_id) {
2333 case 1:
2334 this->address = value.as_uint64();
2335 break;
2336 case 2:
2337 this->handle = value.as_uint32();
2338 break;
2339 case 3:
2340 this->enable = value.as_bool();
2341 break;
2342 default:
2343 return false;
2344 }
2345 return true;
2346}
2348 buffer.encode_uint64(1, this->address);
2349 buffer.encode_uint32(2, this->handle);
2350 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2351}
2353 size.add_uint64(1, this->address);
2354 size.add_uint32(1, this->handle);
2355 size.add_length(1, this->data_len_);
2356}
2358 buffer.encode_uint32(1, this->free);
2359 buffer.encode_uint32(2, this->limit);
2360 for (const auto &it : this->allocated) {
2361 if (it != 0) {
2362 buffer.encode_uint64(3, it, true);
2363 }
2364 }
2365}
2367 size.add_uint32(1, this->free);
2368 size.add_uint32(1, this->limit);
2369 for (const auto &it : this->allocated) {
2370 if (it != 0) {
2371 size.add_uint64_force(1, it);
2372 }
2373 }
2374}
2376 buffer.encode_uint64(1, this->address);
2377 buffer.encode_uint32(2, this->handle);
2378 buffer.encode_int32(3, this->error);
2379}
2381 size.add_uint64(1, this->address);
2382 size.add_uint32(1, this->handle);
2383 size.add_int32(1, this->error);
2384}
2386 buffer.encode_uint64(1, this->address);
2387 buffer.encode_uint32(2, this->handle);
2388}
2390 size.add_uint64(1, this->address);
2391 size.add_uint32(1, this->handle);
2392}
2394 buffer.encode_uint64(1, this->address);
2395 buffer.encode_uint32(2, this->handle);
2396}
2398 size.add_uint64(1, this->address);
2399 size.add_uint32(1, this->handle);
2400}
2402 buffer.encode_uint64(1, this->address);
2403 buffer.encode_bool(2, this->paired);
2404 buffer.encode_int32(3, this->error);
2405}
2407 size.add_uint64(1, this->address);
2408 size.add_bool(1, this->paired);
2409 size.add_int32(1, this->error);
2410}
2412 buffer.encode_uint64(1, this->address);
2413 buffer.encode_bool(2, this->success);
2414 buffer.encode_int32(3, this->error);
2415}
2417 size.add_uint64(1, this->address);
2418 size.add_bool(1, this->success);
2419 size.add_int32(1, this->error);
2420}
2422 buffer.encode_uint64(1, this->address);
2423 buffer.encode_bool(2, this->success);
2424 buffer.encode_int32(3, this->error);
2425}
2427 size.add_uint64(1, this->address);
2428 size.add_bool(1, this->success);
2429 size.add_int32(1, this->error);
2430}
2432 buffer.encode_uint32(1, static_cast<uint32_t>(this->state));
2433 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
2434 buffer.encode_uint32(3, static_cast<uint32_t>(this->configured_mode));
2435}
2437 size.add_uint32(1, static_cast<uint32_t>(this->state));
2438 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2439 size.add_uint32(1, static_cast<uint32_t>(this->configured_mode));
2440}
2442 switch (field_id) {
2443 case 1:
2444 this->mode = static_cast<enums::BluetoothScannerMode>(value.as_uint32());
2445 break;
2446 default:
2447 return false;
2448 }
2449 return true;
2450}
2451#endif
2452#ifdef USE_VOICE_ASSISTANT
2454 switch (field_id) {
2455 case 1:
2456 this->subscribe = value.as_bool();
2457 break;
2458 case 2:
2459 this->flags = value.as_uint32();
2460 break;
2461 default:
2462 return false;
2463 }
2464 return true;
2465}
2467 buffer.encode_uint32(1, this->noise_suppression_level);
2468 buffer.encode_uint32(2, this->auto_gain);
2469 buffer.encode_float(3, this->volume_multiplier);
2470}
2472 size.add_uint32(1, this->noise_suppression_level);
2473 size.add_uint32(1, this->auto_gain);
2474 size.add_float(1, this->volume_multiplier);
2475}
2477 buffer.encode_bool(1, this->start);
2478 buffer.encode_string(2, this->conversation_id_ref_);
2479 buffer.encode_uint32(3, this->flags);
2480 buffer.encode_message(4, this->audio_settings);
2481 buffer.encode_string(5, this->wake_word_phrase_ref_);
2482}
2484 size.add_bool(1, this->start);
2485 size.add_length(1, this->conversation_id_ref_.size());
2486 size.add_uint32(1, this->flags);
2487 size.add_message_object(1, this->audio_settings);
2488 size.add_length(1, this->wake_word_phrase_ref_.size());
2489}
2491 switch (field_id) {
2492 case 1:
2493 this->port = value.as_uint32();
2494 break;
2495 case 2:
2496 this->error = value.as_bool();
2497 break;
2498 default:
2499 return false;
2500 }
2501 return true;
2502}
2504 switch (field_id) {
2505 case 1:
2506 this->name = value.as_string();
2507 break;
2508 case 2:
2509 this->value = value.as_string();
2510 break;
2511 default:
2512 return false;
2513 }
2514 return true;
2515}
2517 switch (field_id) {
2518 case 1:
2519 this->event_type = static_cast<enums::VoiceAssistantEvent>(value.as_uint32());
2520 break;
2521 default:
2522 return false;
2523 }
2524 return true;
2525}
2527 switch (field_id) {
2528 case 2:
2529 this->data.emplace_back();
2530 value.decode_to_message(this->data.back());
2531 break;
2532 default:
2533 return false;
2534 }
2535 return true;
2536}
2537bool VoiceAssistantAudio::decode_varint(uint32_t field_id, ProtoVarInt value) {
2538 switch (field_id) {
2539 case 2:
2540 this->end = value.as_bool();
2541 break;
2542 default:
2543 return false;
2544 }
2545 return true;
2546}
2548 switch (field_id) {
2549 case 1:
2550 this->data = value.as_string();
2551 break;
2552 default:
2553 return false;
2554 }
2555 return true;
2556}
2558 buffer.encode_bytes(1, this->data_ptr_, this->data_len_);
2559 buffer.encode_bool(2, this->end);
2560}
2562 size.add_length(1, this->data_len_);
2563 size.add_bool(1, this->end);
2564}
2566 switch (field_id) {
2567 case 1:
2568 this->event_type = static_cast<enums::VoiceAssistantTimerEvent>(value.as_uint32());
2569 break;
2570 case 4:
2571 this->total_seconds = value.as_uint32();
2572 break;
2573 case 5:
2574 this->seconds_left = value.as_uint32();
2575 break;
2576 case 6:
2577 this->is_active = value.as_bool();
2578 break;
2579 default:
2580 return false;
2581 }
2582 return true;
2583}
2585 switch (field_id) {
2586 case 2:
2587 this->timer_id = value.as_string();
2588 break;
2589 case 3:
2590 this->name = value.as_string();
2591 break;
2592 default:
2593 return false;
2594 }
2595 return true;
2596}
2598 switch (field_id) {
2599 case 4:
2600 this->start_conversation = value.as_bool();
2601 break;
2602 default:
2603 return false;
2604 }
2605 return true;
2606}
2608 switch (field_id) {
2609 case 1:
2610 this->media_id = value.as_string();
2611 break;
2612 case 2:
2613 this->text = value.as_string();
2614 break;
2615 case 3:
2616 this->preannounce_media_id = value.as_string();
2617 break;
2618 default:
2619 return false;
2620 }
2621 return true;
2622}
2626 buffer.encode_string(1, this->id_ref_);
2627 buffer.encode_string(2, this->wake_word_ref_);
2628 for (auto &it : this->trained_languages) {
2629 buffer.encode_string(3, it, true);
2630 }
2631}
2633 size.add_length(1, this->id_ref_.size());
2634 size.add_length(1, this->wake_word_ref_.size());
2635 if (!this->trained_languages.empty()) {
2636 for (const auto &it : this->trained_languages) {
2637 size.add_length_force(1, it.size());
2638 }
2639 }
2640}
2642 switch (field_id) {
2643 case 5:
2644 this->model_size = value.as_uint32();
2645 break;
2646 default:
2647 return false;
2648 }
2649 return true;
2650}
2652 switch (field_id) {
2653 case 1:
2654 this->id = value.as_string();
2655 break;
2656 case 2:
2657 this->wake_word = value.as_string();
2658 break;
2659 case 3:
2660 this->trained_languages.push_back(value.as_string());
2661 break;
2662 case 4:
2663 this->model_type = value.as_string();
2664 break;
2665 case 6:
2666 this->model_hash = value.as_string();
2667 break;
2668 case 7:
2669 this->url = value.as_string();
2670 break;
2671 default:
2672 return false;
2673 }
2674 return true;
2675}
2677 switch (field_id) {
2678 case 1:
2679 this->external_wake_words.emplace_back();
2680 value.decode_to_message(this->external_wake_words.back());
2681 break;
2682 default:
2683 return false;
2684 }
2685 return true;
2686}
2688 for (auto &it : this->available_wake_words) {
2689 buffer.encode_message(1, it);
2690 }
2691 for (const auto &it : *this->active_wake_words) {
2692 buffer.encode_string(2, it, true);
2693 }
2694 buffer.encode_uint32(3, this->max_active_wake_words);
2695}
2698 if (!this->active_wake_words->empty()) {
2699 for (const auto &it : *this->active_wake_words) {
2700 size.add_length_force(1, it.size());
2701 }
2702 }
2703 size.add_uint32(1, this->max_active_wake_words);
2704}
2706 switch (field_id) {
2707 case 1:
2708 this->active_wake_words.push_back(value.as_string());
2709 break;
2710 default:
2711 return false;
2712 }
2713 return true;
2714}
2715#endif
2716#ifdef USE_ALARM_CONTROL_PANEL
2718 buffer.encode_string(1, this->object_id_ref_);
2719 buffer.encode_fixed32(2, this->key);
2720 buffer.encode_string(3, this->name_ref_);
2721#ifdef USE_ENTITY_ICON
2722 buffer.encode_string(5, this->icon_ref_);
2723#endif
2724 buffer.encode_bool(6, this->disabled_by_default);
2725 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2726 buffer.encode_uint32(8, this->supported_features);
2727 buffer.encode_bool(9, this->requires_code);
2728 buffer.encode_bool(10, this->requires_code_to_arm);
2729#ifdef USE_DEVICES
2730 buffer.encode_uint32(11, this->device_id);
2731#endif
2732}
2734 size.add_length(1, this->object_id_ref_.size());
2735 size.add_fixed32(1, this->key);
2736 size.add_length(1, this->name_ref_.size());
2737#ifdef USE_ENTITY_ICON
2738 size.add_length(1, this->icon_ref_.size());
2739#endif
2740 size.add_bool(1, this->disabled_by_default);
2741 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2742 size.add_uint32(1, this->supported_features);
2743 size.add_bool(1, this->requires_code);
2744 size.add_bool(1, this->requires_code_to_arm);
2745#ifdef USE_DEVICES
2746 size.add_uint32(1, this->device_id);
2747#endif
2748}
2750 buffer.encode_fixed32(1, this->key);
2751 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
2752#ifdef USE_DEVICES
2753 buffer.encode_uint32(3, this->device_id);
2754#endif
2755}
2757 size.add_fixed32(1, this->key);
2758 size.add_uint32(1, static_cast<uint32_t>(this->state));
2759#ifdef USE_DEVICES
2760 size.add_uint32(1, this->device_id);
2761#endif
2762}
2764 switch (field_id) {
2765 case 2:
2766 this->command = static_cast<enums::AlarmControlPanelStateCommand>(value.as_uint32());
2767 break;
2768#ifdef USE_DEVICES
2769 case 4:
2770 this->device_id = value.as_uint32();
2771 break;
2772#endif
2773 default:
2774 return false;
2775 }
2776 return true;
2777}
2779 switch (field_id) {
2780 case 3:
2781 this->code = value.as_string();
2782 break;
2783 default:
2784 return false;
2785 }
2786 return true;
2787}
2789 switch (field_id) {
2790 case 1:
2791 this->key = value.as_fixed32();
2792 break;
2793 default:
2794 return false;
2795 }
2796 return true;
2797}
2798#endif
2799#ifdef USE_TEXT
2801 buffer.encode_string(1, this->object_id_ref_);
2802 buffer.encode_fixed32(2, this->key);
2803 buffer.encode_string(3, this->name_ref_);
2804#ifdef USE_ENTITY_ICON
2805 buffer.encode_string(5, this->icon_ref_);
2806#endif
2807 buffer.encode_bool(6, this->disabled_by_default);
2808 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2809 buffer.encode_uint32(8, this->min_length);
2810 buffer.encode_uint32(9, this->max_length);
2811 buffer.encode_string(10, this->pattern_ref_);
2812 buffer.encode_uint32(11, static_cast<uint32_t>(this->mode));
2813#ifdef USE_DEVICES
2814 buffer.encode_uint32(12, this->device_id);
2815#endif
2816}
2818 size.add_length(1, this->object_id_ref_.size());
2819 size.add_fixed32(1, this->key);
2820 size.add_length(1, this->name_ref_.size());
2821#ifdef USE_ENTITY_ICON
2822 size.add_length(1, this->icon_ref_.size());
2823#endif
2824 size.add_bool(1, this->disabled_by_default);
2825 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2826 size.add_uint32(1, this->min_length);
2827 size.add_uint32(1, this->max_length);
2828 size.add_length(1, this->pattern_ref_.size());
2829 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2830#ifdef USE_DEVICES
2831 size.add_uint32(1, this->device_id);
2832#endif
2833}
2835 buffer.encode_fixed32(1, this->key);
2836 buffer.encode_string(2, this->state_ref_);
2837 buffer.encode_bool(3, this->missing_state);
2838#ifdef USE_DEVICES
2839 buffer.encode_uint32(4, this->device_id);
2840#endif
2841}
2843 size.add_fixed32(1, this->key);
2844 size.add_length(1, this->state_ref_.size());
2845 size.add_bool(1, this->missing_state);
2846#ifdef USE_DEVICES
2847 size.add_uint32(1, this->device_id);
2848#endif
2849}
2850bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2851 switch (field_id) {
2852#ifdef USE_DEVICES
2853 case 3:
2854 this->device_id = value.as_uint32();
2855 break;
2856#endif
2857 default:
2858 return false;
2859 }
2860 return true;
2861}
2863 switch (field_id) {
2864 case 2:
2865 this->state = value.as_string();
2866 break;
2867 default:
2868 return false;
2869 }
2870 return true;
2871}
2872bool TextCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2873 switch (field_id) {
2874 case 1:
2875 this->key = value.as_fixed32();
2876 break;
2877 default:
2878 return false;
2879 }
2880 return true;
2881}
2882#endif
2883#ifdef USE_DATETIME_DATE
2885 buffer.encode_string(1, this->object_id_ref_);
2886 buffer.encode_fixed32(2, this->key);
2887 buffer.encode_string(3, this->name_ref_);
2888#ifdef USE_ENTITY_ICON
2889 buffer.encode_string(5, this->icon_ref_);
2890#endif
2891 buffer.encode_bool(6, this->disabled_by_default);
2892 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2893#ifdef USE_DEVICES
2894 buffer.encode_uint32(8, this->device_id);
2895#endif
2896}
2898 size.add_length(1, this->object_id_ref_.size());
2899 size.add_fixed32(1, this->key);
2900 size.add_length(1, this->name_ref_.size());
2901#ifdef USE_ENTITY_ICON
2902 size.add_length(1, this->icon_ref_.size());
2903#endif
2904 size.add_bool(1, this->disabled_by_default);
2905 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2906#ifdef USE_DEVICES
2907 size.add_uint32(1, this->device_id);
2908#endif
2909}
2911 buffer.encode_fixed32(1, this->key);
2912 buffer.encode_bool(2, this->missing_state);
2913 buffer.encode_uint32(3, this->year);
2914 buffer.encode_uint32(4, this->month);
2915 buffer.encode_uint32(5, this->day);
2916#ifdef USE_DEVICES
2917 buffer.encode_uint32(6, this->device_id);
2918#endif
2919}
2921 size.add_fixed32(1, this->key);
2922 size.add_bool(1, this->missing_state);
2923 size.add_uint32(1, this->year);
2924 size.add_uint32(1, this->month);
2925 size.add_uint32(1, this->day);
2926#ifdef USE_DEVICES
2927 size.add_uint32(1, this->device_id);
2928#endif
2929}
2930bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2931 switch (field_id) {
2932 case 2:
2933 this->year = value.as_uint32();
2934 break;
2935 case 3:
2936 this->month = value.as_uint32();
2937 break;
2938 case 4:
2939 this->day = value.as_uint32();
2940 break;
2941#ifdef USE_DEVICES
2942 case 5:
2943 this->device_id = value.as_uint32();
2944 break;
2945#endif
2946 default:
2947 return false;
2948 }
2949 return true;
2950}
2951bool DateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2952 switch (field_id) {
2953 case 1:
2954 this->key = value.as_fixed32();
2955 break;
2956 default:
2957 return false;
2958 }
2959 return true;
2960}
2961#endif
2962#ifdef USE_DATETIME_TIME
2964 buffer.encode_string(1, this->object_id_ref_);
2965 buffer.encode_fixed32(2, this->key);
2966 buffer.encode_string(3, this->name_ref_);
2967#ifdef USE_ENTITY_ICON
2968 buffer.encode_string(5, this->icon_ref_);
2969#endif
2970 buffer.encode_bool(6, this->disabled_by_default);
2971 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2972#ifdef USE_DEVICES
2973 buffer.encode_uint32(8, this->device_id);
2974#endif
2975}
2977 size.add_length(1, this->object_id_ref_.size());
2978 size.add_fixed32(1, this->key);
2979 size.add_length(1, this->name_ref_.size());
2980#ifdef USE_ENTITY_ICON
2981 size.add_length(1, this->icon_ref_.size());
2982#endif
2983 size.add_bool(1, this->disabled_by_default);
2984 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2985#ifdef USE_DEVICES
2986 size.add_uint32(1, this->device_id);
2987#endif
2988}
2990 buffer.encode_fixed32(1, this->key);
2991 buffer.encode_bool(2, this->missing_state);
2992 buffer.encode_uint32(3, this->hour);
2993 buffer.encode_uint32(4, this->minute);
2994 buffer.encode_uint32(5, this->second);
2995#ifdef USE_DEVICES
2996 buffer.encode_uint32(6, this->device_id);
2997#endif
2998}
3000 size.add_fixed32(1, this->key);
3001 size.add_bool(1, this->missing_state);
3002 size.add_uint32(1, this->hour);
3003 size.add_uint32(1, this->minute);
3004 size.add_uint32(1, this->second);
3005#ifdef USE_DEVICES
3006 size.add_uint32(1, this->device_id);
3007#endif
3008}
3009bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3010 switch (field_id) {
3011 case 2:
3012 this->hour = value.as_uint32();
3013 break;
3014 case 3:
3015 this->minute = value.as_uint32();
3016 break;
3017 case 4:
3018 this->second = value.as_uint32();
3019 break;
3020#ifdef USE_DEVICES
3021 case 5:
3022 this->device_id = value.as_uint32();
3023 break;
3024#endif
3025 default:
3026 return false;
3027 }
3028 return true;
3029}
3030bool TimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3031 switch (field_id) {
3032 case 1:
3033 this->key = value.as_fixed32();
3034 break;
3035 default:
3036 return false;
3037 }
3038 return true;
3039}
3040#endif
3041#ifdef USE_EVENT
3043 buffer.encode_string(1, this->object_id_ref_);
3044 buffer.encode_fixed32(2, this->key);
3045 buffer.encode_string(3, this->name_ref_);
3046#ifdef USE_ENTITY_ICON
3047 buffer.encode_string(5, this->icon_ref_);
3048#endif
3049 buffer.encode_bool(6, this->disabled_by_default);
3050 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3051 buffer.encode_string(8, this->device_class_ref_);
3052 for (const char *it : *this->event_types) {
3053 buffer.encode_string(9, it, strlen(it), true);
3054 }
3055#ifdef USE_DEVICES
3056 buffer.encode_uint32(10, this->device_id);
3057#endif
3058}
3060 size.add_length(1, this->object_id_ref_.size());
3061 size.add_fixed32(1, this->key);
3062 size.add_length(1, this->name_ref_.size());
3063#ifdef USE_ENTITY_ICON
3064 size.add_length(1, this->icon_ref_.size());
3065#endif
3066 size.add_bool(1, this->disabled_by_default);
3067 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3068 size.add_length(1, this->device_class_ref_.size());
3069 if (!this->event_types->empty()) {
3070 for (const char *it : *this->event_types) {
3071 size.add_length_force(1, strlen(it));
3072 }
3073 }
3074#ifdef USE_DEVICES
3075 size.add_uint32(1, this->device_id);
3076#endif
3077}
3079 buffer.encode_fixed32(1, this->key);
3080 buffer.encode_string(2, this->event_type_ref_);
3081#ifdef USE_DEVICES
3082 buffer.encode_uint32(3, this->device_id);
3083#endif
3084}
3086 size.add_fixed32(1, this->key);
3087 size.add_length(1, this->event_type_ref_.size());
3088#ifdef USE_DEVICES
3089 size.add_uint32(1, this->device_id);
3090#endif
3091}
3092#endif
3093#ifdef USE_VALVE
3095 buffer.encode_string(1, this->object_id_ref_);
3096 buffer.encode_fixed32(2, this->key);
3097 buffer.encode_string(3, this->name_ref_);
3098#ifdef USE_ENTITY_ICON
3099 buffer.encode_string(5, this->icon_ref_);
3100#endif
3101 buffer.encode_bool(6, this->disabled_by_default);
3102 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3103 buffer.encode_string(8, this->device_class_ref_);
3104 buffer.encode_bool(9, this->assumed_state);
3105 buffer.encode_bool(10, this->supports_position);
3106 buffer.encode_bool(11, this->supports_stop);
3107#ifdef USE_DEVICES
3108 buffer.encode_uint32(12, this->device_id);
3109#endif
3110}
3112 size.add_length(1, this->object_id_ref_.size());
3113 size.add_fixed32(1, this->key);
3114 size.add_length(1, this->name_ref_.size());
3115#ifdef USE_ENTITY_ICON
3116 size.add_length(1, this->icon_ref_.size());
3117#endif
3118 size.add_bool(1, this->disabled_by_default);
3119 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3120 size.add_length(1, this->device_class_ref_.size());
3121 size.add_bool(1, this->assumed_state);
3122 size.add_bool(1, this->supports_position);
3123 size.add_bool(1, this->supports_stop);
3124#ifdef USE_DEVICES
3125 size.add_uint32(1, this->device_id);
3126#endif
3127}
3129 buffer.encode_fixed32(1, this->key);
3130 buffer.encode_float(2, this->position);
3131 buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation));
3132#ifdef USE_DEVICES
3133 buffer.encode_uint32(4, this->device_id);
3134#endif
3135}
3137 size.add_fixed32(1, this->key);
3138 size.add_float(1, this->position);
3139 size.add_uint32(1, static_cast<uint32_t>(this->current_operation));
3140#ifdef USE_DEVICES
3141 size.add_uint32(1, this->device_id);
3142#endif
3143}
3144bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3145 switch (field_id) {
3146 case 2:
3147 this->has_position = value.as_bool();
3148 break;
3149 case 4:
3150 this->stop = value.as_bool();
3151 break;
3152#ifdef USE_DEVICES
3153 case 5:
3154 this->device_id = value.as_uint32();
3155 break;
3156#endif
3157 default:
3158 return false;
3159 }
3160 return true;
3161}
3162bool ValveCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3163 switch (field_id) {
3164 case 1:
3165 this->key = value.as_fixed32();
3166 break;
3167 case 3:
3168 this->position = value.as_float();
3169 break;
3170 default:
3171 return false;
3172 }
3173 return true;
3174}
3175#endif
3176#ifdef USE_DATETIME_DATETIME
3178 buffer.encode_string(1, this->object_id_ref_);
3179 buffer.encode_fixed32(2, this->key);
3180 buffer.encode_string(3, this->name_ref_);
3181#ifdef USE_ENTITY_ICON
3182 buffer.encode_string(5, this->icon_ref_);
3183#endif
3184 buffer.encode_bool(6, this->disabled_by_default);
3185 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3186#ifdef USE_DEVICES
3187 buffer.encode_uint32(8, this->device_id);
3188#endif
3189}
3191 size.add_length(1, this->object_id_ref_.size());
3192 size.add_fixed32(1, this->key);
3193 size.add_length(1, this->name_ref_.size());
3194#ifdef USE_ENTITY_ICON
3195 size.add_length(1, this->icon_ref_.size());
3196#endif
3197 size.add_bool(1, this->disabled_by_default);
3198 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3199#ifdef USE_DEVICES
3200 size.add_uint32(1, this->device_id);
3201#endif
3202}
3204 buffer.encode_fixed32(1, this->key);
3205 buffer.encode_bool(2, this->missing_state);
3206 buffer.encode_fixed32(3, this->epoch_seconds);
3207#ifdef USE_DEVICES
3208 buffer.encode_uint32(4, this->device_id);
3209#endif
3210}
3212 size.add_fixed32(1, this->key);
3213 size.add_bool(1, this->missing_state);
3214 size.add_fixed32(1, this->epoch_seconds);
3215#ifdef USE_DEVICES
3216 size.add_uint32(1, this->device_id);
3217#endif
3218}
3220 switch (field_id) {
3221#ifdef USE_DEVICES
3222 case 3:
3223 this->device_id = value.as_uint32();
3224 break;
3225#endif
3226 default:
3227 return false;
3228 }
3229 return true;
3230}
3231bool DateTimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3232 switch (field_id) {
3233 case 1:
3234 this->key = value.as_fixed32();
3235 break;
3236 case 2:
3237 this->epoch_seconds = value.as_fixed32();
3238 break;
3239 default:
3240 return false;
3241 }
3242 return true;
3243}
3244#endif
3245#ifdef USE_UPDATE
3247 buffer.encode_string(1, this->object_id_ref_);
3248 buffer.encode_fixed32(2, this->key);
3249 buffer.encode_string(3, this->name_ref_);
3250#ifdef USE_ENTITY_ICON
3251 buffer.encode_string(5, this->icon_ref_);
3252#endif
3253 buffer.encode_bool(6, this->disabled_by_default);
3254 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3255 buffer.encode_string(8, this->device_class_ref_);
3256#ifdef USE_DEVICES
3257 buffer.encode_uint32(9, this->device_id);
3258#endif
3259}
3261 size.add_length(1, this->object_id_ref_.size());
3262 size.add_fixed32(1, this->key);
3263 size.add_length(1, this->name_ref_.size());
3264#ifdef USE_ENTITY_ICON
3265 size.add_length(1, this->icon_ref_.size());
3266#endif
3267 size.add_bool(1, this->disabled_by_default);
3268 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3269 size.add_length(1, this->device_class_ref_.size());
3270#ifdef USE_DEVICES
3271 size.add_uint32(1, this->device_id);
3272#endif
3273}
3275 buffer.encode_fixed32(1, this->key);
3276 buffer.encode_bool(2, this->missing_state);
3277 buffer.encode_bool(3, this->in_progress);
3278 buffer.encode_bool(4, this->has_progress);
3279 buffer.encode_float(5, this->progress);
3280 buffer.encode_string(6, this->current_version_ref_);
3281 buffer.encode_string(7, this->latest_version_ref_);
3282 buffer.encode_string(8, this->title_ref_);
3283 buffer.encode_string(9, this->release_summary_ref_);
3284 buffer.encode_string(10, this->release_url_ref_);
3285#ifdef USE_DEVICES
3286 buffer.encode_uint32(11, this->device_id);
3287#endif
3288}
3290 size.add_fixed32(1, this->key);
3291 size.add_bool(1, this->missing_state);
3292 size.add_bool(1, this->in_progress);
3293 size.add_bool(1, this->has_progress);
3294 size.add_float(1, this->progress);
3295 size.add_length(1, this->current_version_ref_.size());
3296 size.add_length(1, this->latest_version_ref_.size());
3297 size.add_length(1, this->title_ref_.size());
3298 size.add_length(1, this->release_summary_ref_.size());
3299 size.add_length(1, this->release_url_ref_.size());
3300#ifdef USE_DEVICES
3301 size.add_uint32(1, this->device_id);
3302#endif
3303}
3304bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3305 switch (field_id) {
3306 case 2:
3307 this->command = static_cast<enums::UpdateCommand>(value.as_uint32());
3308 break;
3309#ifdef USE_DEVICES
3310 case 3:
3311 this->device_id = value.as_uint32();
3312 break;
3313#endif
3314 default:
3315 return false;
3316 }
3317 return true;
3318}
3319bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3320 switch (field_id) {
3321 case 1:
3322 this->key = value.as_fixed32();
3323 break;
3324 default:
3325 return false;
3326 }
3327 return true;
3328}
3329#endif
3330#ifdef USE_ZWAVE_PROXY
3332 switch (field_id) {
3333 case 1: {
3334 // Use raw data directly to avoid allocation
3335 this->data = value.data();
3336 this->data_len = value.size();
3337 break;
3338 }
3339 default:
3340 return false;
3341 }
3342 return true;
3343}
3344void ZWaveProxyFrame::encode(ProtoWriteBuffer buffer) const { buffer.encode_bytes(1, this->data, this->data_len); }
3346bool ZWaveProxyRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3347 switch (field_id) {
3348 case 1:
3349 this->type = static_cast<enums::ZWaveProxyRequestType>(value.as_uint32());
3350 break;
3351 default:
3352 return false;
3353 }
3354 return true;
3355}
3357 switch (field_id) {
3358 case 2: {
3359 // Use raw data directly to avoid allocation
3360 this->data = value.data();
3361 this->data_len = value.size();
3362 break;
3363 }
3364 default:
3365 return false;
3366 }
3367 return true;
3368}
3370 buffer.encode_uint32(1, static_cast<uint32_t>(this->type));
3371 buffer.encode_bytes(2, this->data, this->data_len);
3372}
3374 size.add_uint32(1, static_cast<uint32_t>(this->type));
3375 size.add_length(2, this->data_len);
3376}
3377#endif
3378
3379} // namespace esphome::api
constexpr bool empty() const
Check if the set is empty.
bool empty() const
Definition helpers.h:342
void push_back(const T &value)
Add element without bounds checking Caller must ensure sufficient capacity was allocated via init() S...
Definition helpers.h:301
void init(size_t n)
Definition helpers.h:274
constexpr size_type size() const
Definition string_ref.h:70
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2788
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2763
enums::AlarmControlPanelStateCommand command
Definition api_pb2.h:2736
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2778
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2756
enums::AlarmControlPanelState state
Definition api_pb2.h:2720
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2749
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:66
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:70
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:49
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:62
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:63
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:234
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:242
std::array< uint64_t, BLUETOOTH_PROXY_MAX_CONNECTIONS > allocated
Definition api_pb2.h:2274
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2357
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2366
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2426
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2421
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2146
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2152
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2406
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2401
enums::BluetoothDeviceRequestType request_type
Definition api_pb2.h:1999
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2127
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2411
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2416
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2184
FixedVector< BluetoothGATTDescriptor > descriptors
Definition api_pb2.h:2061
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2196
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:2058
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2176
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:2045
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2168
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2375
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2380
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2236
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2239
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2158
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2232
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2226
std::vector< BluetoothGATTService > services
Definition api_pb2.h:2093
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2347
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2352
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2331
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2397
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2393
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2292
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2240
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2253
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2258
FixedVector< BluetoothGATTCharacteristic > characteristics
Definition api_pb2.h:2075
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2217
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2206
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:2073
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2318
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2305
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2279
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2263
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2389
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2385
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2111
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2105
std::array< BluetoothLERawAdvertisement, BLUETOOTH_PROXY_ADVERTISEMENT_BATCH_SIZE > advertisements
Definition api_pb2.h:1981
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2117
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2122
enums::BluetoothScannerMode mode
Definition api_pb2.h:2427
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2441
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2431
enums::BluetoothScannerMode mode
Definition api_pb2.h:2410
enums::BluetoothScannerState state
Definition api_pb2.h:2409
enums::BluetoothScannerMode configured_mode
Definition api_pb2.h:2411
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2436
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1950
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1962
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1203
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1195
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1187
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1427
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1517
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1515
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1354
enums::ClimatePreset preset
Definition api_pb2.h:1522
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1408
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1482
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1483
enums::ClimateAction action
Definition api_pb2.h:1481
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1316
enums::ClimatePreset preset
Definition api_pb2.h:1486
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1335
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:327
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:306
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:288
enums::CoverOperation current_operation
Definition api_pb2.h:712
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:297
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2951
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2930
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2910
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2920
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3231
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3219
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3211
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3203
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:81
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:76
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:87
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:145
std::array< AreaInfo, ESPHOME_AREA_COUNT > areas
Definition api_pb2.h:586
std::array< DeviceInfo, ESPHOME_DEVICE_COUNT > devices
Definition api_pb2.h:583
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3085
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3078
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1087
FixedVector< float > float_array
Definition api_pb2.h:1317
FixedVector< std::string > string_array
Definition api_pb2.h:1318
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1061
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1039
FixedVector< int32_t > int_array
Definition api_pb2.h:1316
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1074
FixedVector< ExecuteServiceArgument > args
Definition api_pb2.h:1337
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1098
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1136
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1126
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1115
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1151
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1143
const uint8_t * preset_mode
Definition api_pb2.h:800
enums::FanDirection direction
Definition api_pb2.h:796
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:409
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:448
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:461
enums::FanDirection direction
Definition api_pb2.h:772
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:387
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:398
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1006
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:993
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:10
const uint8_t * client_info
Definition api_pb2.h:364
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:23
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:42
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:36
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:967
FixedVector< HomeassistantServiceMap > variables
Definition api_pb2.h:1144
FixedVector< HomeassistantServiceMap > data
Definition api_pb2.h:1142
FixedVector< HomeassistantServiceMap > data_template
Definition api_pb2.h:1143
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:906
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:884
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:924
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:937
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:876
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:880
enums::EntityCategory entity_category
Definition api_pb2.h:328
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:615
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:628
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:555
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:519
enums::ColorMode color_mode
Definition api_pb2.h:841
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:537
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2733
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2717
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:204
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:219
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1936
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1922
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1174
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1161
const std::vector< const char * > * supported_custom_presets
Definition api_pb2.h:1454
const climate::ClimateSwingModeMask * supported_swing_modes
Definition api_pb2.h:1451
const std::vector< const char * > * supported_custom_fan_modes
Definition api_pb2.h:1452
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1261
const climate::ClimatePresetMask * supported_presets
Definition api_pb2.h:1453
const climate::ClimateFanModeMask * supported_fan_modes
Definition api_pb2.h:1450
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1218
const climate::ClimateModeMask * supported_modes
Definition api_pb2.h:1445
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:270
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:252
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2884
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2897
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3190
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3177
const FixedVector< const char * > * event_types
Definition api_pb2.h:2923
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3059
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3042
const std::vector< const char * > * supported_preset_modes
Definition api_pb2.h:754
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:345
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:365
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:494
const FixedVector< const char * > * effects
Definition api_pb2.h:823
const light::ColorModeMask * supported_color_modes
Definition api_pb2.h:820
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:473
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1834
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1851
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1988
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2006
std::vector< MediaPlayerSupportedFormat > supported_formats
Definition api_pb2.h:1890
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1578
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1559
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1656
const FixedVector< const char * > * options
Definition api_pb2.h:1668
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1640
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:667
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:685
enums::SensorStateClass state_class
Definition api_pb2.h:918
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1021
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1017
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1033
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1025
enums::SupportsResponseType supports_response
Definition api_pb2.h:1299
FixedVector< ListEntitiesServicesArgument > args
Definition api_pb2.h:1298
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1727
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1745
std::vector< std::string > tones
Definition api_pb2.h:1722
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:721
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:736
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2817
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2800
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:806
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:792
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2963
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2976
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3260
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3246
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3111
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3094
const water_heater::WaterHeaterModeMask * supported_modes
Definition api_pb2.h:1549
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1471
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1451
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1882
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1910
enums::LockCommand command
Definition api_pb2.h:1818
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1900
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1875
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1868
enums::MediaPlayerCommand command
Definition api_pb2.h:1926
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2080
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2040
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2070
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2031
enums::MediaPlayerState state
Definition api_pb2.h:1907
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2022
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1981
enums::MediaPlayerFormatPurpose purpose
Definition api_pb2.h:1872
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1974
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:859
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:872
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:873
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1625
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1613
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1597
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1605
uint32_t as_fixed32() const
Definition proto.h:215
float as_float() const
Definition proto.h:217
virtual void decode(const uint8_t *buffer, size_t length)
Definition proto.cpp:73
static uint32_t count_repeated_field(const uint8_t *buffer, size_t length, uint32_t target_field_id)
Count occurrences of a repeated field in a protobuf buffer.
Definition proto.cpp:10
void decode_to_message(ProtoDecodableMessage &msg) const
Decode the length-delimited data into an existing ProtoDecodableMessage instance.
Definition proto.h:824
const uint8_t * data() const
Definition proto.h:193
std::string as_string() const
Definition proto.h:190
void add_message_object(uint32_t field_id_size, const ProtoMessage &message)
Calculates and adds the size of a nested message field to the total message size.
Definition proto.h:733
void add_message_object_force(uint32_t field_id_size, const ProtoMessage &message)
Calculates and adds the size of a nested message field to the total message size (force version)
Definition proto.h:748
void add_float(uint32_t field_id_size, float value)
Calculates and adds the size of a float field to the total message size.
Definition proto.h:578
void add_uint32_force(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a uint32 field to the total message size (force version)
Definition proto.h:551
void add_sint32(uint32_t field_id_size, int32_t value)
Calculates and adds the size of a sint32 field to the total message size.
Definition proto.h:616
void add_bool(uint32_t field_id_size, bool value)
Calculates and adds the size of a boolean field to the total message size.
Definition proto.h:559
void add_uint32(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a uint32 field to the total message size.
Definition proto.h:542
void add_repeated_message(uint32_t field_id_size, const std::vector< MessageType > &messages)
Calculates and adds the sizes of all messages in a repeated field to the total message size.
Definition proto.h:768
void add_uint64(uint32_t field_id_size, uint64_t value)
Calculates and adds the size of a uint64 field to the total message size.
Definition proto.h:653
void add_length_force(uint32_t field_id_size, size_t len)
Calculates and adds the size of a length-delimited field (string/bytes) to the total message size (re...
Definition proto.h:683
void add_int32(uint32_t field_id_size, int32_t value)
Common parameters for all add_*_field methods.
Definition proto.h:524
void add_uint64_force(uint32_t field_id_size, uint64_t value)
Calculates and adds the size of a uint64 field to the total message size (force version)
Definition proto.h:662
void add_fixed32(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a fixed32 field to the total message size.
Definition proto.h:590
void add_length(uint32_t field_id_size, size_t len)
Calculates and adds the size of a length-delimited field (string/bytes) to the total message size.
Definition proto.h:673
Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit.
Definition proto.h:73
constexpr uint64_t as_uint64() const
Definition proto.h:116
constexpr int32_t as_int32() const
Definition proto.h:118
constexpr uint32_t as_uint32() const
Definition proto.h:115
constexpr bool as_bool() const
Definition proto.h:117
constexpr int32_t as_sint32() const
Definition proto.h:126
void encode_float(uint32_t field_id, float value, bool force=false)
Definition proto.h:309
void encode_int32(uint32_t field_id, int32_t value, bool force=false)
Definition proto.h:320
void encode_string(uint32_t field_id, const char *string, size_t len, bool force=false)
Definition proto.h:254
void encode_bool(uint32_t field_id, bool value, bool force=false)
Definition proto.h:289
void encode_uint64(uint32_t field_id, uint64_t value, bool force=false)
Definition proto.h:283
void encode_uint32(uint32_t field_id, uint32_t value, bool force=false)
Definition proto.h:277
void encode_sint32(uint32_t field_id, int32_t value, bool force=false)
Definition proto.h:331
void encode_message(uint32_t field_id, const ProtoMessage &value)
Definition proto.h:798
void encode_bytes(uint32_t field_id, const uint8_t *data, size_t len, bool force=false)
Definition proto.h:274
void encode_fixed32(uint32_t field_id, uint32_t value, bool force=false)
Definition proto.h:295
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1702
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1690
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1715
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1674
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1682
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:711
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:703
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1809
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1779
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1819
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1772
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1765
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2095
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:962
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:957
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:837
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:854
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:850
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2453
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:780
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:765
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:751
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:758
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2862
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2872
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2850
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:828
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:820
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2842
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2834
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3030
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3009
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2999
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2989
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3319
enums::UpdateCommand command
Definition api_pb2.h:3111
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3304
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3289
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3274
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3144
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3162
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3128
enums::ValveOperation current_operation
Definition api_pb2.h:2979
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3136
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2624
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2623
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2607
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2597
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2557
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2561
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2547
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2537
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2466
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2471
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2676
std::vector< VoiceAssistantExternalWakeWord > external_wake_words
Definition api_pb2.h:2652
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2696
std::vector< VoiceAssistantWakeWord > available_wake_words
Definition api_pb2.h:2667
const std::vector< std::string > * active_wake_words
Definition api_pb2.h:2668
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2687
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2503
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2526
enums::VoiceAssistantEvent event_type
Definition api_pb2.h:2522
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2516
std::vector< VoiceAssistantEventData > data
Definition api_pb2.h:2523
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2651
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2641
std::vector< std::string > trained_languages
Definition api_pb2.h:2632
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2483
VoiceAssistantAudioSettings audio_settings
Definition api_pb2.h:2477
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2476
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2490
std::vector< std::string > active_wake_words
Definition api_pb2.h:2685
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2705
enums::VoiceAssistantTimerEvent event_type
Definition api_pb2.h:2564
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2584
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2565
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2625
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2632
std::vector< std::string > trained_languages
Definition api_pb2.h:2619
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1538
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1517
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1505
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1493
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3331
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3344
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3345
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3373
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3356
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3346
enums::ZWaveProxyRequestType type
Definition api_pb2.h:3147
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3369
uint16_t length
Definition tt21100.cpp:0