ESPHome  2022.9.1
api_pb2.cpp
Go to the documentation of this file.
1 // This file was automatically generated with a tool.
2 // See scripts/api_protobuf/api_protobuf.py
3 #include "api_pb2.h"
4 #include "esphome/core/log.h"
5 
6 namespace esphome {
7 namespace api {
8 
9 template<> const char *proto_enum_to_string<enums::EntityCategory>(enums::EntityCategory value) {
10  switch (value) {
12  return "ENTITY_CATEGORY_NONE";
14  return "ENTITY_CATEGORY_CONFIG";
16  return "ENTITY_CATEGORY_DIAGNOSTIC";
17  default:
18  return "UNKNOWN";
19  }
20 }
21 template<> const char *proto_enum_to_string<enums::LegacyCoverState>(enums::LegacyCoverState value) {
22  switch (value) {
24  return "LEGACY_COVER_STATE_OPEN";
26  return "LEGACY_COVER_STATE_CLOSED";
27  default:
28  return "UNKNOWN";
29  }
30 }
31 template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverOperation value) {
32  switch (value) {
34  return "COVER_OPERATION_IDLE";
36  return "COVER_OPERATION_IS_OPENING";
38  return "COVER_OPERATION_IS_CLOSING";
39  default:
40  return "UNKNOWN";
41  }
42 }
43 template<> const char *proto_enum_to_string<enums::LegacyCoverCommand>(enums::LegacyCoverCommand value) {
44  switch (value) {
46  return "LEGACY_COVER_COMMAND_OPEN";
48  return "LEGACY_COVER_COMMAND_CLOSE";
50  return "LEGACY_COVER_COMMAND_STOP";
51  default:
52  return "UNKNOWN";
53  }
54 }
55 template<> const char *proto_enum_to_string<enums::FanSpeed>(enums::FanSpeed value) {
56  switch (value) {
58  return "FAN_SPEED_LOW";
60  return "FAN_SPEED_MEDIUM";
62  return "FAN_SPEED_HIGH";
63  default:
64  return "UNKNOWN";
65  }
66 }
67 template<> const char *proto_enum_to_string<enums::FanDirection>(enums::FanDirection value) {
68  switch (value) {
70  return "FAN_DIRECTION_FORWARD";
72  return "FAN_DIRECTION_REVERSE";
73  default:
74  return "UNKNOWN";
75  }
76 }
77 template<> const char *proto_enum_to_string<enums::ColorMode>(enums::ColorMode value) {
78  switch (value) {
80  return "COLOR_MODE_UNKNOWN";
82  return "COLOR_MODE_ON_OFF";
84  return "COLOR_MODE_BRIGHTNESS";
86  return "COLOR_MODE_WHITE";
88  return "COLOR_MODE_COLOR_TEMPERATURE";
90  return "COLOR_MODE_COLD_WARM_WHITE";
92  return "COLOR_MODE_RGB";
94  return "COLOR_MODE_RGB_WHITE";
96  return "COLOR_MODE_RGB_COLOR_TEMPERATURE";
98  return "COLOR_MODE_RGB_COLD_WARM_WHITE";
99  default:
100  return "UNKNOWN";
101  }
102 }
103 template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::SensorStateClass value) {
104  switch (value) {
106  return "STATE_CLASS_NONE";
108  return "STATE_CLASS_MEASUREMENT";
110  return "STATE_CLASS_TOTAL_INCREASING";
112  return "STATE_CLASS_TOTAL";
113  default:
114  return "UNKNOWN";
115  }
116 }
117 template<> const char *proto_enum_to_string<enums::SensorLastResetType>(enums::SensorLastResetType value) {
118  switch (value) {
120  return "LAST_RESET_NONE";
122  return "LAST_RESET_NEVER";
124  return "LAST_RESET_AUTO";
125  default:
126  return "UNKNOWN";
127  }
128 }
129 template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel value) {
130  switch (value) {
132  return "LOG_LEVEL_NONE";
134  return "LOG_LEVEL_ERROR";
136  return "LOG_LEVEL_WARN";
138  return "LOG_LEVEL_INFO";
140  return "LOG_LEVEL_CONFIG";
142  return "LOG_LEVEL_DEBUG";
144  return "LOG_LEVEL_VERBOSE";
146  return "LOG_LEVEL_VERY_VERBOSE";
147  default:
148  return "UNKNOWN";
149  }
150 }
151 template<> const char *proto_enum_to_string<enums::ServiceArgType>(enums::ServiceArgType value) {
152  switch (value) {
154  return "SERVICE_ARG_TYPE_BOOL";
156  return "SERVICE_ARG_TYPE_INT";
158  return "SERVICE_ARG_TYPE_FLOAT";
160  return "SERVICE_ARG_TYPE_STRING";
162  return "SERVICE_ARG_TYPE_BOOL_ARRAY";
164  return "SERVICE_ARG_TYPE_INT_ARRAY";
166  return "SERVICE_ARG_TYPE_FLOAT_ARRAY";
168  return "SERVICE_ARG_TYPE_STRING_ARRAY";
169  default:
170  return "UNKNOWN";
171  }
172 }
173 template<> const char *proto_enum_to_string<enums::ClimateMode>(enums::ClimateMode value) {
174  switch (value) {
176  return "CLIMATE_MODE_OFF";
178  return "CLIMATE_MODE_HEAT_COOL";
180  return "CLIMATE_MODE_COOL";
182  return "CLIMATE_MODE_HEAT";
184  return "CLIMATE_MODE_FAN_ONLY";
186  return "CLIMATE_MODE_DRY";
188  return "CLIMATE_MODE_AUTO";
189  default:
190  return "UNKNOWN";
191  }
192 }
193 template<> const char *proto_enum_to_string<enums::ClimateFanMode>(enums::ClimateFanMode value) {
194  switch (value) {
196  return "CLIMATE_FAN_ON";
198  return "CLIMATE_FAN_OFF";
200  return "CLIMATE_FAN_AUTO";
202  return "CLIMATE_FAN_LOW";
204  return "CLIMATE_FAN_MEDIUM";
206  return "CLIMATE_FAN_HIGH";
208  return "CLIMATE_FAN_MIDDLE";
210  return "CLIMATE_FAN_FOCUS";
212  return "CLIMATE_FAN_DIFFUSE";
213  default:
214  return "UNKNOWN";
215  }
216 }
217 template<> const char *proto_enum_to_string<enums::ClimateSwingMode>(enums::ClimateSwingMode value) {
218  switch (value) {
220  return "CLIMATE_SWING_OFF";
222  return "CLIMATE_SWING_BOTH";
224  return "CLIMATE_SWING_VERTICAL";
226  return "CLIMATE_SWING_HORIZONTAL";
227  default:
228  return "UNKNOWN";
229  }
230 }
231 template<> const char *proto_enum_to_string<enums::ClimateAction>(enums::ClimateAction value) {
232  switch (value) {
234  return "CLIMATE_ACTION_OFF";
236  return "CLIMATE_ACTION_COOLING";
238  return "CLIMATE_ACTION_HEATING";
240  return "CLIMATE_ACTION_IDLE";
242  return "CLIMATE_ACTION_DRYING";
244  return "CLIMATE_ACTION_FAN";
245  default:
246  return "UNKNOWN";
247  }
248 }
249 template<> const char *proto_enum_to_string<enums::ClimatePreset>(enums::ClimatePreset value) {
250  switch (value) {
252  return "CLIMATE_PRESET_NONE";
254  return "CLIMATE_PRESET_HOME";
256  return "CLIMATE_PRESET_AWAY";
258  return "CLIMATE_PRESET_BOOST";
260  return "CLIMATE_PRESET_COMFORT";
262  return "CLIMATE_PRESET_ECO";
264  return "CLIMATE_PRESET_SLEEP";
266  return "CLIMATE_PRESET_ACTIVITY";
267  default:
268  return "UNKNOWN";
269  }
270 }
271 template<> const char *proto_enum_to_string<enums::NumberMode>(enums::NumberMode value) {
272  switch (value) {
274  return "NUMBER_MODE_AUTO";
276  return "NUMBER_MODE_BOX";
278  return "NUMBER_MODE_SLIDER";
279  default:
280  return "UNKNOWN";
281  }
282 }
283 template<> const char *proto_enum_to_string<enums::LockState>(enums::LockState value) {
284  switch (value) {
286  return "LOCK_STATE_NONE";
288  return "LOCK_STATE_LOCKED";
290  return "LOCK_STATE_UNLOCKED";
292  return "LOCK_STATE_JAMMED";
294  return "LOCK_STATE_LOCKING";
296  return "LOCK_STATE_UNLOCKING";
297  default:
298  return "UNKNOWN";
299  }
300 }
301 template<> const char *proto_enum_to_string<enums::LockCommand>(enums::LockCommand value) {
302  switch (value) {
303  case enums::LOCK_UNLOCK:
304  return "LOCK_UNLOCK";
305  case enums::LOCK_LOCK:
306  return "LOCK_LOCK";
307  case enums::LOCK_OPEN:
308  return "LOCK_OPEN";
309  default:
310  return "UNKNOWN";
311  }
312 }
313 template<> const char *proto_enum_to_string<enums::MediaPlayerState>(enums::MediaPlayerState value) {
314  switch (value) {
316  return "MEDIA_PLAYER_STATE_NONE";
318  return "MEDIA_PLAYER_STATE_IDLE";
320  return "MEDIA_PLAYER_STATE_PLAYING";
322  return "MEDIA_PLAYER_STATE_PAUSED";
323  default:
324  return "UNKNOWN";
325  }
326 }
327 template<> const char *proto_enum_to_string<enums::MediaPlayerCommand>(enums::MediaPlayerCommand value) {
328  switch (value) {
330  return "MEDIA_PLAYER_COMMAND_PLAY";
332  return "MEDIA_PLAYER_COMMAND_PAUSE";
334  return "MEDIA_PLAYER_COMMAND_STOP";
336  return "MEDIA_PLAYER_COMMAND_MUTE";
338  return "MEDIA_PLAYER_COMMAND_UNMUTE";
339  default:
340  return "UNKNOWN";
341  }
342 }
343 bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
344  switch (field_id) {
345  case 1: {
346  this->client_info = value.as_string();
347  return true;
348  }
349  default:
350  return false;
351  }
352 }
353 void HelloRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->client_info); }
354 #ifdef HAS_PROTO_MESSAGE_DUMP
355 void HelloRequest::dump_to(std::string &out) const {
356  __attribute__((unused)) char buffer[64];
357  out.append("HelloRequest {\n");
358  out.append(" client_info: ");
359  out.append("'").append(this->client_info).append("'");
360  out.append("\n");
361  out.append("}");
362 }
363 #endif
364 bool HelloResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
365  switch (field_id) {
366  case 1: {
367  this->api_version_major = value.as_uint32();
368  return true;
369  }
370  case 2: {
371  this->api_version_minor = value.as_uint32();
372  return true;
373  }
374  default:
375  return false;
376  }
377 }
378 bool HelloResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
379  switch (field_id) {
380  case 3: {
381  this->server_info = value.as_string();
382  return true;
383  }
384  case 4: {
385  this->name = value.as_string();
386  return true;
387  }
388  default:
389  return false;
390  }
391 }
393  buffer.encode_uint32(1, this->api_version_major);
394  buffer.encode_uint32(2, this->api_version_minor);
395  buffer.encode_string(3, this->server_info);
396  buffer.encode_string(4, this->name);
397 }
398 #ifdef HAS_PROTO_MESSAGE_DUMP
399 void HelloResponse::dump_to(std::string &out) const {
400  __attribute__((unused)) char buffer[64];
401  out.append("HelloResponse {\n");
402  out.append(" api_version_major: ");
403  sprintf(buffer, "%u", this->api_version_major);
404  out.append(buffer);
405  out.append("\n");
406 
407  out.append(" api_version_minor: ");
408  sprintf(buffer, "%u", this->api_version_minor);
409  out.append(buffer);
410  out.append("\n");
411 
412  out.append(" server_info: ");
413  out.append("'").append(this->server_info).append("'");
414  out.append("\n");
415 
416  out.append(" name: ");
417  out.append("'").append(this->name).append("'");
418  out.append("\n");
419  out.append("}");
420 }
421 #endif
422 bool ConnectRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
423  switch (field_id) {
424  case 1: {
425  this->password = value.as_string();
426  return true;
427  }
428  default:
429  return false;
430  }
431 }
432 void ConnectRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->password); }
433 #ifdef HAS_PROTO_MESSAGE_DUMP
434 void ConnectRequest::dump_to(std::string &out) const {
435  __attribute__((unused)) char buffer[64];
436  out.append("ConnectRequest {\n");
437  out.append(" password: ");
438  out.append("'").append(this->password).append("'");
439  out.append("\n");
440  out.append("}");
441 }
442 #endif
443 bool ConnectResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
444  switch (field_id) {
445  case 1: {
446  this->invalid_password = value.as_bool();
447  return true;
448  }
449  default:
450  return false;
451  }
452 }
453 void ConnectResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->invalid_password); }
454 #ifdef HAS_PROTO_MESSAGE_DUMP
455 void ConnectResponse::dump_to(std::string &out) const {
456  __attribute__((unused)) char buffer[64];
457  out.append("ConnectResponse {\n");
458  out.append(" invalid_password: ");
459  out.append(YESNO(this->invalid_password));
460  out.append("\n");
461  out.append("}");
462 }
463 #endif
465 #ifdef HAS_PROTO_MESSAGE_DUMP
466 void DisconnectRequest::dump_to(std::string &out) const { out.append("DisconnectRequest {}"); }
467 #endif
469 #ifdef HAS_PROTO_MESSAGE_DUMP
470 void DisconnectResponse::dump_to(std::string &out) const { out.append("DisconnectResponse {}"); }
471 #endif
473 #ifdef HAS_PROTO_MESSAGE_DUMP
474 void PingRequest::dump_to(std::string &out) const { out.append("PingRequest {}"); }
475 #endif
477 #ifdef HAS_PROTO_MESSAGE_DUMP
478 void PingResponse::dump_to(std::string &out) const { out.append("PingResponse {}"); }
479 #endif
481 #ifdef HAS_PROTO_MESSAGE_DUMP
482 void DeviceInfoRequest::dump_to(std::string &out) const { out.append("DeviceInfoRequest {}"); }
483 #endif
484 bool DeviceInfoResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
485  switch (field_id) {
486  case 1: {
487  this->uses_password = value.as_bool();
488  return true;
489  }
490  case 7: {
491  this->has_deep_sleep = value.as_bool();
492  return true;
493  }
494  case 10: {
495  this->webserver_port = value.as_uint32();
496  return true;
497  }
498  case 11: {
499  this->has_bluetooth_proxy = value.as_bool();
500  return true;
501  }
502  default:
503  return false;
504  }
505 }
507  switch (field_id) {
508  case 2: {
509  this->name = value.as_string();
510  return true;
511  }
512  case 3: {
513  this->mac_address = value.as_string();
514  return true;
515  }
516  case 4: {
517  this->esphome_version = value.as_string();
518  return true;
519  }
520  case 5: {
521  this->compilation_time = value.as_string();
522  return true;
523  }
524  case 6: {
525  this->model = value.as_string();
526  return true;
527  }
528  case 8: {
529  this->project_name = value.as_string();
530  return true;
531  }
532  case 9: {
533  this->project_version = value.as_string();
534  return true;
535  }
536  default:
537  return false;
538  }
539 }
541  buffer.encode_bool(1, this->uses_password);
542  buffer.encode_string(2, this->name);
543  buffer.encode_string(3, this->mac_address);
544  buffer.encode_string(4, this->esphome_version);
545  buffer.encode_string(5, this->compilation_time);
546  buffer.encode_string(6, this->model);
547  buffer.encode_bool(7, this->has_deep_sleep);
548  buffer.encode_string(8, this->project_name);
549  buffer.encode_string(9, this->project_version);
550  buffer.encode_uint32(10, this->webserver_port);
551  buffer.encode_bool(11, this->has_bluetooth_proxy);
552 }
553 #ifdef HAS_PROTO_MESSAGE_DUMP
554 void DeviceInfoResponse::dump_to(std::string &out) const {
555  __attribute__((unused)) char buffer[64];
556  out.append("DeviceInfoResponse {\n");
557  out.append(" uses_password: ");
558  out.append(YESNO(this->uses_password));
559  out.append("\n");
560 
561  out.append(" name: ");
562  out.append("'").append(this->name).append("'");
563  out.append("\n");
564 
565  out.append(" mac_address: ");
566  out.append("'").append(this->mac_address).append("'");
567  out.append("\n");
568 
569  out.append(" esphome_version: ");
570  out.append("'").append(this->esphome_version).append("'");
571  out.append("\n");
572 
573  out.append(" compilation_time: ");
574  out.append("'").append(this->compilation_time).append("'");
575  out.append("\n");
576 
577  out.append(" model: ");
578  out.append("'").append(this->model).append("'");
579  out.append("\n");
580 
581  out.append(" has_deep_sleep: ");
582  out.append(YESNO(this->has_deep_sleep));
583  out.append("\n");
584 
585  out.append(" project_name: ");
586  out.append("'").append(this->project_name).append("'");
587  out.append("\n");
588 
589  out.append(" project_version: ");
590  out.append("'").append(this->project_version).append("'");
591  out.append("\n");
592 
593  out.append(" webserver_port: ");
594  sprintf(buffer, "%u", this->webserver_port);
595  out.append(buffer);
596  out.append("\n");
597 
598  out.append(" has_bluetooth_proxy: ");
599  out.append(YESNO(this->has_bluetooth_proxy));
600  out.append("\n");
601  out.append("}");
602 }
603 #endif
605 #ifdef HAS_PROTO_MESSAGE_DUMP
606 void ListEntitiesRequest::dump_to(std::string &out) const { out.append("ListEntitiesRequest {}"); }
607 #endif
609 #ifdef HAS_PROTO_MESSAGE_DUMP
610 void ListEntitiesDoneResponse::dump_to(std::string &out) const { out.append("ListEntitiesDoneResponse {}"); }
611 #endif
613 #ifdef HAS_PROTO_MESSAGE_DUMP
614 void SubscribeStatesRequest::dump_to(std::string &out) const { out.append("SubscribeStatesRequest {}"); }
615 #endif
617  switch (field_id) {
618  case 6: {
619  this->is_status_binary_sensor = value.as_bool();
620  return true;
621  }
622  case 7: {
623  this->disabled_by_default = value.as_bool();
624  return true;
625  }
626  case 9: {
627  this->entity_category = value.as_enum<enums::EntityCategory>();
628  return true;
629  }
630  default:
631  return false;
632  }
633 }
635  switch (field_id) {
636  case 1: {
637  this->object_id = value.as_string();
638  return true;
639  }
640  case 3: {
641  this->name = value.as_string();
642  return true;
643  }
644  case 4: {
645  this->unique_id = value.as_string();
646  return true;
647  }
648  case 5: {
649  this->device_class = value.as_string();
650  return true;
651  }
652  case 8: {
653  this->icon = value.as_string();
654  return true;
655  }
656  default:
657  return false;
658  }
659 }
661  switch (field_id) {
662  case 2: {
663  this->key = value.as_fixed32();
664  return true;
665  }
666  default:
667  return false;
668  }
669 }
671  buffer.encode_string(1, this->object_id);
672  buffer.encode_fixed32(2, this->key);
673  buffer.encode_string(3, this->name);
674  buffer.encode_string(4, this->unique_id);
675  buffer.encode_string(5, this->device_class);
676  buffer.encode_bool(6, this->is_status_binary_sensor);
677  buffer.encode_bool(7, this->disabled_by_default);
678  buffer.encode_string(8, this->icon);
679  buffer.encode_enum<enums::EntityCategory>(9, this->entity_category);
680 }
681 #ifdef HAS_PROTO_MESSAGE_DUMP
682 void ListEntitiesBinarySensorResponse::dump_to(std::string &out) const {
683  __attribute__((unused)) char buffer[64];
684  out.append("ListEntitiesBinarySensorResponse {\n");
685  out.append(" object_id: ");
686  out.append("'").append(this->object_id).append("'");
687  out.append("\n");
688 
689  out.append(" key: ");
690  sprintf(buffer, "%u", this->key);
691  out.append(buffer);
692  out.append("\n");
693 
694  out.append(" name: ");
695  out.append("'").append(this->name).append("'");
696  out.append("\n");
697 
698  out.append(" unique_id: ");
699  out.append("'").append(this->unique_id).append("'");
700  out.append("\n");
701 
702  out.append(" device_class: ");
703  out.append("'").append(this->device_class).append("'");
704  out.append("\n");
705 
706  out.append(" is_status_binary_sensor: ");
707  out.append(YESNO(this->is_status_binary_sensor));
708  out.append("\n");
709 
710  out.append(" disabled_by_default: ");
711  out.append(YESNO(this->disabled_by_default));
712  out.append("\n");
713 
714  out.append(" icon: ");
715  out.append("'").append(this->icon).append("'");
716  out.append("\n");
717 
718  out.append(" entity_category: ");
719  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
720  out.append("\n");
721  out.append("}");
722 }
723 #endif
725  switch (field_id) {
726  case 2: {
727  this->state = value.as_bool();
728  return true;
729  }
730  case 3: {
731  this->missing_state = value.as_bool();
732  return true;
733  }
734  default:
735  return false;
736  }
737 }
738 bool BinarySensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
739  switch (field_id) {
740  case 1: {
741  this->key = value.as_fixed32();
742  return true;
743  }
744  default:
745  return false;
746  }
747 }
749  buffer.encode_fixed32(1, this->key);
750  buffer.encode_bool(2, this->state);
751  buffer.encode_bool(3, this->missing_state);
752 }
753 #ifdef HAS_PROTO_MESSAGE_DUMP
754 void BinarySensorStateResponse::dump_to(std::string &out) const {
755  __attribute__((unused)) char buffer[64];
756  out.append("BinarySensorStateResponse {\n");
757  out.append(" key: ");
758  sprintf(buffer, "%u", this->key);
759  out.append(buffer);
760  out.append("\n");
761 
762  out.append(" state: ");
763  out.append(YESNO(this->state));
764  out.append("\n");
765 
766  out.append(" missing_state: ");
767  out.append(YESNO(this->missing_state));
768  out.append("\n");
769  out.append("}");
770 }
771 #endif
773  switch (field_id) {
774  case 5: {
775  this->assumed_state = value.as_bool();
776  return true;
777  }
778  case 6: {
779  this->supports_position = value.as_bool();
780  return true;
781  }
782  case 7: {
783  this->supports_tilt = value.as_bool();
784  return true;
785  }
786  case 9: {
787  this->disabled_by_default = value.as_bool();
788  return true;
789  }
790  case 11: {
791  this->entity_category = value.as_enum<enums::EntityCategory>();
792  return true;
793  }
794  default:
795  return false;
796  }
797 }
799  switch (field_id) {
800  case 1: {
801  this->object_id = value.as_string();
802  return true;
803  }
804  case 3: {
805  this->name = value.as_string();
806  return true;
807  }
808  case 4: {
809  this->unique_id = value.as_string();
810  return true;
811  }
812  case 8: {
813  this->device_class = value.as_string();
814  return true;
815  }
816  case 10: {
817  this->icon = value.as_string();
818  return true;
819  }
820  default:
821  return false;
822  }
823 }
824 bool ListEntitiesCoverResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
825  switch (field_id) {
826  case 2: {
827  this->key = value.as_fixed32();
828  return true;
829  }
830  default:
831  return false;
832  }
833 }
835  buffer.encode_string(1, this->object_id);
836  buffer.encode_fixed32(2, this->key);
837  buffer.encode_string(3, this->name);
838  buffer.encode_string(4, this->unique_id);
839  buffer.encode_bool(5, this->assumed_state);
840  buffer.encode_bool(6, this->supports_position);
841  buffer.encode_bool(7, this->supports_tilt);
842  buffer.encode_string(8, this->device_class);
843  buffer.encode_bool(9, this->disabled_by_default);
844  buffer.encode_string(10, this->icon);
845  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
846 }
847 #ifdef HAS_PROTO_MESSAGE_DUMP
848 void ListEntitiesCoverResponse::dump_to(std::string &out) const {
849  __attribute__((unused)) char buffer[64];
850  out.append("ListEntitiesCoverResponse {\n");
851  out.append(" object_id: ");
852  out.append("'").append(this->object_id).append("'");
853  out.append("\n");
854 
855  out.append(" key: ");
856  sprintf(buffer, "%u", this->key);
857  out.append(buffer);
858  out.append("\n");
859 
860  out.append(" name: ");
861  out.append("'").append(this->name).append("'");
862  out.append("\n");
863 
864  out.append(" unique_id: ");
865  out.append("'").append(this->unique_id).append("'");
866  out.append("\n");
867 
868  out.append(" assumed_state: ");
869  out.append(YESNO(this->assumed_state));
870  out.append("\n");
871 
872  out.append(" supports_position: ");
873  out.append(YESNO(this->supports_position));
874  out.append("\n");
875 
876  out.append(" supports_tilt: ");
877  out.append(YESNO(this->supports_tilt));
878  out.append("\n");
879 
880  out.append(" device_class: ");
881  out.append("'").append(this->device_class).append("'");
882  out.append("\n");
883 
884  out.append(" disabled_by_default: ");
885  out.append(YESNO(this->disabled_by_default));
886  out.append("\n");
887 
888  out.append(" icon: ");
889  out.append("'").append(this->icon).append("'");
890  out.append("\n");
891 
892  out.append(" entity_category: ");
893  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
894  out.append("\n");
895  out.append("}");
896 }
897 #endif
898 bool CoverStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
899  switch (field_id) {
900  case 2: {
901  this->legacy_state = value.as_enum<enums::LegacyCoverState>();
902  return true;
903  }
904  case 5: {
905  this->current_operation = value.as_enum<enums::CoverOperation>();
906  return true;
907  }
908  default:
909  return false;
910  }
911 }
912 bool CoverStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
913  switch (field_id) {
914  case 1: {
915  this->key = value.as_fixed32();
916  return true;
917  }
918  case 3: {
919  this->position = value.as_float();
920  return true;
921  }
922  case 4: {
923  this->tilt = value.as_float();
924  return true;
925  }
926  default:
927  return false;
928  }
929 }
931  buffer.encode_fixed32(1, this->key);
932  buffer.encode_enum<enums::LegacyCoverState>(2, this->legacy_state);
933  buffer.encode_float(3, this->position);
934  buffer.encode_float(4, this->tilt);
935  buffer.encode_enum<enums::CoverOperation>(5, this->current_operation);
936 }
937 #ifdef HAS_PROTO_MESSAGE_DUMP
938 void CoverStateResponse::dump_to(std::string &out) const {
939  __attribute__((unused)) char buffer[64];
940  out.append("CoverStateResponse {\n");
941  out.append(" key: ");
942  sprintf(buffer, "%u", this->key);
943  out.append(buffer);
944  out.append("\n");
945 
946  out.append(" legacy_state: ");
947  out.append(proto_enum_to_string<enums::LegacyCoverState>(this->legacy_state));
948  out.append("\n");
949 
950  out.append(" position: ");
951  sprintf(buffer, "%g", this->position);
952  out.append(buffer);
953  out.append("\n");
954 
955  out.append(" tilt: ");
956  sprintf(buffer, "%g", this->tilt);
957  out.append(buffer);
958  out.append("\n");
959 
960  out.append(" current_operation: ");
961  out.append(proto_enum_to_string<enums::CoverOperation>(this->current_operation));
962  out.append("\n");
963  out.append("}");
964 }
965 #endif
966 bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
967  switch (field_id) {
968  case 2: {
969  this->has_legacy_command = value.as_bool();
970  return true;
971  }
972  case 3: {
973  this->legacy_command = value.as_enum<enums::LegacyCoverCommand>();
974  return true;
975  }
976  case 4: {
977  this->has_position = value.as_bool();
978  return true;
979  }
980  case 6: {
981  this->has_tilt = value.as_bool();
982  return true;
983  }
984  case 8: {
985  this->stop = value.as_bool();
986  return true;
987  }
988  default:
989  return false;
990  }
991 }
992 bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
993  switch (field_id) {
994  case 1: {
995  this->key = value.as_fixed32();
996  return true;
997  }
998  case 5: {
999  this->position = value.as_float();
1000  return true;
1001  }
1002  case 7: {
1003  this->tilt = value.as_float();
1004  return true;
1005  }
1006  default:
1007  return false;
1008  }
1009 }
1011  buffer.encode_fixed32(1, this->key);
1012  buffer.encode_bool(2, this->has_legacy_command);
1013  buffer.encode_enum<enums::LegacyCoverCommand>(3, this->legacy_command);
1014  buffer.encode_bool(4, this->has_position);
1015  buffer.encode_float(5, this->position);
1016  buffer.encode_bool(6, this->has_tilt);
1017  buffer.encode_float(7, this->tilt);
1018  buffer.encode_bool(8, this->stop);
1019 }
1020 #ifdef HAS_PROTO_MESSAGE_DUMP
1021 void CoverCommandRequest::dump_to(std::string &out) const {
1022  __attribute__((unused)) char buffer[64];
1023  out.append("CoverCommandRequest {\n");
1024  out.append(" key: ");
1025  sprintf(buffer, "%u", this->key);
1026  out.append(buffer);
1027  out.append("\n");
1028 
1029  out.append(" has_legacy_command: ");
1030  out.append(YESNO(this->has_legacy_command));
1031  out.append("\n");
1032 
1033  out.append(" legacy_command: ");
1034  out.append(proto_enum_to_string<enums::LegacyCoverCommand>(this->legacy_command));
1035  out.append("\n");
1036 
1037  out.append(" has_position: ");
1038  out.append(YESNO(this->has_position));
1039  out.append("\n");
1040 
1041  out.append(" position: ");
1042  sprintf(buffer, "%g", this->position);
1043  out.append(buffer);
1044  out.append("\n");
1045 
1046  out.append(" has_tilt: ");
1047  out.append(YESNO(this->has_tilt));
1048  out.append("\n");
1049 
1050  out.append(" tilt: ");
1051  sprintf(buffer, "%g", this->tilt);
1052  out.append(buffer);
1053  out.append("\n");
1054 
1055  out.append(" stop: ");
1056  out.append(YESNO(this->stop));
1057  out.append("\n");
1058  out.append("}");
1059 }
1060 #endif
1061 bool ListEntitiesFanResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1062  switch (field_id) {
1063  case 5: {
1064  this->supports_oscillation = value.as_bool();
1065  return true;
1066  }
1067  case 6: {
1068  this->supports_speed = value.as_bool();
1069  return true;
1070  }
1071  case 7: {
1072  this->supports_direction = value.as_bool();
1073  return true;
1074  }
1075  case 8: {
1076  this->supported_speed_count = value.as_int32();
1077  return true;
1078  }
1079  case 9: {
1080  this->disabled_by_default = value.as_bool();
1081  return true;
1082  }
1083  case 11: {
1084  this->entity_category = value.as_enum<enums::EntityCategory>();
1085  return true;
1086  }
1087  default:
1088  return false;
1089  }
1090 }
1092  switch (field_id) {
1093  case 1: {
1094  this->object_id = value.as_string();
1095  return true;
1096  }
1097  case 3: {
1098  this->name = value.as_string();
1099  return true;
1100  }
1101  case 4: {
1102  this->unique_id = value.as_string();
1103  return true;
1104  }
1105  case 10: {
1106  this->icon = value.as_string();
1107  return true;
1108  }
1109  default:
1110  return false;
1111  }
1112 }
1113 bool ListEntitiesFanResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1114  switch (field_id) {
1115  case 2: {
1116  this->key = value.as_fixed32();
1117  return true;
1118  }
1119  default:
1120  return false;
1121  }
1122 }
1124  buffer.encode_string(1, this->object_id);
1125  buffer.encode_fixed32(2, this->key);
1126  buffer.encode_string(3, this->name);
1127  buffer.encode_string(4, this->unique_id);
1128  buffer.encode_bool(5, this->supports_oscillation);
1129  buffer.encode_bool(6, this->supports_speed);
1130  buffer.encode_bool(7, this->supports_direction);
1131  buffer.encode_int32(8, this->supported_speed_count);
1132  buffer.encode_bool(9, this->disabled_by_default);
1133  buffer.encode_string(10, this->icon);
1134  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1135 }
1136 #ifdef HAS_PROTO_MESSAGE_DUMP
1137 void ListEntitiesFanResponse::dump_to(std::string &out) const {
1138  __attribute__((unused)) char buffer[64];
1139  out.append("ListEntitiesFanResponse {\n");
1140  out.append(" object_id: ");
1141  out.append("'").append(this->object_id).append("'");
1142  out.append("\n");
1143 
1144  out.append(" key: ");
1145  sprintf(buffer, "%u", this->key);
1146  out.append(buffer);
1147  out.append("\n");
1148 
1149  out.append(" name: ");
1150  out.append("'").append(this->name).append("'");
1151  out.append("\n");
1152 
1153  out.append(" unique_id: ");
1154  out.append("'").append(this->unique_id).append("'");
1155  out.append("\n");
1156 
1157  out.append(" supports_oscillation: ");
1158  out.append(YESNO(this->supports_oscillation));
1159  out.append("\n");
1160 
1161  out.append(" supports_speed: ");
1162  out.append(YESNO(this->supports_speed));
1163  out.append("\n");
1164 
1165  out.append(" supports_direction: ");
1166  out.append(YESNO(this->supports_direction));
1167  out.append("\n");
1168 
1169  out.append(" supported_speed_count: ");
1170  sprintf(buffer, "%d", this->supported_speed_count);
1171  out.append(buffer);
1172  out.append("\n");
1173 
1174  out.append(" disabled_by_default: ");
1175  out.append(YESNO(this->disabled_by_default));
1176  out.append("\n");
1177 
1178  out.append(" icon: ");
1179  out.append("'").append(this->icon).append("'");
1180  out.append("\n");
1181 
1182  out.append(" entity_category: ");
1183  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1184  out.append("\n");
1185  out.append("}");
1186 }
1187 #endif
1188 bool FanStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1189  switch (field_id) {
1190  case 2: {
1191  this->state = value.as_bool();
1192  return true;
1193  }
1194  case 3: {
1195  this->oscillating = value.as_bool();
1196  return true;
1197  }
1198  case 4: {
1199  this->speed = value.as_enum<enums::FanSpeed>();
1200  return true;
1201  }
1202  case 5: {
1203  this->direction = value.as_enum<enums::FanDirection>();
1204  return true;
1205  }
1206  case 6: {
1207  this->speed_level = value.as_int32();
1208  return true;
1209  }
1210  default:
1211  return false;
1212  }
1213 }
1214 bool FanStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1215  switch (field_id) {
1216  case 1: {
1217  this->key = value.as_fixed32();
1218  return true;
1219  }
1220  default:
1221  return false;
1222  }
1223 }
1225  buffer.encode_fixed32(1, this->key);
1226  buffer.encode_bool(2, this->state);
1227  buffer.encode_bool(3, this->oscillating);
1228  buffer.encode_enum<enums::FanSpeed>(4, this->speed);
1229  buffer.encode_enum<enums::FanDirection>(5, this->direction);
1230  buffer.encode_int32(6, this->speed_level);
1231 }
1232 #ifdef HAS_PROTO_MESSAGE_DUMP
1233 void FanStateResponse::dump_to(std::string &out) const {
1234  __attribute__((unused)) char buffer[64];
1235  out.append("FanStateResponse {\n");
1236  out.append(" key: ");
1237  sprintf(buffer, "%u", this->key);
1238  out.append(buffer);
1239  out.append("\n");
1240 
1241  out.append(" state: ");
1242  out.append(YESNO(this->state));
1243  out.append("\n");
1244 
1245  out.append(" oscillating: ");
1246  out.append(YESNO(this->oscillating));
1247  out.append("\n");
1248 
1249  out.append(" speed: ");
1250  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1251  out.append("\n");
1252 
1253  out.append(" direction: ");
1254  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1255  out.append("\n");
1256 
1257  out.append(" speed_level: ");
1258  sprintf(buffer, "%d", this->speed_level);
1259  out.append(buffer);
1260  out.append("\n");
1261  out.append("}");
1262 }
1263 #endif
1264 bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1265  switch (field_id) {
1266  case 2: {
1267  this->has_state = value.as_bool();
1268  return true;
1269  }
1270  case 3: {
1271  this->state = value.as_bool();
1272  return true;
1273  }
1274  case 4: {
1275  this->has_speed = value.as_bool();
1276  return true;
1277  }
1278  case 5: {
1279  this->speed = value.as_enum<enums::FanSpeed>();
1280  return true;
1281  }
1282  case 6: {
1283  this->has_oscillating = value.as_bool();
1284  return true;
1285  }
1286  case 7: {
1287  this->oscillating = value.as_bool();
1288  return true;
1289  }
1290  case 8: {
1291  this->has_direction = value.as_bool();
1292  return true;
1293  }
1294  case 9: {
1295  this->direction = value.as_enum<enums::FanDirection>();
1296  return true;
1297  }
1298  case 10: {
1299  this->has_speed_level = value.as_bool();
1300  return true;
1301  }
1302  case 11: {
1303  this->speed_level = value.as_int32();
1304  return true;
1305  }
1306  default:
1307  return false;
1308  }
1309 }
1310 bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1311  switch (field_id) {
1312  case 1: {
1313  this->key = value.as_fixed32();
1314  return true;
1315  }
1316  default:
1317  return false;
1318  }
1319 }
1321  buffer.encode_fixed32(1, this->key);
1322  buffer.encode_bool(2, this->has_state);
1323  buffer.encode_bool(3, this->state);
1324  buffer.encode_bool(4, this->has_speed);
1325  buffer.encode_enum<enums::FanSpeed>(5, this->speed);
1326  buffer.encode_bool(6, this->has_oscillating);
1327  buffer.encode_bool(7, this->oscillating);
1328  buffer.encode_bool(8, this->has_direction);
1329  buffer.encode_enum<enums::FanDirection>(9, this->direction);
1330  buffer.encode_bool(10, this->has_speed_level);
1331  buffer.encode_int32(11, this->speed_level);
1332 }
1333 #ifdef HAS_PROTO_MESSAGE_DUMP
1334 void FanCommandRequest::dump_to(std::string &out) const {
1335  __attribute__((unused)) char buffer[64];
1336  out.append("FanCommandRequest {\n");
1337  out.append(" key: ");
1338  sprintf(buffer, "%u", this->key);
1339  out.append(buffer);
1340  out.append("\n");
1341 
1342  out.append(" has_state: ");
1343  out.append(YESNO(this->has_state));
1344  out.append("\n");
1345 
1346  out.append(" state: ");
1347  out.append(YESNO(this->state));
1348  out.append("\n");
1349 
1350  out.append(" has_speed: ");
1351  out.append(YESNO(this->has_speed));
1352  out.append("\n");
1353 
1354  out.append(" speed: ");
1355  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1356  out.append("\n");
1357 
1358  out.append(" has_oscillating: ");
1359  out.append(YESNO(this->has_oscillating));
1360  out.append("\n");
1361 
1362  out.append(" oscillating: ");
1363  out.append(YESNO(this->oscillating));
1364  out.append("\n");
1365 
1366  out.append(" has_direction: ");
1367  out.append(YESNO(this->has_direction));
1368  out.append("\n");
1369 
1370  out.append(" direction: ");
1371  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1372  out.append("\n");
1373 
1374  out.append(" has_speed_level: ");
1375  out.append(YESNO(this->has_speed_level));
1376  out.append("\n");
1377 
1378  out.append(" speed_level: ");
1379  sprintf(buffer, "%d", this->speed_level);
1380  out.append(buffer);
1381  out.append("\n");
1382  out.append("}");
1383 }
1384 #endif
1386  switch (field_id) {
1387  case 12: {
1388  this->supported_color_modes.push_back(value.as_enum<enums::ColorMode>());
1389  return true;
1390  }
1391  case 5: {
1392  this->legacy_supports_brightness = value.as_bool();
1393  return true;
1394  }
1395  case 6: {
1396  this->legacy_supports_rgb = value.as_bool();
1397  return true;
1398  }
1399  case 7: {
1400  this->legacy_supports_white_value = value.as_bool();
1401  return true;
1402  }
1403  case 8: {
1404  this->legacy_supports_color_temperature = value.as_bool();
1405  return true;
1406  }
1407  case 13: {
1408  this->disabled_by_default = value.as_bool();
1409  return true;
1410  }
1411  case 15: {
1412  this->entity_category = value.as_enum<enums::EntityCategory>();
1413  return true;
1414  }
1415  default:
1416  return false;
1417  }
1418 }
1420  switch (field_id) {
1421  case 1: {
1422  this->object_id = value.as_string();
1423  return true;
1424  }
1425  case 3: {
1426  this->name = value.as_string();
1427  return true;
1428  }
1429  case 4: {
1430  this->unique_id = value.as_string();
1431  return true;
1432  }
1433  case 11: {
1434  this->effects.push_back(value.as_string());
1435  return true;
1436  }
1437  case 14: {
1438  this->icon = value.as_string();
1439  return true;
1440  }
1441  default:
1442  return false;
1443  }
1444 }
1445 bool ListEntitiesLightResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1446  switch (field_id) {
1447  case 2: {
1448  this->key = value.as_fixed32();
1449  return true;
1450  }
1451  case 9: {
1452  this->min_mireds = value.as_float();
1453  return true;
1454  }
1455  case 10: {
1456  this->max_mireds = value.as_float();
1457  return true;
1458  }
1459  default:
1460  return false;
1461  }
1462 }
1464  buffer.encode_string(1, this->object_id);
1465  buffer.encode_fixed32(2, this->key);
1466  buffer.encode_string(3, this->name);
1467  buffer.encode_string(4, this->unique_id);
1468  for (auto &it : this->supported_color_modes) {
1469  buffer.encode_enum<enums::ColorMode>(12, it, true);
1470  }
1471  buffer.encode_bool(5, this->legacy_supports_brightness);
1472  buffer.encode_bool(6, this->legacy_supports_rgb);
1473  buffer.encode_bool(7, this->legacy_supports_white_value);
1474  buffer.encode_bool(8, this->legacy_supports_color_temperature);
1475  buffer.encode_float(9, this->min_mireds);
1476  buffer.encode_float(10, this->max_mireds);
1477  for (auto &it : this->effects) {
1478  buffer.encode_string(11, it, true);
1479  }
1480  buffer.encode_bool(13, this->disabled_by_default);
1481  buffer.encode_string(14, this->icon);
1482  buffer.encode_enum<enums::EntityCategory>(15, this->entity_category);
1483 }
1484 #ifdef HAS_PROTO_MESSAGE_DUMP
1485 void ListEntitiesLightResponse::dump_to(std::string &out) const {
1486  __attribute__((unused)) char buffer[64];
1487  out.append("ListEntitiesLightResponse {\n");
1488  out.append(" object_id: ");
1489  out.append("'").append(this->object_id).append("'");
1490  out.append("\n");
1491 
1492  out.append(" key: ");
1493  sprintf(buffer, "%u", this->key);
1494  out.append(buffer);
1495  out.append("\n");
1496 
1497  out.append(" name: ");
1498  out.append("'").append(this->name).append("'");
1499  out.append("\n");
1500 
1501  out.append(" unique_id: ");
1502  out.append("'").append(this->unique_id).append("'");
1503  out.append("\n");
1504 
1505  for (const auto &it : this->supported_color_modes) {
1506  out.append(" supported_color_modes: ");
1507  out.append(proto_enum_to_string<enums::ColorMode>(it));
1508  out.append("\n");
1509  }
1510 
1511  out.append(" legacy_supports_brightness: ");
1512  out.append(YESNO(this->legacy_supports_brightness));
1513  out.append("\n");
1514 
1515  out.append(" legacy_supports_rgb: ");
1516  out.append(YESNO(this->legacy_supports_rgb));
1517  out.append("\n");
1518 
1519  out.append(" legacy_supports_white_value: ");
1520  out.append(YESNO(this->legacy_supports_white_value));
1521  out.append("\n");
1522 
1523  out.append(" legacy_supports_color_temperature: ");
1524  out.append(YESNO(this->legacy_supports_color_temperature));
1525  out.append("\n");
1526 
1527  out.append(" min_mireds: ");
1528  sprintf(buffer, "%g", this->min_mireds);
1529  out.append(buffer);
1530  out.append("\n");
1531 
1532  out.append(" max_mireds: ");
1533  sprintf(buffer, "%g", this->max_mireds);
1534  out.append(buffer);
1535  out.append("\n");
1536 
1537  for (const auto &it : this->effects) {
1538  out.append(" effects: ");
1539  out.append("'").append(it).append("'");
1540  out.append("\n");
1541  }
1542 
1543  out.append(" disabled_by_default: ");
1544  out.append(YESNO(this->disabled_by_default));
1545  out.append("\n");
1546 
1547  out.append(" icon: ");
1548  out.append("'").append(this->icon).append("'");
1549  out.append("\n");
1550 
1551  out.append(" entity_category: ");
1552  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1553  out.append("\n");
1554  out.append("}");
1555 }
1556 #endif
1557 bool LightStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1558  switch (field_id) {
1559  case 2: {
1560  this->state = value.as_bool();
1561  return true;
1562  }
1563  case 11: {
1564  this->color_mode = value.as_enum<enums::ColorMode>();
1565  return true;
1566  }
1567  default:
1568  return false;
1569  }
1570 }
1572  switch (field_id) {
1573  case 9: {
1574  this->effect = value.as_string();
1575  return true;
1576  }
1577  default:
1578  return false;
1579  }
1580 }
1581 bool LightStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1582  switch (field_id) {
1583  case 1: {
1584  this->key = value.as_fixed32();
1585  return true;
1586  }
1587  case 3: {
1588  this->brightness = value.as_float();
1589  return true;
1590  }
1591  case 10: {
1592  this->color_brightness = value.as_float();
1593  return true;
1594  }
1595  case 4: {
1596  this->red = value.as_float();
1597  return true;
1598  }
1599  case 5: {
1600  this->green = value.as_float();
1601  return true;
1602  }
1603  case 6: {
1604  this->blue = value.as_float();
1605  return true;
1606  }
1607  case 7: {
1608  this->white = value.as_float();
1609  return true;
1610  }
1611  case 8: {
1612  this->color_temperature = value.as_float();
1613  return true;
1614  }
1615  case 12: {
1616  this->cold_white = value.as_float();
1617  return true;
1618  }
1619  case 13: {
1620  this->warm_white = value.as_float();
1621  return true;
1622  }
1623  default:
1624  return false;
1625  }
1626 }
1628  buffer.encode_fixed32(1, this->key);
1629  buffer.encode_bool(2, this->state);
1630  buffer.encode_float(3, this->brightness);
1631  buffer.encode_enum<enums::ColorMode>(11, this->color_mode);
1632  buffer.encode_float(10, this->color_brightness);
1633  buffer.encode_float(4, this->red);
1634  buffer.encode_float(5, this->green);
1635  buffer.encode_float(6, this->blue);
1636  buffer.encode_float(7, this->white);
1637  buffer.encode_float(8, this->color_temperature);
1638  buffer.encode_float(12, this->cold_white);
1639  buffer.encode_float(13, this->warm_white);
1640  buffer.encode_string(9, this->effect);
1641 }
1642 #ifdef HAS_PROTO_MESSAGE_DUMP
1643 void LightStateResponse::dump_to(std::string &out) const {
1644  __attribute__((unused)) char buffer[64];
1645  out.append("LightStateResponse {\n");
1646  out.append(" key: ");
1647  sprintf(buffer, "%u", this->key);
1648  out.append(buffer);
1649  out.append("\n");
1650 
1651  out.append(" state: ");
1652  out.append(YESNO(this->state));
1653  out.append("\n");
1654 
1655  out.append(" brightness: ");
1656  sprintf(buffer, "%g", this->brightness);
1657  out.append(buffer);
1658  out.append("\n");
1659 
1660  out.append(" color_mode: ");
1661  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
1662  out.append("\n");
1663 
1664  out.append(" color_brightness: ");
1665  sprintf(buffer, "%g", this->color_brightness);
1666  out.append(buffer);
1667  out.append("\n");
1668 
1669  out.append(" red: ");
1670  sprintf(buffer, "%g", this->red);
1671  out.append(buffer);
1672  out.append("\n");
1673 
1674  out.append(" green: ");
1675  sprintf(buffer, "%g", this->green);
1676  out.append(buffer);
1677  out.append("\n");
1678 
1679  out.append(" blue: ");
1680  sprintf(buffer, "%g", this->blue);
1681  out.append(buffer);
1682  out.append("\n");
1683 
1684  out.append(" white: ");
1685  sprintf(buffer, "%g", this->white);
1686  out.append(buffer);
1687  out.append("\n");
1688 
1689  out.append(" color_temperature: ");
1690  sprintf(buffer, "%g", this->color_temperature);
1691  out.append(buffer);
1692  out.append("\n");
1693 
1694  out.append(" cold_white: ");
1695  sprintf(buffer, "%g", this->cold_white);
1696  out.append(buffer);
1697  out.append("\n");
1698 
1699  out.append(" warm_white: ");
1700  sprintf(buffer, "%g", this->warm_white);
1701  out.append(buffer);
1702  out.append("\n");
1703 
1704  out.append(" effect: ");
1705  out.append("'").append(this->effect).append("'");
1706  out.append("\n");
1707  out.append("}");
1708 }
1709 #endif
1710 bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1711  switch (field_id) {
1712  case 2: {
1713  this->has_state = value.as_bool();
1714  return true;
1715  }
1716  case 3: {
1717  this->state = value.as_bool();
1718  return true;
1719  }
1720  case 4: {
1721  this->has_brightness = value.as_bool();
1722  return true;
1723  }
1724  case 22: {
1725  this->has_color_mode = value.as_bool();
1726  return true;
1727  }
1728  case 23: {
1729  this->color_mode = value.as_enum<enums::ColorMode>();
1730  return true;
1731  }
1732  case 20: {
1733  this->has_color_brightness = value.as_bool();
1734  return true;
1735  }
1736  case 6: {
1737  this->has_rgb = value.as_bool();
1738  return true;
1739  }
1740  case 10: {
1741  this->has_white = value.as_bool();
1742  return true;
1743  }
1744  case 12: {
1745  this->has_color_temperature = value.as_bool();
1746  return true;
1747  }
1748  case 24: {
1749  this->has_cold_white = value.as_bool();
1750  return true;
1751  }
1752  case 26: {
1753  this->has_warm_white = value.as_bool();
1754  return true;
1755  }
1756  case 14: {
1757  this->has_transition_length = value.as_bool();
1758  return true;
1759  }
1760  case 15: {
1761  this->transition_length = value.as_uint32();
1762  return true;
1763  }
1764  case 16: {
1765  this->has_flash_length = value.as_bool();
1766  return true;
1767  }
1768  case 17: {
1769  this->flash_length = value.as_uint32();
1770  return true;
1771  }
1772  case 18: {
1773  this->has_effect = value.as_bool();
1774  return true;
1775  }
1776  default:
1777  return false;
1778  }
1779 }
1781  switch (field_id) {
1782  case 19: {
1783  this->effect = value.as_string();
1784  return true;
1785  }
1786  default:
1787  return false;
1788  }
1789 }
1790 bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1791  switch (field_id) {
1792  case 1: {
1793  this->key = value.as_fixed32();
1794  return true;
1795  }
1796  case 5: {
1797  this->brightness = value.as_float();
1798  return true;
1799  }
1800  case 21: {
1801  this->color_brightness = value.as_float();
1802  return true;
1803  }
1804  case 7: {
1805  this->red = value.as_float();
1806  return true;
1807  }
1808  case 8: {
1809  this->green = value.as_float();
1810  return true;
1811  }
1812  case 9: {
1813  this->blue = value.as_float();
1814  return true;
1815  }
1816  case 11: {
1817  this->white = value.as_float();
1818  return true;
1819  }
1820  case 13: {
1821  this->color_temperature = value.as_float();
1822  return true;
1823  }
1824  case 25: {
1825  this->cold_white = value.as_float();
1826  return true;
1827  }
1828  case 27: {
1829  this->warm_white = value.as_float();
1830  return true;
1831  }
1832  default:
1833  return false;
1834  }
1835 }
1837  buffer.encode_fixed32(1, this->key);
1838  buffer.encode_bool(2, this->has_state);
1839  buffer.encode_bool(3, this->state);
1840  buffer.encode_bool(4, this->has_brightness);
1841  buffer.encode_float(5, this->brightness);
1842  buffer.encode_bool(22, this->has_color_mode);
1843  buffer.encode_enum<enums::ColorMode>(23, this->color_mode);
1844  buffer.encode_bool(20, this->has_color_brightness);
1845  buffer.encode_float(21, this->color_brightness);
1846  buffer.encode_bool(6, this->has_rgb);
1847  buffer.encode_float(7, this->red);
1848  buffer.encode_float(8, this->green);
1849  buffer.encode_float(9, this->blue);
1850  buffer.encode_bool(10, this->has_white);
1851  buffer.encode_float(11, this->white);
1852  buffer.encode_bool(12, this->has_color_temperature);
1853  buffer.encode_float(13, this->color_temperature);
1854  buffer.encode_bool(24, this->has_cold_white);
1855  buffer.encode_float(25, this->cold_white);
1856  buffer.encode_bool(26, this->has_warm_white);
1857  buffer.encode_float(27, this->warm_white);
1858  buffer.encode_bool(14, this->has_transition_length);
1859  buffer.encode_uint32(15, this->transition_length);
1860  buffer.encode_bool(16, this->has_flash_length);
1861  buffer.encode_uint32(17, this->flash_length);
1862  buffer.encode_bool(18, this->has_effect);
1863  buffer.encode_string(19, this->effect);
1864 }
1865 #ifdef HAS_PROTO_MESSAGE_DUMP
1866 void LightCommandRequest::dump_to(std::string &out) const {
1867  __attribute__((unused)) char buffer[64];
1868  out.append("LightCommandRequest {\n");
1869  out.append(" key: ");
1870  sprintf(buffer, "%u", this->key);
1871  out.append(buffer);
1872  out.append("\n");
1873 
1874  out.append(" has_state: ");
1875  out.append(YESNO(this->has_state));
1876  out.append("\n");
1877 
1878  out.append(" state: ");
1879  out.append(YESNO(this->state));
1880  out.append("\n");
1881 
1882  out.append(" has_brightness: ");
1883  out.append(YESNO(this->has_brightness));
1884  out.append("\n");
1885 
1886  out.append(" brightness: ");
1887  sprintf(buffer, "%g", this->brightness);
1888  out.append(buffer);
1889  out.append("\n");
1890 
1891  out.append(" has_color_mode: ");
1892  out.append(YESNO(this->has_color_mode));
1893  out.append("\n");
1894 
1895  out.append(" color_mode: ");
1896  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
1897  out.append("\n");
1898 
1899  out.append(" has_color_brightness: ");
1900  out.append(YESNO(this->has_color_brightness));
1901  out.append("\n");
1902 
1903  out.append(" color_brightness: ");
1904  sprintf(buffer, "%g", this->color_brightness);
1905  out.append(buffer);
1906  out.append("\n");
1907 
1908  out.append(" has_rgb: ");
1909  out.append(YESNO(this->has_rgb));
1910  out.append("\n");
1911 
1912  out.append(" red: ");
1913  sprintf(buffer, "%g", this->red);
1914  out.append(buffer);
1915  out.append("\n");
1916 
1917  out.append(" green: ");
1918  sprintf(buffer, "%g", this->green);
1919  out.append(buffer);
1920  out.append("\n");
1921 
1922  out.append(" blue: ");
1923  sprintf(buffer, "%g", this->blue);
1924  out.append(buffer);
1925  out.append("\n");
1926 
1927  out.append(" has_white: ");
1928  out.append(YESNO(this->has_white));
1929  out.append("\n");
1930 
1931  out.append(" white: ");
1932  sprintf(buffer, "%g", this->white);
1933  out.append(buffer);
1934  out.append("\n");
1935 
1936  out.append(" has_color_temperature: ");
1937  out.append(YESNO(this->has_color_temperature));
1938  out.append("\n");
1939 
1940  out.append(" color_temperature: ");
1941  sprintf(buffer, "%g", this->color_temperature);
1942  out.append(buffer);
1943  out.append("\n");
1944 
1945  out.append(" has_cold_white: ");
1946  out.append(YESNO(this->has_cold_white));
1947  out.append("\n");
1948 
1949  out.append(" cold_white: ");
1950  sprintf(buffer, "%g", this->cold_white);
1951  out.append(buffer);
1952  out.append("\n");
1953 
1954  out.append(" has_warm_white: ");
1955  out.append(YESNO(this->has_warm_white));
1956  out.append("\n");
1957 
1958  out.append(" warm_white: ");
1959  sprintf(buffer, "%g", this->warm_white);
1960  out.append(buffer);
1961  out.append("\n");
1962 
1963  out.append(" has_transition_length: ");
1964  out.append(YESNO(this->has_transition_length));
1965  out.append("\n");
1966 
1967  out.append(" transition_length: ");
1968  sprintf(buffer, "%u", this->transition_length);
1969  out.append(buffer);
1970  out.append("\n");
1971 
1972  out.append(" has_flash_length: ");
1973  out.append(YESNO(this->has_flash_length));
1974  out.append("\n");
1975 
1976  out.append(" flash_length: ");
1977  sprintf(buffer, "%u", this->flash_length);
1978  out.append(buffer);
1979  out.append("\n");
1980 
1981  out.append(" has_effect: ");
1982  out.append(YESNO(this->has_effect));
1983  out.append("\n");
1984 
1985  out.append(" effect: ");
1986  out.append("'").append(this->effect).append("'");
1987  out.append("\n");
1988  out.append("}");
1989 }
1990 #endif
1992  switch (field_id) {
1993  case 7: {
1994  this->accuracy_decimals = value.as_int32();
1995  return true;
1996  }
1997  case 8: {
1998  this->force_update = value.as_bool();
1999  return true;
2000  }
2001  case 10: {
2002  this->state_class = value.as_enum<enums::SensorStateClass>();
2003  return true;
2004  }
2005  case 11: {
2006  this->legacy_last_reset_type = value.as_enum<enums::SensorLastResetType>();
2007  return true;
2008  }
2009  case 12: {
2010  this->disabled_by_default = value.as_bool();
2011  return true;
2012  }
2013  case 13: {
2014  this->entity_category = value.as_enum<enums::EntityCategory>();
2015  return true;
2016  }
2017  default:
2018  return false;
2019  }
2020 }
2022  switch (field_id) {
2023  case 1: {
2024  this->object_id = value.as_string();
2025  return true;
2026  }
2027  case 3: {
2028  this->name = value.as_string();
2029  return true;
2030  }
2031  case 4: {
2032  this->unique_id = value.as_string();
2033  return true;
2034  }
2035  case 5: {
2036  this->icon = value.as_string();
2037  return true;
2038  }
2039  case 6: {
2040  this->unit_of_measurement = value.as_string();
2041  return true;
2042  }
2043  case 9: {
2044  this->device_class = value.as_string();
2045  return true;
2046  }
2047  default:
2048  return false;
2049  }
2050 }
2052  switch (field_id) {
2053  case 2: {
2054  this->key = value.as_fixed32();
2055  return true;
2056  }
2057  default:
2058  return false;
2059  }
2060 }
2062  buffer.encode_string(1, this->object_id);
2063  buffer.encode_fixed32(2, this->key);
2064  buffer.encode_string(3, this->name);
2065  buffer.encode_string(4, this->unique_id);
2066  buffer.encode_string(5, this->icon);
2067  buffer.encode_string(6, this->unit_of_measurement);
2068  buffer.encode_int32(7, this->accuracy_decimals);
2069  buffer.encode_bool(8, this->force_update);
2070  buffer.encode_string(9, this->device_class);
2071  buffer.encode_enum<enums::SensorStateClass>(10, this->state_class);
2072  buffer.encode_enum<enums::SensorLastResetType>(11, this->legacy_last_reset_type);
2073  buffer.encode_bool(12, this->disabled_by_default);
2074  buffer.encode_enum<enums::EntityCategory>(13, this->entity_category);
2075 }
2076 #ifdef HAS_PROTO_MESSAGE_DUMP
2077 void ListEntitiesSensorResponse::dump_to(std::string &out) const {
2078  __attribute__((unused)) char buffer[64];
2079  out.append("ListEntitiesSensorResponse {\n");
2080  out.append(" object_id: ");
2081  out.append("'").append(this->object_id).append("'");
2082  out.append("\n");
2083 
2084  out.append(" key: ");
2085  sprintf(buffer, "%u", this->key);
2086  out.append(buffer);
2087  out.append("\n");
2088 
2089  out.append(" name: ");
2090  out.append("'").append(this->name).append("'");
2091  out.append("\n");
2092 
2093  out.append(" unique_id: ");
2094  out.append("'").append(this->unique_id).append("'");
2095  out.append("\n");
2096 
2097  out.append(" icon: ");
2098  out.append("'").append(this->icon).append("'");
2099  out.append("\n");
2100 
2101  out.append(" unit_of_measurement: ");
2102  out.append("'").append(this->unit_of_measurement).append("'");
2103  out.append("\n");
2104 
2105  out.append(" accuracy_decimals: ");
2106  sprintf(buffer, "%d", this->accuracy_decimals);
2107  out.append(buffer);
2108  out.append("\n");
2109 
2110  out.append(" force_update: ");
2111  out.append(YESNO(this->force_update));
2112  out.append("\n");
2113 
2114  out.append(" device_class: ");
2115  out.append("'").append(this->device_class).append("'");
2116  out.append("\n");
2117 
2118  out.append(" state_class: ");
2119  out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
2120  out.append("\n");
2121 
2122  out.append(" legacy_last_reset_type: ");
2123  out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type));
2124  out.append("\n");
2125 
2126  out.append(" disabled_by_default: ");
2127  out.append(YESNO(this->disabled_by_default));
2128  out.append("\n");
2129 
2130  out.append(" entity_category: ");
2131  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2132  out.append("\n");
2133  out.append("}");
2134 }
2135 #endif
2136 bool SensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2137  switch (field_id) {
2138  case 3: {
2139  this->missing_state = value.as_bool();
2140  return true;
2141  }
2142  default:
2143  return false;
2144  }
2145 }
2146 bool SensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2147  switch (field_id) {
2148  case 1: {
2149  this->key = value.as_fixed32();
2150  return true;
2151  }
2152  case 2: {
2153  this->state = value.as_float();
2154  return true;
2155  }
2156  default:
2157  return false;
2158  }
2159 }
2161  buffer.encode_fixed32(1, this->key);
2162  buffer.encode_float(2, this->state);
2163  buffer.encode_bool(3, this->missing_state);
2164 }
2165 #ifdef HAS_PROTO_MESSAGE_DUMP
2166 void SensorStateResponse::dump_to(std::string &out) const {
2167  __attribute__((unused)) char buffer[64];
2168  out.append("SensorStateResponse {\n");
2169  out.append(" key: ");
2170  sprintf(buffer, "%u", this->key);
2171  out.append(buffer);
2172  out.append("\n");
2173 
2174  out.append(" state: ");
2175  sprintf(buffer, "%g", this->state);
2176  out.append(buffer);
2177  out.append("\n");
2178 
2179  out.append(" missing_state: ");
2180  out.append(YESNO(this->missing_state));
2181  out.append("\n");
2182  out.append("}");
2183 }
2184 #endif
2186  switch (field_id) {
2187  case 6: {
2188  this->assumed_state = value.as_bool();
2189  return true;
2190  }
2191  case 7: {
2192  this->disabled_by_default = value.as_bool();
2193  return true;
2194  }
2195  case 8: {
2196  this->entity_category = value.as_enum<enums::EntityCategory>();
2197  return true;
2198  }
2199  default:
2200  return false;
2201  }
2202 }
2204  switch (field_id) {
2205  case 1: {
2206  this->object_id = value.as_string();
2207  return true;
2208  }
2209  case 3: {
2210  this->name = value.as_string();
2211  return true;
2212  }
2213  case 4: {
2214  this->unique_id = value.as_string();
2215  return true;
2216  }
2217  case 5: {
2218  this->icon = value.as_string();
2219  return true;
2220  }
2221  case 9: {
2222  this->device_class = value.as_string();
2223  return true;
2224  }
2225  default:
2226  return false;
2227  }
2228 }
2230  switch (field_id) {
2231  case 2: {
2232  this->key = value.as_fixed32();
2233  return true;
2234  }
2235  default:
2236  return false;
2237  }
2238 }
2240  buffer.encode_string(1, this->object_id);
2241  buffer.encode_fixed32(2, this->key);
2242  buffer.encode_string(3, this->name);
2243  buffer.encode_string(4, this->unique_id);
2244  buffer.encode_string(5, this->icon);
2245  buffer.encode_bool(6, this->assumed_state);
2246  buffer.encode_bool(7, this->disabled_by_default);
2247  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
2248  buffer.encode_string(9, this->device_class);
2249 }
2250 #ifdef HAS_PROTO_MESSAGE_DUMP
2251 void ListEntitiesSwitchResponse::dump_to(std::string &out) const {
2252  __attribute__((unused)) char buffer[64];
2253  out.append("ListEntitiesSwitchResponse {\n");
2254  out.append(" object_id: ");
2255  out.append("'").append(this->object_id).append("'");
2256  out.append("\n");
2257 
2258  out.append(" key: ");
2259  sprintf(buffer, "%u", this->key);
2260  out.append(buffer);
2261  out.append("\n");
2262 
2263  out.append(" name: ");
2264  out.append("'").append(this->name).append("'");
2265  out.append("\n");
2266 
2267  out.append(" unique_id: ");
2268  out.append("'").append(this->unique_id).append("'");
2269  out.append("\n");
2270 
2271  out.append(" icon: ");
2272  out.append("'").append(this->icon).append("'");
2273  out.append("\n");
2274 
2275  out.append(" assumed_state: ");
2276  out.append(YESNO(this->assumed_state));
2277  out.append("\n");
2278 
2279  out.append(" disabled_by_default: ");
2280  out.append(YESNO(this->disabled_by_default));
2281  out.append("\n");
2282 
2283  out.append(" entity_category: ");
2284  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2285  out.append("\n");
2286 
2287  out.append(" device_class: ");
2288  out.append("'").append(this->device_class).append("'");
2289  out.append("\n");
2290  out.append("}");
2291 }
2292 #endif
2293 bool SwitchStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2294  switch (field_id) {
2295  case 2: {
2296  this->state = value.as_bool();
2297  return true;
2298  }
2299  default:
2300  return false;
2301  }
2302 }
2303 bool SwitchStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2304  switch (field_id) {
2305  case 1: {
2306  this->key = value.as_fixed32();
2307  return true;
2308  }
2309  default:
2310  return false;
2311  }
2312 }
2314  buffer.encode_fixed32(1, this->key);
2315  buffer.encode_bool(2, this->state);
2316 }
2317 #ifdef HAS_PROTO_MESSAGE_DUMP
2318 void SwitchStateResponse::dump_to(std::string &out) const {
2319  __attribute__((unused)) char buffer[64];
2320  out.append("SwitchStateResponse {\n");
2321  out.append(" key: ");
2322  sprintf(buffer, "%u", this->key);
2323  out.append(buffer);
2324  out.append("\n");
2325 
2326  out.append(" state: ");
2327  out.append(YESNO(this->state));
2328  out.append("\n");
2329  out.append("}");
2330 }
2331 #endif
2332 bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2333  switch (field_id) {
2334  case 2: {
2335  this->state = value.as_bool();
2336  return true;
2337  }
2338  default:
2339  return false;
2340  }
2341 }
2342 bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2343  switch (field_id) {
2344  case 1: {
2345  this->key = value.as_fixed32();
2346  return true;
2347  }
2348  default:
2349  return false;
2350  }
2351 }
2353  buffer.encode_fixed32(1, this->key);
2354  buffer.encode_bool(2, this->state);
2355 }
2356 #ifdef HAS_PROTO_MESSAGE_DUMP
2357 void SwitchCommandRequest::dump_to(std::string &out) const {
2358  __attribute__((unused)) char buffer[64];
2359  out.append("SwitchCommandRequest {\n");
2360  out.append(" key: ");
2361  sprintf(buffer, "%u", this->key);
2362  out.append(buffer);
2363  out.append("\n");
2364 
2365  out.append(" state: ");
2366  out.append(YESNO(this->state));
2367  out.append("\n");
2368  out.append("}");
2369 }
2370 #endif
2372  switch (field_id) {
2373  case 6: {
2374  this->disabled_by_default = value.as_bool();
2375  return true;
2376  }
2377  case 7: {
2378  this->entity_category = value.as_enum<enums::EntityCategory>();
2379  return true;
2380  }
2381  default:
2382  return false;
2383  }
2384 }
2386  switch (field_id) {
2387  case 1: {
2388  this->object_id = value.as_string();
2389  return true;
2390  }
2391  case 3: {
2392  this->name = value.as_string();
2393  return true;
2394  }
2395  case 4: {
2396  this->unique_id = value.as_string();
2397  return true;
2398  }
2399  case 5: {
2400  this->icon = value.as_string();
2401  return true;
2402  }
2403  default:
2404  return false;
2405  }
2406 }
2408  switch (field_id) {
2409  case 2: {
2410  this->key = value.as_fixed32();
2411  return true;
2412  }
2413  default:
2414  return false;
2415  }
2416 }
2418  buffer.encode_string(1, this->object_id);
2419  buffer.encode_fixed32(2, this->key);
2420  buffer.encode_string(3, this->name);
2421  buffer.encode_string(4, this->unique_id);
2422  buffer.encode_string(5, this->icon);
2423  buffer.encode_bool(6, this->disabled_by_default);
2424  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
2425 }
2426 #ifdef HAS_PROTO_MESSAGE_DUMP
2427 void ListEntitiesTextSensorResponse::dump_to(std::string &out) const {
2428  __attribute__((unused)) char buffer[64];
2429  out.append("ListEntitiesTextSensorResponse {\n");
2430  out.append(" object_id: ");
2431  out.append("'").append(this->object_id).append("'");
2432  out.append("\n");
2433 
2434  out.append(" key: ");
2435  sprintf(buffer, "%u", this->key);
2436  out.append(buffer);
2437  out.append("\n");
2438 
2439  out.append(" name: ");
2440  out.append("'").append(this->name).append("'");
2441  out.append("\n");
2442 
2443  out.append(" unique_id: ");
2444  out.append("'").append(this->unique_id).append("'");
2445  out.append("\n");
2446 
2447  out.append(" icon: ");
2448  out.append("'").append(this->icon).append("'");
2449  out.append("\n");
2450 
2451  out.append(" disabled_by_default: ");
2452  out.append(YESNO(this->disabled_by_default));
2453  out.append("\n");
2454 
2455  out.append(" entity_category: ");
2456  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2457  out.append("\n");
2458  out.append("}");
2459 }
2460 #endif
2461 bool TextSensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2462  switch (field_id) {
2463  case 3: {
2464  this->missing_state = value.as_bool();
2465  return true;
2466  }
2467  default:
2468  return false;
2469  }
2470 }
2472  switch (field_id) {
2473  case 2: {
2474  this->state = value.as_string();
2475  return true;
2476  }
2477  default:
2478  return false;
2479  }
2480 }
2481 bool TextSensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2482  switch (field_id) {
2483  case 1: {
2484  this->key = value.as_fixed32();
2485  return true;
2486  }
2487  default:
2488  return false;
2489  }
2490 }
2492  buffer.encode_fixed32(1, this->key);
2493  buffer.encode_string(2, this->state);
2494  buffer.encode_bool(3, this->missing_state);
2495 }
2496 #ifdef HAS_PROTO_MESSAGE_DUMP
2497 void TextSensorStateResponse::dump_to(std::string &out) const {
2498  __attribute__((unused)) char buffer[64];
2499  out.append("TextSensorStateResponse {\n");
2500  out.append(" key: ");
2501  sprintf(buffer, "%u", this->key);
2502  out.append(buffer);
2503  out.append("\n");
2504 
2505  out.append(" state: ");
2506  out.append("'").append(this->state).append("'");
2507  out.append("\n");
2508 
2509  out.append(" missing_state: ");
2510  out.append(YESNO(this->missing_state));
2511  out.append("\n");
2512  out.append("}");
2513 }
2514 #endif
2515 bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2516  switch (field_id) {
2517  case 1: {
2518  this->level = value.as_enum<enums::LogLevel>();
2519  return true;
2520  }
2521  case 2: {
2522  this->dump_config = value.as_bool();
2523  return true;
2524  }
2525  default:
2526  return false;
2527  }
2528 }
2530  buffer.encode_enum<enums::LogLevel>(1, this->level);
2531  buffer.encode_bool(2, this->dump_config);
2532 }
2533 #ifdef HAS_PROTO_MESSAGE_DUMP
2534 void SubscribeLogsRequest::dump_to(std::string &out) const {
2535  __attribute__((unused)) char buffer[64];
2536  out.append("SubscribeLogsRequest {\n");
2537  out.append(" level: ");
2538  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2539  out.append("\n");
2540 
2541  out.append(" dump_config: ");
2542  out.append(YESNO(this->dump_config));
2543  out.append("\n");
2544  out.append("}");
2545 }
2546 #endif
2547 bool SubscribeLogsResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2548  switch (field_id) {
2549  case 1: {
2550  this->level = value.as_enum<enums::LogLevel>();
2551  return true;
2552  }
2553  case 4: {
2554  this->send_failed = value.as_bool();
2555  return true;
2556  }
2557  default:
2558  return false;
2559  }
2560 }
2562  switch (field_id) {
2563  case 3: {
2564  this->message = value.as_string();
2565  return true;
2566  }
2567  default:
2568  return false;
2569  }
2570 }
2572  buffer.encode_enum<enums::LogLevel>(1, this->level);
2573  buffer.encode_string(3, this->message);
2574  buffer.encode_bool(4, this->send_failed);
2575 }
2576 #ifdef HAS_PROTO_MESSAGE_DUMP
2577 void SubscribeLogsResponse::dump_to(std::string &out) const {
2578  __attribute__((unused)) char buffer[64];
2579  out.append("SubscribeLogsResponse {\n");
2580  out.append(" level: ");
2581  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2582  out.append("\n");
2583 
2584  out.append(" message: ");
2585  out.append("'").append(this->message).append("'");
2586  out.append("\n");
2587 
2588  out.append(" send_failed: ");
2589  out.append(YESNO(this->send_failed));
2590  out.append("\n");
2591  out.append("}");
2592 }
2593 #endif
2595 #ifdef HAS_PROTO_MESSAGE_DUMP
2597  out.append("SubscribeHomeassistantServicesRequest {}");
2598 }
2599 #endif
2601  switch (field_id) {
2602  case 1: {
2603  this->key = value.as_string();
2604  return true;
2605  }
2606  case 2: {
2607  this->value = value.as_string();
2608  return true;
2609  }
2610  default:
2611  return false;
2612  }
2613 }
2615  buffer.encode_string(1, this->key);
2616  buffer.encode_string(2, this->value);
2617 }
2618 #ifdef HAS_PROTO_MESSAGE_DUMP
2619 void HomeassistantServiceMap::dump_to(std::string &out) const {
2620  __attribute__((unused)) char buffer[64];
2621  out.append("HomeassistantServiceMap {\n");
2622  out.append(" key: ");
2623  out.append("'").append(this->key).append("'");
2624  out.append("\n");
2625 
2626  out.append(" value: ");
2627  out.append("'").append(this->value).append("'");
2628  out.append("\n");
2629  out.append("}");
2630 }
2631 #endif
2633  switch (field_id) {
2634  case 5: {
2635  this->is_event = value.as_bool();
2636  return true;
2637  }
2638  default:
2639  return false;
2640  }
2641 }
2643  switch (field_id) {
2644  case 1: {
2645  this->service = value.as_string();
2646  return true;
2647  }
2648  case 2: {
2649  this->data.push_back(value.as_message<HomeassistantServiceMap>());
2650  return true;
2651  }
2652  case 3: {
2653  this->data_template.push_back(value.as_message<HomeassistantServiceMap>());
2654  return true;
2655  }
2656  case 4: {
2657  this->variables.push_back(value.as_message<HomeassistantServiceMap>());
2658  return true;
2659  }
2660  default:
2661  return false;
2662  }
2663 }
2665  buffer.encode_string(1, this->service);
2666  for (auto &it : this->data) {
2667  buffer.encode_message<HomeassistantServiceMap>(2, it, true);
2668  }
2669  for (auto &it : this->data_template) {
2670  buffer.encode_message<HomeassistantServiceMap>(3, it, true);
2671  }
2672  for (auto &it : this->variables) {
2673  buffer.encode_message<HomeassistantServiceMap>(4, it, true);
2674  }
2675  buffer.encode_bool(5, this->is_event);
2676 }
2677 #ifdef HAS_PROTO_MESSAGE_DUMP
2678 void HomeassistantServiceResponse::dump_to(std::string &out) const {
2679  __attribute__((unused)) char buffer[64];
2680  out.append("HomeassistantServiceResponse {\n");
2681  out.append(" service: ");
2682  out.append("'").append(this->service).append("'");
2683  out.append("\n");
2684 
2685  for (const auto &it : this->data) {
2686  out.append(" data: ");
2687  it.dump_to(out);
2688  out.append("\n");
2689  }
2690 
2691  for (const auto &it : this->data_template) {
2692  out.append(" data_template: ");
2693  it.dump_to(out);
2694  out.append("\n");
2695  }
2696 
2697  for (const auto &it : this->variables) {
2698  out.append(" variables: ");
2699  it.dump_to(out);
2700  out.append("\n");
2701  }
2702 
2703  out.append(" is_event: ");
2704  out.append(YESNO(this->is_event));
2705  out.append("\n");
2706  out.append("}");
2707 }
2708 #endif
2710 #ifdef HAS_PROTO_MESSAGE_DUMP
2711 void SubscribeHomeAssistantStatesRequest::dump_to(std::string &out) const {
2712  out.append("SubscribeHomeAssistantStatesRequest {}");
2713 }
2714 #endif
2716  switch (field_id) {
2717  case 1: {
2718  this->entity_id = value.as_string();
2719  return true;
2720  }
2721  case 2: {
2722  this->attribute = value.as_string();
2723  return true;
2724  }
2725  default:
2726  return false;
2727  }
2728 }
2730  buffer.encode_string(1, this->entity_id);
2731  buffer.encode_string(2, this->attribute);
2732 }
2733 #ifdef HAS_PROTO_MESSAGE_DUMP
2734 void SubscribeHomeAssistantStateResponse::dump_to(std::string &out) const {
2735  __attribute__((unused)) char buffer[64];
2736  out.append("SubscribeHomeAssistantStateResponse {\n");
2737  out.append(" entity_id: ");
2738  out.append("'").append(this->entity_id).append("'");
2739  out.append("\n");
2740 
2741  out.append(" attribute: ");
2742  out.append("'").append(this->attribute).append("'");
2743  out.append("\n");
2744  out.append("}");
2745 }
2746 #endif
2748  switch (field_id) {
2749  case 1: {
2750  this->entity_id = value.as_string();
2751  return true;
2752  }
2753  case 2: {
2754  this->state = value.as_string();
2755  return true;
2756  }
2757  case 3: {
2758  this->attribute = value.as_string();
2759  return true;
2760  }
2761  default:
2762  return false;
2763  }
2764 }
2766  buffer.encode_string(1, this->entity_id);
2767  buffer.encode_string(2, this->state);
2768  buffer.encode_string(3, this->attribute);
2769 }
2770 #ifdef HAS_PROTO_MESSAGE_DUMP
2771 void HomeAssistantStateResponse::dump_to(std::string &out) const {
2772  __attribute__((unused)) char buffer[64];
2773  out.append("HomeAssistantStateResponse {\n");
2774  out.append(" entity_id: ");
2775  out.append("'").append(this->entity_id).append("'");
2776  out.append("\n");
2777 
2778  out.append(" state: ");
2779  out.append("'").append(this->state).append("'");
2780  out.append("\n");
2781 
2782  out.append(" attribute: ");
2783  out.append("'").append(this->attribute).append("'");
2784  out.append("\n");
2785  out.append("}");
2786 }
2787 #endif
2789 #ifdef HAS_PROTO_MESSAGE_DUMP
2790 void GetTimeRequest::dump_to(std::string &out) const { out.append("GetTimeRequest {}"); }
2791 #endif
2792 bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2793  switch (field_id) {
2794  case 1: {
2795  this->epoch_seconds = value.as_fixed32();
2796  return true;
2797  }
2798  default:
2799  return false;
2800  }
2801 }
2802 void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->epoch_seconds); }
2803 #ifdef HAS_PROTO_MESSAGE_DUMP
2804 void GetTimeResponse::dump_to(std::string &out) const {
2805  __attribute__((unused)) char buffer[64];
2806  out.append("GetTimeResponse {\n");
2807  out.append(" epoch_seconds: ");
2808  sprintf(buffer, "%u", this->epoch_seconds);
2809  out.append(buffer);
2810  out.append("\n");
2811  out.append("}");
2812 }
2813 #endif
2815  switch (field_id) {
2816  case 2: {
2817  this->type = value.as_enum<enums::ServiceArgType>();
2818  return true;
2819  }
2820  default:
2821  return false;
2822  }
2823 }
2825  switch (field_id) {
2826  case 1: {
2827  this->name = value.as_string();
2828  return true;
2829  }
2830  default:
2831  return false;
2832  }
2833 }
2835  buffer.encode_string(1, this->name);
2836  buffer.encode_enum<enums::ServiceArgType>(2, this->type);
2837 }
2838 #ifdef HAS_PROTO_MESSAGE_DUMP
2839 void ListEntitiesServicesArgument::dump_to(std::string &out) const {
2840  __attribute__((unused)) char buffer[64];
2841  out.append("ListEntitiesServicesArgument {\n");
2842  out.append(" name: ");
2843  out.append("'").append(this->name).append("'");
2844  out.append("\n");
2845 
2846  out.append(" type: ");
2847  out.append(proto_enum_to_string<enums::ServiceArgType>(this->type));
2848  out.append("\n");
2849  out.append("}");
2850 }
2851 #endif
2853  switch (field_id) {
2854  case 1: {
2855  this->name = value.as_string();
2856  return true;
2857  }
2858  case 3: {
2859  this->args.push_back(value.as_message<ListEntitiesServicesArgument>());
2860  return true;
2861  }
2862  default:
2863  return false;
2864  }
2865 }
2867  switch (field_id) {
2868  case 2: {
2869  this->key = value.as_fixed32();
2870  return true;
2871  }
2872  default:
2873  return false;
2874  }
2875 }
2877  buffer.encode_string(1, this->name);
2878  buffer.encode_fixed32(2, this->key);
2879  for (auto &it : this->args) {
2880  buffer.encode_message<ListEntitiesServicesArgument>(3, it, true);
2881  }
2882 }
2883 #ifdef HAS_PROTO_MESSAGE_DUMP
2884 void ListEntitiesServicesResponse::dump_to(std::string &out) const {
2885  __attribute__((unused)) char buffer[64];
2886  out.append("ListEntitiesServicesResponse {\n");
2887  out.append(" name: ");
2888  out.append("'").append(this->name).append("'");
2889  out.append("\n");
2890 
2891  out.append(" key: ");
2892  sprintf(buffer, "%u", this->key);
2893  out.append(buffer);
2894  out.append("\n");
2895 
2896  for (const auto &it : this->args) {
2897  out.append(" args: ");
2898  it.dump_to(out);
2899  out.append("\n");
2900  }
2901  out.append("}");
2902 }
2903 #endif
2904 bool ExecuteServiceArgument::decode_varint(uint32_t field_id, ProtoVarInt value) {
2905  switch (field_id) {
2906  case 1: {
2907  this->bool_ = value.as_bool();
2908  return true;
2909  }
2910  case 2: {
2911  this->legacy_int = value.as_int32();
2912  return true;
2913  }
2914  case 5: {
2915  this->int_ = value.as_sint32();
2916  return true;
2917  }
2918  case 6: {
2919  this->bool_array.push_back(value.as_bool());
2920  return true;
2921  }
2922  case 7: {
2923  this->int_array.push_back(value.as_sint32());
2924  return true;
2925  }
2926  default:
2927  return false;
2928  }
2929 }
2931  switch (field_id) {
2932  case 4: {
2933  this->string_ = value.as_string();
2934  return true;
2935  }
2936  case 9: {
2937  this->string_array.push_back(value.as_string());
2938  return true;
2939  }
2940  default:
2941  return false;
2942  }
2943 }
2944 bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
2945  switch (field_id) {
2946  case 3: {
2947  this->float_ = value.as_float();
2948  return true;
2949  }
2950  case 8: {
2951  this->float_array.push_back(value.as_float());
2952  return true;
2953  }
2954  default:
2955  return false;
2956  }
2957 }
2959  buffer.encode_bool(1, this->bool_);
2960  buffer.encode_int32(2, this->legacy_int);
2961  buffer.encode_float(3, this->float_);
2962  buffer.encode_string(4, this->string_);
2963  buffer.encode_sint32(5, this->int_);
2964  for (auto it : this->bool_array) {
2965  buffer.encode_bool(6, it, true);
2966  }
2967  for (auto &it : this->int_array) {
2968  buffer.encode_sint32(7, it, true);
2969  }
2970  for (auto &it : this->float_array) {
2971  buffer.encode_float(8, it, true);
2972  }
2973  for (auto &it : this->string_array) {
2974  buffer.encode_string(9, it, true);
2975  }
2976 }
2977 #ifdef HAS_PROTO_MESSAGE_DUMP
2978 void ExecuteServiceArgument::dump_to(std::string &out) const {
2979  __attribute__((unused)) char buffer[64];
2980  out.append("ExecuteServiceArgument {\n");
2981  out.append(" bool_: ");
2982  out.append(YESNO(this->bool_));
2983  out.append("\n");
2984 
2985  out.append(" legacy_int: ");
2986  sprintf(buffer, "%d", this->legacy_int);
2987  out.append(buffer);
2988  out.append("\n");
2989 
2990  out.append(" float_: ");
2991  sprintf(buffer, "%g", this->float_);
2992  out.append(buffer);
2993  out.append("\n");
2994 
2995  out.append(" string_: ");
2996  out.append("'").append(this->string_).append("'");
2997  out.append("\n");
2998 
2999  out.append(" int_: ");
3000  sprintf(buffer, "%d", this->int_);
3001  out.append(buffer);
3002  out.append("\n");
3003 
3004  for (const auto it : this->bool_array) {
3005  out.append(" bool_array: ");
3006  out.append(YESNO(it));
3007  out.append("\n");
3008  }
3009 
3010  for (const auto &it : this->int_array) {
3011  out.append(" int_array: ");
3012  sprintf(buffer, "%d", it);
3013  out.append(buffer);
3014  out.append("\n");
3015  }
3016 
3017  for (const auto &it : this->float_array) {
3018  out.append(" float_array: ");
3019  sprintf(buffer, "%g", it);
3020  out.append(buffer);
3021  out.append("\n");
3022  }
3023 
3024  for (const auto &it : this->string_array) {
3025  out.append(" string_array: ");
3026  out.append("'").append(it).append("'");
3027  out.append("\n");
3028  }
3029  out.append("}");
3030 }
3031 #endif
3033  switch (field_id) {
3034  case 2: {
3035  this->args.push_back(value.as_message<ExecuteServiceArgument>());
3036  return true;
3037  }
3038  default:
3039  return false;
3040  }
3041 }
3042 bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3043  switch (field_id) {
3044  case 1: {
3045  this->key = value.as_fixed32();
3046  return true;
3047  }
3048  default:
3049  return false;
3050  }
3051 }
3053  buffer.encode_fixed32(1, this->key);
3054  for (auto &it : this->args) {
3055  buffer.encode_message<ExecuteServiceArgument>(2, it, true);
3056  }
3057 }
3058 #ifdef HAS_PROTO_MESSAGE_DUMP
3059 void ExecuteServiceRequest::dump_to(std::string &out) const {
3060  __attribute__((unused)) char buffer[64];
3061  out.append("ExecuteServiceRequest {\n");
3062  out.append(" key: ");
3063  sprintf(buffer, "%u", this->key);
3064  out.append(buffer);
3065  out.append("\n");
3066 
3067  for (const auto &it : this->args) {
3068  out.append(" args: ");
3069  it.dump_to(out);
3070  out.append("\n");
3071  }
3072  out.append("}");
3073 }
3074 #endif
3076  switch (field_id) {
3077  case 5: {
3078  this->disabled_by_default = value.as_bool();
3079  return true;
3080  }
3081  case 7: {
3082  this->entity_category = value.as_enum<enums::EntityCategory>();
3083  return true;
3084  }
3085  default:
3086  return false;
3087  }
3088 }
3090  switch (field_id) {
3091  case 1: {
3092  this->object_id = value.as_string();
3093  return true;
3094  }
3095  case 3: {
3096  this->name = value.as_string();
3097  return true;
3098  }
3099  case 4: {
3100  this->unique_id = value.as_string();
3101  return true;
3102  }
3103  case 6: {
3104  this->icon = value.as_string();
3105  return true;
3106  }
3107  default:
3108  return false;
3109  }
3110 }
3112  switch (field_id) {
3113  case 2: {
3114  this->key = value.as_fixed32();
3115  return true;
3116  }
3117  default:
3118  return false;
3119  }
3120 }
3122  buffer.encode_string(1, this->object_id);
3123  buffer.encode_fixed32(2, this->key);
3124  buffer.encode_string(3, this->name);
3125  buffer.encode_string(4, this->unique_id);
3126  buffer.encode_bool(5, this->disabled_by_default);
3127  buffer.encode_string(6, this->icon);
3128  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
3129 }
3130 #ifdef HAS_PROTO_MESSAGE_DUMP
3131 void ListEntitiesCameraResponse::dump_to(std::string &out) const {
3132  __attribute__((unused)) char buffer[64];
3133  out.append("ListEntitiesCameraResponse {\n");
3134  out.append(" object_id: ");
3135  out.append("'").append(this->object_id).append("'");
3136  out.append("\n");
3137 
3138  out.append(" key: ");
3139  sprintf(buffer, "%u", this->key);
3140  out.append(buffer);
3141  out.append("\n");
3142 
3143  out.append(" name: ");
3144  out.append("'").append(this->name).append("'");
3145  out.append("\n");
3146 
3147  out.append(" unique_id: ");
3148  out.append("'").append(this->unique_id).append("'");
3149  out.append("\n");
3150 
3151  out.append(" disabled_by_default: ");
3152  out.append(YESNO(this->disabled_by_default));
3153  out.append("\n");
3154 
3155  out.append(" icon: ");
3156  out.append("'").append(this->icon).append("'");
3157  out.append("\n");
3158 
3159  out.append(" entity_category: ");
3160  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3161  out.append("\n");
3162  out.append("}");
3163 }
3164 #endif
3165 bool CameraImageResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3166  switch (field_id) {
3167  case 3: {
3168  this->done = value.as_bool();
3169  return true;
3170  }
3171  default:
3172  return false;
3173  }
3174 }
3176  switch (field_id) {
3177  case 2: {
3178  this->data = value.as_string();
3179  return true;
3180  }
3181  default:
3182  return false;
3183  }
3184 }
3185 bool CameraImageResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3186  switch (field_id) {
3187  case 1: {
3188  this->key = value.as_fixed32();
3189  return true;
3190  }
3191  default:
3192  return false;
3193  }
3194 }
3196  buffer.encode_fixed32(1, this->key);
3197  buffer.encode_string(2, this->data);
3198  buffer.encode_bool(3, this->done);
3199 }
3200 #ifdef HAS_PROTO_MESSAGE_DUMP
3201 void CameraImageResponse::dump_to(std::string &out) const {
3202  __attribute__((unused)) char buffer[64];
3203  out.append("CameraImageResponse {\n");
3204  out.append(" key: ");
3205  sprintf(buffer, "%u", this->key);
3206  out.append(buffer);
3207  out.append("\n");
3208 
3209  out.append(" data: ");
3210  out.append("'").append(this->data).append("'");
3211  out.append("\n");
3212 
3213  out.append(" done: ");
3214  out.append(YESNO(this->done));
3215  out.append("\n");
3216  out.append("}");
3217 }
3218 #endif
3219 bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3220  switch (field_id) {
3221  case 1: {
3222  this->single = value.as_bool();
3223  return true;
3224  }
3225  case 2: {
3226  this->stream = value.as_bool();
3227  return true;
3228  }
3229  default:
3230  return false;
3231  }
3232 }
3234  buffer.encode_bool(1, this->single);
3235  buffer.encode_bool(2, this->stream);
3236 }
3237 #ifdef HAS_PROTO_MESSAGE_DUMP
3238 void CameraImageRequest::dump_to(std::string &out) const {
3239  __attribute__((unused)) char buffer[64];
3240  out.append("CameraImageRequest {\n");
3241  out.append(" single: ");
3242  out.append(YESNO(this->single));
3243  out.append("\n");
3244 
3245  out.append(" stream: ");
3246  out.append(YESNO(this->stream));
3247  out.append("\n");
3248  out.append("}");
3249 }
3250 #endif
3252  switch (field_id) {
3253  case 5: {
3254  this->supports_current_temperature = value.as_bool();
3255  return true;
3256  }
3257  case 6: {
3258  this->supports_two_point_target_temperature = value.as_bool();
3259  return true;
3260  }
3261  case 7: {
3262  this->supported_modes.push_back(value.as_enum<enums::ClimateMode>());
3263  return true;
3264  }
3265  case 11: {
3266  this->legacy_supports_away = value.as_bool();
3267  return true;
3268  }
3269  case 12: {
3270  this->supports_action = value.as_bool();
3271  return true;
3272  }
3273  case 13: {
3274  this->supported_fan_modes.push_back(value.as_enum<enums::ClimateFanMode>());
3275  return true;
3276  }
3277  case 14: {
3278  this->supported_swing_modes.push_back(value.as_enum<enums::ClimateSwingMode>());
3279  return true;
3280  }
3281  case 16: {
3282  this->supported_presets.push_back(value.as_enum<enums::ClimatePreset>());
3283  return true;
3284  }
3285  case 18: {
3286  this->disabled_by_default = value.as_bool();
3287  return true;
3288  }
3289  case 20: {
3290  this->entity_category = value.as_enum<enums::EntityCategory>();
3291  return true;
3292  }
3293  default:
3294  return false;
3295  }
3296 }
3298  switch (field_id) {
3299  case 1: {
3300  this->object_id = value.as_string();
3301  return true;
3302  }
3303  case 3: {
3304  this->name = value.as_string();
3305  return true;
3306  }
3307  case 4: {
3308  this->unique_id = value.as_string();
3309  return true;
3310  }
3311  case 15: {
3312  this->supported_custom_fan_modes.push_back(value.as_string());
3313  return true;
3314  }
3315  case 17: {
3316  this->supported_custom_presets.push_back(value.as_string());
3317  return true;
3318  }
3319  case 19: {
3320  this->icon = value.as_string();
3321  return true;
3322  }
3323  default:
3324  return false;
3325  }
3326 }
3328  switch (field_id) {
3329  case 2: {
3330  this->key = value.as_fixed32();
3331  return true;
3332  }
3333  case 8: {
3334  this->visual_min_temperature = value.as_float();
3335  return true;
3336  }
3337  case 9: {
3338  this->visual_max_temperature = value.as_float();
3339  return true;
3340  }
3341  case 10: {
3342  this->visual_temperature_step = value.as_float();
3343  return true;
3344  }
3345  default:
3346  return false;
3347  }
3348 }
3350  buffer.encode_string(1, this->object_id);
3351  buffer.encode_fixed32(2, this->key);
3352  buffer.encode_string(3, this->name);
3353  buffer.encode_string(4, this->unique_id);
3354  buffer.encode_bool(5, this->supports_current_temperature);
3355  buffer.encode_bool(6, this->supports_two_point_target_temperature);
3356  for (auto &it : this->supported_modes) {
3357  buffer.encode_enum<enums::ClimateMode>(7, it, true);
3358  }
3359  buffer.encode_float(8, this->visual_min_temperature);
3360  buffer.encode_float(9, this->visual_max_temperature);
3361  buffer.encode_float(10, this->visual_temperature_step);
3362  buffer.encode_bool(11, this->legacy_supports_away);
3363  buffer.encode_bool(12, this->supports_action);
3364  for (auto &it : this->supported_fan_modes) {
3365  buffer.encode_enum<enums::ClimateFanMode>(13, it, true);
3366  }
3367  for (auto &it : this->supported_swing_modes) {
3368  buffer.encode_enum<enums::ClimateSwingMode>(14, it, true);
3369  }
3370  for (auto &it : this->supported_custom_fan_modes) {
3371  buffer.encode_string(15, it, true);
3372  }
3373  for (auto &it : this->supported_presets) {
3374  buffer.encode_enum<enums::ClimatePreset>(16, it, true);
3375  }
3376  for (auto &it : this->supported_custom_presets) {
3377  buffer.encode_string(17, it, true);
3378  }
3379  buffer.encode_bool(18, this->disabled_by_default);
3380  buffer.encode_string(19, this->icon);
3381  buffer.encode_enum<enums::EntityCategory>(20, this->entity_category);
3382 }
3383 #ifdef HAS_PROTO_MESSAGE_DUMP
3384 void ListEntitiesClimateResponse::dump_to(std::string &out) const {
3385  __attribute__((unused)) char buffer[64];
3386  out.append("ListEntitiesClimateResponse {\n");
3387  out.append(" object_id: ");
3388  out.append("'").append(this->object_id).append("'");
3389  out.append("\n");
3390 
3391  out.append(" key: ");
3392  sprintf(buffer, "%u", this->key);
3393  out.append(buffer);
3394  out.append("\n");
3395 
3396  out.append(" name: ");
3397  out.append("'").append(this->name).append("'");
3398  out.append("\n");
3399 
3400  out.append(" unique_id: ");
3401  out.append("'").append(this->unique_id).append("'");
3402  out.append("\n");
3403 
3404  out.append(" supports_current_temperature: ");
3405  out.append(YESNO(this->supports_current_temperature));
3406  out.append("\n");
3407 
3408  out.append(" supports_two_point_target_temperature: ");
3409  out.append(YESNO(this->supports_two_point_target_temperature));
3410  out.append("\n");
3411 
3412  for (const auto &it : this->supported_modes) {
3413  out.append(" supported_modes: ");
3414  out.append(proto_enum_to_string<enums::ClimateMode>(it));
3415  out.append("\n");
3416  }
3417 
3418  out.append(" visual_min_temperature: ");
3419  sprintf(buffer, "%g", this->visual_min_temperature);
3420  out.append(buffer);
3421  out.append("\n");
3422 
3423  out.append(" visual_max_temperature: ");
3424  sprintf(buffer, "%g", this->visual_max_temperature);
3425  out.append(buffer);
3426  out.append("\n");
3427 
3428  out.append(" visual_temperature_step: ");
3429  sprintf(buffer, "%g", this->visual_temperature_step);
3430  out.append(buffer);
3431  out.append("\n");
3432 
3433  out.append(" legacy_supports_away: ");
3434  out.append(YESNO(this->legacy_supports_away));
3435  out.append("\n");
3436 
3437  out.append(" supports_action: ");
3438  out.append(YESNO(this->supports_action));
3439  out.append("\n");
3440 
3441  for (const auto &it : this->supported_fan_modes) {
3442  out.append(" supported_fan_modes: ");
3443  out.append(proto_enum_to_string<enums::ClimateFanMode>(it));
3444  out.append("\n");
3445  }
3446 
3447  for (const auto &it : this->supported_swing_modes) {
3448  out.append(" supported_swing_modes: ");
3449  out.append(proto_enum_to_string<enums::ClimateSwingMode>(it));
3450  out.append("\n");
3451  }
3452 
3453  for (const auto &it : this->supported_custom_fan_modes) {
3454  out.append(" supported_custom_fan_modes: ");
3455  out.append("'").append(it).append("'");
3456  out.append("\n");
3457  }
3458 
3459  for (const auto &it : this->supported_presets) {
3460  out.append(" supported_presets: ");
3461  out.append(proto_enum_to_string<enums::ClimatePreset>(it));
3462  out.append("\n");
3463  }
3464 
3465  for (const auto &it : this->supported_custom_presets) {
3466  out.append(" supported_custom_presets: ");
3467  out.append("'").append(it).append("'");
3468  out.append("\n");
3469  }
3470 
3471  out.append(" disabled_by_default: ");
3472  out.append(YESNO(this->disabled_by_default));
3473  out.append("\n");
3474 
3475  out.append(" icon: ");
3476  out.append("'").append(this->icon).append("'");
3477  out.append("\n");
3478 
3479  out.append(" entity_category: ");
3480  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3481  out.append("\n");
3482  out.append("}");
3483 }
3484 #endif
3485 bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3486  switch (field_id) {
3487  case 2: {
3488  this->mode = value.as_enum<enums::ClimateMode>();
3489  return true;
3490  }
3491  case 7: {
3492  this->legacy_away = value.as_bool();
3493  return true;
3494  }
3495  case 8: {
3496  this->action = value.as_enum<enums::ClimateAction>();
3497  return true;
3498  }
3499  case 9: {
3500  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3501  return true;
3502  }
3503  case 10: {
3504  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3505  return true;
3506  }
3507  case 12: {
3508  this->preset = value.as_enum<enums::ClimatePreset>();
3509  return true;
3510  }
3511  default:
3512  return false;
3513  }
3514 }
3516  switch (field_id) {
3517  case 11: {
3518  this->custom_fan_mode = value.as_string();
3519  return true;
3520  }
3521  case 13: {
3522  this->custom_preset = value.as_string();
3523  return true;
3524  }
3525  default:
3526  return false;
3527  }
3528 }
3529 bool ClimateStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3530  switch (field_id) {
3531  case 1: {
3532  this->key = value.as_fixed32();
3533  return true;
3534  }
3535  case 3: {
3536  this->current_temperature = value.as_float();
3537  return true;
3538  }
3539  case 4: {
3540  this->target_temperature = value.as_float();
3541  return true;
3542  }
3543  case 5: {
3544  this->target_temperature_low = value.as_float();
3545  return true;
3546  }
3547  case 6: {
3548  this->target_temperature_high = value.as_float();
3549  return true;
3550  }
3551  default:
3552  return false;
3553  }
3554 }
3556  buffer.encode_fixed32(1, this->key);
3557  buffer.encode_enum<enums::ClimateMode>(2, this->mode);
3558  buffer.encode_float(3, this->current_temperature);
3559  buffer.encode_float(4, this->target_temperature);
3560  buffer.encode_float(5, this->target_temperature_low);
3561  buffer.encode_float(6, this->target_temperature_high);
3562  buffer.encode_bool(7, this->legacy_away);
3563  buffer.encode_enum<enums::ClimateAction>(8, this->action);
3564  buffer.encode_enum<enums::ClimateFanMode>(9, this->fan_mode);
3565  buffer.encode_enum<enums::ClimateSwingMode>(10, this->swing_mode);
3566  buffer.encode_string(11, this->custom_fan_mode);
3567  buffer.encode_enum<enums::ClimatePreset>(12, this->preset);
3568  buffer.encode_string(13, this->custom_preset);
3569 }
3570 #ifdef HAS_PROTO_MESSAGE_DUMP
3571 void ClimateStateResponse::dump_to(std::string &out) const {
3572  __attribute__((unused)) char buffer[64];
3573  out.append("ClimateStateResponse {\n");
3574  out.append(" key: ");
3575  sprintf(buffer, "%u", this->key);
3576  out.append(buffer);
3577  out.append("\n");
3578 
3579  out.append(" mode: ");
3580  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
3581  out.append("\n");
3582 
3583  out.append(" current_temperature: ");
3584  sprintf(buffer, "%g", this->current_temperature);
3585  out.append(buffer);
3586  out.append("\n");
3587 
3588  out.append(" target_temperature: ");
3589  sprintf(buffer, "%g", this->target_temperature);
3590  out.append(buffer);
3591  out.append("\n");
3592 
3593  out.append(" target_temperature_low: ");
3594  sprintf(buffer, "%g", this->target_temperature_low);
3595  out.append(buffer);
3596  out.append("\n");
3597 
3598  out.append(" target_temperature_high: ");
3599  sprintf(buffer, "%g", this->target_temperature_high);
3600  out.append(buffer);
3601  out.append("\n");
3602 
3603  out.append(" legacy_away: ");
3604  out.append(YESNO(this->legacy_away));
3605  out.append("\n");
3606 
3607  out.append(" action: ");
3608  out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
3609  out.append("\n");
3610 
3611  out.append(" fan_mode: ");
3612  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
3613  out.append("\n");
3614 
3615  out.append(" swing_mode: ");
3616  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
3617  out.append("\n");
3618 
3619  out.append(" custom_fan_mode: ");
3620  out.append("'").append(this->custom_fan_mode).append("'");
3621  out.append("\n");
3622 
3623  out.append(" preset: ");
3624  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
3625  out.append("\n");
3626 
3627  out.append(" custom_preset: ");
3628  out.append("'").append(this->custom_preset).append("'");
3629  out.append("\n");
3630  out.append("}");
3631 }
3632 #endif
3633 bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3634  switch (field_id) {
3635  case 2: {
3636  this->has_mode = value.as_bool();
3637  return true;
3638  }
3639  case 3: {
3640  this->mode = value.as_enum<enums::ClimateMode>();
3641  return true;
3642  }
3643  case 4: {
3644  this->has_target_temperature = value.as_bool();
3645  return true;
3646  }
3647  case 6: {
3648  this->has_target_temperature_low = value.as_bool();
3649  return true;
3650  }
3651  case 8: {
3652  this->has_target_temperature_high = value.as_bool();
3653  return true;
3654  }
3655  case 10: {
3656  this->has_legacy_away = value.as_bool();
3657  return true;
3658  }
3659  case 11: {
3660  this->legacy_away = value.as_bool();
3661  return true;
3662  }
3663  case 12: {
3664  this->has_fan_mode = value.as_bool();
3665  return true;
3666  }
3667  case 13: {
3668  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3669  return true;
3670  }
3671  case 14: {
3672  this->has_swing_mode = value.as_bool();
3673  return true;
3674  }
3675  case 15: {
3676  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3677  return true;
3678  }
3679  case 16: {
3680  this->has_custom_fan_mode = value.as_bool();
3681  return true;
3682  }
3683  case 18: {
3684  this->has_preset = value.as_bool();
3685  return true;
3686  }
3687  case 19: {
3688  this->preset = value.as_enum<enums::ClimatePreset>();
3689  return true;
3690  }
3691  case 20: {
3692  this->has_custom_preset = value.as_bool();
3693  return true;
3694  }
3695  default:
3696  return false;
3697  }
3698 }
3700  switch (field_id) {
3701  case 17: {
3702  this->custom_fan_mode = value.as_string();
3703  return true;
3704  }
3705  case 21: {
3706  this->custom_preset = value.as_string();
3707  return true;
3708  }
3709  default:
3710  return false;
3711  }
3712 }
3713 bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3714  switch (field_id) {
3715  case 1: {
3716  this->key = value.as_fixed32();
3717  return true;
3718  }
3719  case 5: {
3720  this->target_temperature = value.as_float();
3721  return true;
3722  }
3723  case 7: {
3724  this->target_temperature_low = value.as_float();
3725  return true;
3726  }
3727  case 9: {
3728  this->target_temperature_high = value.as_float();
3729  return true;
3730  }
3731  default:
3732  return false;
3733  }
3734 }
3736  buffer.encode_fixed32(1, this->key);
3737  buffer.encode_bool(2, this->has_mode);
3738  buffer.encode_enum<enums::ClimateMode>(3, this->mode);
3739  buffer.encode_bool(4, this->has_target_temperature);
3740  buffer.encode_float(5, this->target_temperature);
3741  buffer.encode_bool(6, this->has_target_temperature_low);
3742  buffer.encode_float(7, this->target_temperature_low);
3743  buffer.encode_bool(8, this->has_target_temperature_high);
3744  buffer.encode_float(9, this->target_temperature_high);
3745  buffer.encode_bool(10, this->has_legacy_away);
3746  buffer.encode_bool(11, this->legacy_away);
3747  buffer.encode_bool(12, this->has_fan_mode);
3748  buffer.encode_enum<enums::ClimateFanMode>(13, this->fan_mode);
3749  buffer.encode_bool(14, this->has_swing_mode);
3750  buffer.encode_enum<enums::ClimateSwingMode>(15, this->swing_mode);
3751  buffer.encode_bool(16, this->has_custom_fan_mode);
3752  buffer.encode_string(17, this->custom_fan_mode);
3753  buffer.encode_bool(18, this->has_preset);
3754  buffer.encode_enum<enums::ClimatePreset>(19, this->preset);
3755  buffer.encode_bool(20, this->has_custom_preset);
3756  buffer.encode_string(21, this->custom_preset);
3757 }
3758 #ifdef HAS_PROTO_MESSAGE_DUMP
3759 void ClimateCommandRequest::dump_to(std::string &out) const {
3760  __attribute__((unused)) char buffer[64];
3761  out.append("ClimateCommandRequest {\n");
3762  out.append(" key: ");
3763  sprintf(buffer, "%u", this->key);
3764  out.append(buffer);
3765  out.append("\n");
3766 
3767  out.append(" has_mode: ");
3768  out.append(YESNO(this->has_mode));
3769  out.append("\n");
3770 
3771  out.append(" mode: ");
3772  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
3773  out.append("\n");
3774 
3775  out.append(" has_target_temperature: ");
3776  out.append(YESNO(this->has_target_temperature));
3777  out.append("\n");
3778 
3779  out.append(" target_temperature: ");
3780  sprintf(buffer, "%g", this->target_temperature);
3781  out.append(buffer);
3782  out.append("\n");
3783 
3784  out.append(" has_target_temperature_low: ");
3785  out.append(YESNO(this->has_target_temperature_low));
3786  out.append("\n");
3787 
3788  out.append(" target_temperature_low: ");
3789  sprintf(buffer, "%g", this->target_temperature_low);
3790  out.append(buffer);
3791  out.append("\n");
3792 
3793  out.append(" has_target_temperature_high: ");
3794  out.append(YESNO(this->has_target_temperature_high));
3795  out.append("\n");
3796 
3797  out.append(" target_temperature_high: ");
3798  sprintf(buffer, "%g", this->target_temperature_high);
3799  out.append(buffer);
3800  out.append("\n");
3801 
3802  out.append(" has_legacy_away: ");
3803  out.append(YESNO(this->has_legacy_away));
3804  out.append("\n");
3805 
3806  out.append(" legacy_away: ");
3807  out.append(YESNO(this->legacy_away));
3808  out.append("\n");
3809 
3810  out.append(" has_fan_mode: ");
3811  out.append(YESNO(this->has_fan_mode));
3812  out.append("\n");
3813 
3814  out.append(" fan_mode: ");
3815  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
3816  out.append("\n");
3817 
3818  out.append(" has_swing_mode: ");
3819  out.append(YESNO(this->has_swing_mode));
3820  out.append("\n");
3821 
3822  out.append(" swing_mode: ");
3823  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
3824  out.append("\n");
3825 
3826  out.append(" has_custom_fan_mode: ");
3827  out.append(YESNO(this->has_custom_fan_mode));
3828  out.append("\n");
3829 
3830  out.append(" custom_fan_mode: ");
3831  out.append("'").append(this->custom_fan_mode).append("'");
3832  out.append("\n");
3833 
3834  out.append(" has_preset: ");
3835  out.append(YESNO(this->has_preset));
3836  out.append("\n");
3837 
3838  out.append(" preset: ");
3839  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
3840  out.append("\n");
3841 
3842  out.append(" has_custom_preset: ");
3843  out.append(YESNO(this->has_custom_preset));
3844  out.append("\n");
3845 
3846  out.append(" custom_preset: ");
3847  out.append("'").append(this->custom_preset).append("'");
3848  out.append("\n");
3849  out.append("}");
3850 }
3851 #endif
3853  switch (field_id) {
3854  case 9: {
3855  this->disabled_by_default = value.as_bool();
3856  return true;
3857  }
3858  case 10: {
3859  this->entity_category = value.as_enum<enums::EntityCategory>();
3860  return true;
3861  }
3862  case 12: {
3863  this->mode = value.as_enum<enums::NumberMode>();
3864  return true;
3865  }
3866  default:
3867  return false;
3868  }
3869 }
3871  switch (field_id) {
3872  case 1: {
3873  this->object_id = value.as_string();
3874  return true;
3875  }
3876  case 3: {
3877  this->name = value.as_string();
3878  return true;
3879  }
3880  case 4: {
3881  this->unique_id = value.as_string();
3882  return true;
3883  }
3884  case 5: {
3885  this->icon = value.as_string();
3886  return true;
3887  }
3888  case 11: {
3889  this->unit_of_measurement = value.as_string();
3890  return true;
3891  }
3892  default:
3893  return false;
3894  }
3895 }
3897  switch (field_id) {
3898  case 2: {
3899  this->key = value.as_fixed32();
3900  return true;
3901  }
3902  case 6: {
3903  this->min_value = value.as_float();
3904  return true;
3905  }
3906  case 7: {
3907  this->max_value = value.as_float();
3908  return true;
3909  }
3910  case 8: {
3911  this->step = value.as_float();
3912  return true;
3913  }
3914  default:
3915  return false;
3916  }
3917 }
3919  buffer.encode_string(1, this->object_id);
3920  buffer.encode_fixed32(2, this->key);
3921  buffer.encode_string(3, this->name);
3922  buffer.encode_string(4, this->unique_id);
3923  buffer.encode_string(5, this->icon);
3924  buffer.encode_float(6, this->min_value);
3925  buffer.encode_float(7, this->max_value);
3926  buffer.encode_float(8, this->step);
3927  buffer.encode_bool(9, this->disabled_by_default);
3928  buffer.encode_enum<enums::EntityCategory>(10, this->entity_category);
3929  buffer.encode_string(11, this->unit_of_measurement);
3930  buffer.encode_enum<enums::NumberMode>(12, this->mode);
3931 }
3932 #ifdef HAS_PROTO_MESSAGE_DUMP
3933 void ListEntitiesNumberResponse::dump_to(std::string &out) const {
3934  __attribute__((unused)) char buffer[64];
3935  out.append("ListEntitiesNumberResponse {\n");
3936  out.append(" object_id: ");
3937  out.append("'").append(this->object_id).append("'");
3938  out.append("\n");
3939 
3940  out.append(" key: ");
3941  sprintf(buffer, "%u", this->key);
3942  out.append(buffer);
3943  out.append("\n");
3944 
3945  out.append(" name: ");
3946  out.append("'").append(this->name).append("'");
3947  out.append("\n");
3948 
3949  out.append(" unique_id: ");
3950  out.append("'").append(this->unique_id).append("'");
3951  out.append("\n");
3952 
3953  out.append(" icon: ");
3954  out.append("'").append(this->icon).append("'");
3955  out.append("\n");
3956 
3957  out.append(" min_value: ");
3958  sprintf(buffer, "%g", this->min_value);
3959  out.append(buffer);
3960  out.append("\n");
3961 
3962  out.append(" max_value: ");
3963  sprintf(buffer, "%g", this->max_value);
3964  out.append(buffer);
3965  out.append("\n");
3966 
3967  out.append(" step: ");
3968  sprintf(buffer, "%g", this->step);
3969  out.append(buffer);
3970  out.append("\n");
3971 
3972  out.append(" disabled_by_default: ");
3973  out.append(YESNO(this->disabled_by_default));
3974  out.append("\n");
3975 
3976  out.append(" entity_category: ");
3977  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3978  out.append("\n");
3979 
3980  out.append(" unit_of_measurement: ");
3981  out.append("'").append(this->unit_of_measurement).append("'");
3982  out.append("\n");
3983 
3984  out.append(" mode: ");
3985  out.append(proto_enum_to_string<enums::NumberMode>(this->mode));
3986  out.append("\n");
3987  out.append("}");
3988 }
3989 #endif
3990 bool NumberStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3991  switch (field_id) {
3992  case 3: {
3993  this->missing_state = value.as_bool();
3994  return true;
3995  }
3996  default:
3997  return false;
3998  }
3999 }
4000 bool NumberStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4001  switch (field_id) {
4002  case 1: {
4003  this->key = value.as_fixed32();
4004  return true;
4005  }
4006  case 2: {
4007  this->state = value.as_float();
4008  return true;
4009  }
4010  default:
4011  return false;
4012  }
4013 }
4015  buffer.encode_fixed32(1, this->key);
4016  buffer.encode_float(2, this->state);
4017  buffer.encode_bool(3, this->missing_state);
4018 }
4019 #ifdef HAS_PROTO_MESSAGE_DUMP
4020 void NumberStateResponse::dump_to(std::string &out) const {
4021  __attribute__((unused)) char buffer[64];
4022  out.append("NumberStateResponse {\n");
4023  out.append(" key: ");
4024  sprintf(buffer, "%u", this->key);
4025  out.append(buffer);
4026  out.append("\n");
4027 
4028  out.append(" state: ");
4029  sprintf(buffer, "%g", this->state);
4030  out.append(buffer);
4031  out.append("\n");
4032 
4033  out.append(" missing_state: ");
4034  out.append(YESNO(this->missing_state));
4035  out.append("\n");
4036  out.append("}");
4037 }
4038 #endif
4039 bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4040  switch (field_id) {
4041  case 1: {
4042  this->key = value.as_fixed32();
4043  return true;
4044  }
4045  case 2: {
4046  this->state = value.as_float();
4047  return true;
4048  }
4049  default:
4050  return false;
4051  }
4052 }
4054  buffer.encode_fixed32(1, this->key);
4055  buffer.encode_float(2, this->state);
4056 }
4057 #ifdef HAS_PROTO_MESSAGE_DUMP
4058 void NumberCommandRequest::dump_to(std::string &out) const {
4059  __attribute__((unused)) char buffer[64];
4060  out.append("NumberCommandRequest {\n");
4061  out.append(" key: ");
4062  sprintf(buffer, "%u", this->key);
4063  out.append(buffer);
4064  out.append("\n");
4065 
4066  out.append(" state: ");
4067  sprintf(buffer, "%g", this->state);
4068  out.append(buffer);
4069  out.append("\n");
4070  out.append("}");
4071 }
4072 #endif
4074  switch (field_id) {
4075  case 7: {
4076  this->disabled_by_default = value.as_bool();
4077  return true;
4078  }
4079  case 8: {
4080  this->entity_category = value.as_enum<enums::EntityCategory>();
4081  return true;
4082  }
4083  default:
4084  return false;
4085  }
4086 }
4088  switch (field_id) {
4089  case 1: {
4090  this->object_id = value.as_string();
4091  return true;
4092  }
4093  case 3: {
4094  this->name = value.as_string();
4095  return true;
4096  }
4097  case 4: {
4098  this->unique_id = value.as_string();
4099  return true;
4100  }
4101  case 5: {
4102  this->icon = value.as_string();
4103  return true;
4104  }
4105  case 6: {
4106  this->options.push_back(value.as_string());
4107  return true;
4108  }
4109  default:
4110  return false;
4111  }
4112 }
4114  switch (field_id) {
4115  case 2: {
4116  this->key = value.as_fixed32();
4117  return true;
4118  }
4119  default:
4120  return false;
4121  }
4122 }
4124  buffer.encode_string(1, this->object_id);
4125  buffer.encode_fixed32(2, this->key);
4126  buffer.encode_string(3, this->name);
4127  buffer.encode_string(4, this->unique_id);
4128  buffer.encode_string(5, this->icon);
4129  for (auto &it : this->options) {
4130  buffer.encode_string(6, it, true);
4131  }
4132  buffer.encode_bool(7, this->disabled_by_default);
4133  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
4134 }
4135 #ifdef HAS_PROTO_MESSAGE_DUMP
4136 void ListEntitiesSelectResponse::dump_to(std::string &out) const {
4137  __attribute__((unused)) char buffer[64];
4138  out.append("ListEntitiesSelectResponse {\n");
4139  out.append(" object_id: ");
4140  out.append("'").append(this->object_id).append("'");
4141  out.append("\n");
4142 
4143  out.append(" key: ");
4144  sprintf(buffer, "%u", this->key);
4145  out.append(buffer);
4146  out.append("\n");
4147 
4148  out.append(" name: ");
4149  out.append("'").append(this->name).append("'");
4150  out.append("\n");
4151 
4152  out.append(" unique_id: ");
4153  out.append("'").append(this->unique_id).append("'");
4154  out.append("\n");
4155 
4156  out.append(" icon: ");
4157  out.append("'").append(this->icon).append("'");
4158  out.append("\n");
4159 
4160  for (const auto &it : this->options) {
4161  out.append(" options: ");
4162  out.append("'").append(it).append("'");
4163  out.append("\n");
4164  }
4165 
4166  out.append(" disabled_by_default: ");
4167  out.append(YESNO(this->disabled_by_default));
4168  out.append("\n");
4169 
4170  out.append(" entity_category: ");
4171  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4172  out.append("\n");
4173  out.append("}");
4174 }
4175 #endif
4176 bool SelectStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4177  switch (field_id) {
4178  case 3: {
4179  this->missing_state = value.as_bool();
4180  return true;
4181  }
4182  default:
4183  return false;
4184  }
4185 }
4187  switch (field_id) {
4188  case 2: {
4189  this->state = value.as_string();
4190  return true;
4191  }
4192  default:
4193  return false;
4194  }
4195 }
4196 bool SelectStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4197  switch (field_id) {
4198  case 1: {
4199  this->key = value.as_fixed32();
4200  return true;
4201  }
4202  default:
4203  return false;
4204  }
4205 }
4207  buffer.encode_fixed32(1, this->key);
4208  buffer.encode_string(2, this->state);
4209  buffer.encode_bool(3, this->missing_state);
4210 }
4211 #ifdef HAS_PROTO_MESSAGE_DUMP
4212 void SelectStateResponse::dump_to(std::string &out) const {
4213  __attribute__((unused)) char buffer[64];
4214  out.append("SelectStateResponse {\n");
4215  out.append(" key: ");
4216  sprintf(buffer, "%u", this->key);
4217  out.append(buffer);
4218  out.append("\n");
4219 
4220  out.append(" state: ");
4221  out.append("'").append(this->state).append("'");
4222  out.append("\n");
4223 
4224  out.append(" missing_state: ");
4225  out.append(YESNO(this->missing_state));
4226  out.append("\n");
4227  out.append("}");
4228 }
4229 #endif
4231  switch (field_id) {
4232  case 2: {
4233  this->state = value.as_string();
4234  return true;
4235  }
4236  default:
4237  return false;
4238  }
4239 }
4240 bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4241  switch (field_id) {
4242  case 1: {
4243  this->key = value.as_fixed32();
4244  return true;
4245  }
4246  default:
4247  return false;
4248  }
4249 }
4251  buffer.encode_fixed32(1, this->key);
4252  buffer.encode_string(2, this->state);
4253 }
4254 #ifdef HAS_PROTO_MESSAGE_DUMP
4255 void SelectCommandRequest::dump_to(std::string &out) const {
4256  __attribute__((unused)) char buffer[64];
4257  out.append("SelectCommandRequest {\n");
4258  out.append(" key: ");
4259  sprintf(buffer, "%u", this->key);
4260  out.append(buffer);
4261  out.append("\n");
4262 
4263  out.append(" state: ");
4264  out.append("'").append(this->state).append("'");
4265  out.append("\n");
4266  out.append("}");
4267 }
4268 #endif
4270  switch (field_id) {
4271  case 6: {
4272  this->disabled_by_default = value.as_bool();
4273  return true;
4274  }
4275  case 7: {
4276  this->entity_category = value.as_enum<enums::EntityCategory>();
4277  return true;
4278  }
4279  case 8: {
4280  this->assumed_state = value.as_bool();
4281  return true;
4282  }
4283  case 9: {
4284  this->supports_open = value.as_bool();
4285  return true;
4286  }
4287  case 10: {
4288  this->requires_code = value.as_bool();
4289  return true;
4290  }
4291  default:
4292  return false;
4293  }
4294 }
4296  switch (field_id) {
4297  case 1: {
4298  this->object_id = value.as_string();
4299  return true;
4300  }
4301  case 3: {
4302  this->name = value.as_string();
4303  return true;
4304  }
4305  case 4: {
4306  this->unique_id = value.as_string();
4307  return true;
4308  }
4309  case 5: {
4310  this->icon = value.as_string();
4311  return true;
4312  }
4313  case 11: {
4314  this->code_format = value.as_string();
4315  return true;
4316  }
4317  default:
4318  return false;
4319  }
4320 }
4321 bool ListEntitiesLockResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4322  switch (field_id) {
4323  case 2: {
4324  this->key = value.as_fixed32();
4325  return true;
4326  }
4327  default:
4328  return false;
4329  }
4330 }
4332  buffer.encode_string(1, this->object_id);
4333  buffer.encode_fixed32(2, this->key);
4334  buffer.encode_string(3, this->name);
4335  buffer.encode_string(4, this->unique_id);
4336  buffer.encode_string(5, this->icon);
4337  buffer.encode_bool(6, this->disabled_by_default);
4338  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4339  buffer.encode_bool(8, this->assumed_state);
4340  buffer.encode_bool(9, this->supports_open);
4341  buffer.encode_bool(10, this->requires_code);
4342  buffer.encode_string(11, this->code_format);
4343 }
4344 #ifdef HAS_PROTO_MESSAGE_DUMP
4345 void ListEntitiesLockResponse::dump_to(std::string &out) const {
4346  __attribute__((unused)) char buffer[64];
4347  out.append("ListEntitiesLockResponse {\n");
4348  out.append(" object_id: ");
4349  out.append("'").append(this->object_id).append("'");
4350  out.append("\n");
4351 
4352  out.append(" key: ");
4353  sprintf(buffer, "%u", this->key);
4354  out.append(buffer);
4355  out.append("\n");
4356 
4357  out.append(" name: ");
4358  out.append("'").append(this->name).append("'");
4359  out.append("\n");
4360 
4361  out.append(" unique_id: ");
4362  out.append("'").append(this->unique_id).append("'");
4363  out.append("\n");
4364 
4365  out.append(" icon: ");
4366  out.append("'").append(this->icon).append("'");
4367  out.append("\n");
4368 
4369  out.append(" disabled_by_default: ");
4370  out.append(YESNO(this->disabled_by_default));
4371  out.append("\n");
4372 
4373  out.append(" entity_category: ");
4374  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4375  out.append("\n");
4376 
4377  out.append(" assumed_state: ");
4378  out.append(YESNO(this->assumed_state));
4379  out.append("\n");
4380 
4381  out.append(" supports_open: ");
4382  out.append(YESNO(this->supports_open));
4383  out.append("\n");
4384 
4385  out.append(" requires_code: ");
4386  out.append(YESNO(this->requires_code));
4387  out.append("\n");
4388 
4389  out.append(" code_format: ");
4390  out.append("'").append(this->code_format).append("'");
4391  out.append("\n");
4392  out.append("}");
4393 }
4394 #endif
4395 bool LockStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4396  switch (field_id) {
4397  case 2: {
4398  this->state = value.as_enum<enums::LockState>();
4399  return true;
4400  }
4401  default:
4402  return false;
4403  }
4404 }
4405 bool LockStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4406  switch (field_id) {
4407  case 1: {
4408  this->key = value.as_fixed32();
4409  return true;
4410  }
4411  default:
4412  return false;
4413  }
4414 }
4416  buffer.encode_fixed32(1, this->key);
4417  buffer.encode_enum<enums::LockState>(2, this->state);
4418 }
4419 #ifdef HAS_PROTO_MESSAGE_DUMP
4420 void LockStateResponse::dump_to(std::string &out) const {
4421  __attribute__((unused)) char buffer[64];
4422  out.append("LockStateResponse {\n");
4423  out.append(" key: ");
4424  sprintf(buffer, "%u", this->key);
4425  out.append(buffer);
4426  out.append("\n");
4427 
4428  out.append(" state: ");
4429  out.append(proto_enum_to_string<enums::LockState>(this->state));
4430  out.append("\n");
4431  out.append("}");
4432 }
4433 #endif
4434 bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4435  switch (field_id) {
4436  case 2: {
4437  this->command = value.as_enum<enums::LockCommand>();
4438  return true;
4439  }
4440  case 3: {
4441  this->has_code = value.as_bool();
4442  return true;
4443  }
4444  default:
4445  return false;
4446  }
4447 }
4449  switch (field_id) {
4450  case 4: {
4451  this->code = value.as_string();
4452  return true;
4453  }
4454  default:
4455  return false;
4456  }
4457 }
4458 bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4459  switch (field_id) {
4460  case 1: {
4461  this->key = value.as_fixed32();
4462  return true;
4463  }
4464  default:
4465  return false;
4466  }
4467 }
4469  buffer.encode_fixed32(1, this->key);
4470  buffer.encode_enum<enums::LockCommand>(2, this->command);
4471  buffer.encode_bool(3, this->has_code);
4472  buffer.encode_string(4, this->code);
4473 }
4474 #ifdef HAS_PROTO_MESSAGE_DUMP
4475 void LockCommandRequest::dump_to(std::string &out) const {
4476  __attribute__((unused)) char buffer[64];
4477  out.append("LockCommandRequest {\n");
4478  out.append(" key: ");
4479  sprintf(buffer, "%u", this->key);
4480  out.append(buffer);
4481  out.append("\n");
4482 
4483  out.append(" command: ");
4484  out.append(proto_enum_to_string<enums::LockCommand>(this->command));
4485  out.append("\n");
4486 
4487  out.append(" has_code: ");
4488  out.append(YESNO(this->has_code));
4489  out.append("\n");
4490 
4491  out.append(" code: ");
4492  out.append("'").append(this->code).append("'");
4493  out.append("\n");
4494  out.append("}");
4495 }
4496 #endif
4498  switch (field_id) {
4499  case 6: {
4500  this->disabled_by_default = value.as_bool();
4501  return true;
4502  }
4503  case 7: {
4504  this->entity_category = value.as_enum<enums::EntityCategory>();
4505  return true;
4506  }
4507  default:
4508  return false;
4509  }
4510 }
4512  switch (field_id) {
4513  case 1: {
4514  this->object_id = value.as_string();
4515  return true;
4516  }
4517  case 3: {
4518  this->name = value.as_string();
4519  return true;
4520  }
4521  case 4: {
4522  this->unique_id = value.as_string();
4523  return true;
4524  }
4525  case 5: {
4526  this->icon = value.as_string();
4527  return true;
4528  }
4529  case 8: {
4530  this->device_class = value.as_string();
4531  return true;
4532  }
4533  default:
4534  return false;
4535  }
4536 }
4538  switch (field_id) {
4539  case 2: {
4540  this->key = value.as_fixed32();
4541  return true;
4542  }
4543  default:
4544  return false;
4545  }
4546 }
4548  buffer.encode_string(1, this->object_id);
4549  buffer.encode_fixed32(2, this->key);
4550  buffer.encode_string(3, this->name);
4551  buffer.encode_string(4, this->unique_id);
4552  buffer.encode_string(5, this->icon);
4553  buffer.encode_bool(6, this->disabled_by_default);
4554  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4555  buffer.encode_string(8, this->device_class);
4556 }
4557 #ifdef HAS_PROTO_MESSAGE_DUMP
4558 void ListEntitiesButtonResponse::dump_to(std::string &out) const {
4559  __attribute__((unused)) char buffer[64];
4560  out.append("ListEntitiesButtonResponse {\n");
4561  out.append(" object_id: ");
4562  out.append("'").append(this->object_id).append("'");
4563  out.append("\n");
4564 
4565  out.append(" key: ");
4566  sprintf(buffer, "%u", this->key);
4567  out.append(buffer);
4568  out.append("\n");
4569 
4570  out.append(" name: ");
4571  out.append("'").append(this->name).append("'");
4572  out.append("\n");
4573 
4574  out.append(" unique_id: ");
4575  out.append("'").append(this->unique_id).append("'");
4576  out.append("\n");
4577 
4578  out.append(" icon: ");
4579  out.append("'").append(this->icon).append("'");
4580  out.append("\n");
4581 
4582  out.append(" disabled_by_default: ");
4583  out.append(YESNO(this->disabled_by_default));
4584  out.append("\n");
4585 
4586  out.append(" entity_category: ");
4587  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4588  out.append("\n");
4589 
4590  out.append(" device_class: ");
4591  out.append("'").append(this->device_class).append("'");
4592  out.append("\n");
4593  out.append("}");
4594 }
4595 #endif
4596 bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4597  switch (field_id) {
4598  case 1: {
4599  this->key = value.as_fixed32();
4600  return true;
4601  }
4602  default:
4603  return false;
4604  }
4605 }
4606 void ButtonCommandRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->key); }
4607 #ifdef HAS_PROTO_MESSAGE_DUMP
4608 void ButtonCommandRequest::dump_to(std::string &out) const {
4609  __attribute__((unused)) char buffer[64];
4610  out.append("ButtonCommandRequest {\n");
4611  out.append(" key: ");
4612  sprintf(buffer, "%u", this->key);
4613  out.append(buffer);
4614  out.append("\n");
4615  out.append("}");
4616 }
4617 #endif
4619  switch (field_id) {
4620  case 6: {
4621  this->disabled_by_default = value.as_bool();
4622  return true;
4623  }
4624  case 7: {
4625  this->entity_category = value.as_enum<enums::EntityCategory>();
4626  return true;
4627  }
4628  case 8: {
4629  this->supports_pause = value.as_bool();
4630  return true;
4631  }
4632  default:
4633  return false;
4634  }
4635 }
4637  switch (field_id) {
4638  case 1: {
4639  this->object_id = value.as_string();
4640  return true;
4641  }
4642  case 3: {
4643  this->name = value.as_string();
4644  return true;
4645  }
4646  case 4: {
4647  this->unique_id = value.as_string();
4648  return true;
4649  }
4650  case 5: {
4651  this->icon = value.as_string();
4652  return true;
4653  }
4654  default:
4655  return false;
4656  }
4657 }
4659  switch (field_id) {
4660  case 2: {
4661  this->key = value.as_fixed32();
4662  return true;
4663  }
4664  default:
4665  return false;
4666  }
4667 }
4669  buffer.encode_string(1, this->object_id);
4670  buffer.encode_fixed32(2, this->key);
4671  buffer.encode_string(3, this->name);
4672  buffer.encode_string(4, this->unique_id);
4673  buffer.encode_string(5, this->icon);
4674  buffer.encode_bool(6, this->disabled_by_default);
4675  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4676  buffer.encode_bool(8, this->supports_pause);
4677 }
4678 #ifdef HAS_PROTO_MESSAGE_DUMP
4679 void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
4680  __attribute__((unused)) char buffer[64];
4681  out.append("ListEntitiesMediaPlayerResponse {\n");
4682  out.append(" object_id: ");
4683  out.append("'").append(this->object_id).append("'");
4684  out.append("\n");
4685 
4686  out.append(" key: ");
4687  sprintf(buffer, "%u", this->key);
4688  out.append(buffer);
4689  out.append("\n");
4690 
4691  out.append(" name: ");
4692  out.append("'").append(this->name).append("'");
4693  out.append("\n");
4694 
4695  out.append(" unique_id: ");
4696  out.append("'").append(this->unique_id).append("'");
4697  out.append("\n");
4698 
4699  out.append(" icon: ");
4700  out.append("'").append(this->icon).append("'");
4701  out.append("\n");
4702 
4703  out.append(" disabled_by_default: ");
4704  out.append(YESNO(this->disabled_by_default));
4705  out.append("\n");
4706 
4707  out.append(" entity_category: ");
4708  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4709  out.append("\n");
4710 
4711  out.append(" supports_pause: ");
4712  out.append(YESNO(this->supports_pause));
4713  out.append("\n");
4714  out.append("}");
4715 }
4716 #endif
4718  switch (field_id) {
4719  case 2: {
4720  this->state = value.as_enum<enums::MediaPlayerState>();
4721  return true;
4722  }
4723  case 4: {
4724  this->muted = value.as_bool();
4725  return true;
4726  }
4727  default:
4728  return false;
4729  }
4730 }
4731 bool MediaPlayerStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4732  switch (field_id) {
4733  case 1: {
4734  this->key = value.as_fixed32();
4735  return true;
4736  }
4737  case 3: {
4738  this->volume = value.as_float();
4739  return true;
4740  }
4741  default:
4742  return false;
4743  }
4744 }
4746  buffer.encode_fixed32(1, this->key);
4747  buffer.encode_enum<enums::MediaPlayerState>(2, this->state);
4748  buffer.encode_float(3, this->volume);
4749  buffer.encode_bool(4, this->muted);
4750 }
4751 #ifdef HAS_PROTO_MESSAGE_DUMP
4752 void MediaPlayerStateResponse::dump_to(std::string &out) const {
4753  __attribute__((unused)) char buffer[64];
4754  out.append("MediaPlayerStateResponse {\n");
4755  out.append(" key: ");
4756  sprintf(buffer, "%u", this->key);
4757  out.append(buffer);
4758  out.append("\n");
4759 
4760  out.append(" state: ");
4761  out.append(proto_enum_to_string<enums::MediaPlayerState>(this->state));
4762  out.append("\n");
4763 
4764  out.append(" volume: ");
4765  sprintf(buffer, "%g", this->volume);
4766  out.append(buffer);
4767  out.append("\n");
4768 
4769  out.append(" muted: ");
4770  out.append(YESNO(this->muted));
4771  out.append("\n");
4772  out.append("}");
4773 }
4774 #endif
4776  switch (field_id) {
4777  case 2: {
4778  this->has_command = value.as_bool();
4779  return true;
4780  }
4781  case 3: {
4782  this->command = value.as_enum<enums::MediaPlayerCommand>();
4783  return true;
4784  }
4785  case 4: {
4786  this->has_volume = value.as_bool();
4787  return true;
4788  }
4789  case 6: {
4790  this->has_media_url = value.as_bool();
4791  return true;
4792  }
4793  default:
4794  return false;
4795  }
4796 }
4798  switch (field_id) {
4799  case 7: {
4800  this->media_url = value.as_string();
4801  return true;
4802  }
4803  default:
4804  return false;
4805  }
4806 }
4807 bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4808  switch (field_id) {
4809  case 1: {
4810  this->key = value.as_fixed32();
4811  return true;
4812  }
4813  case 5: {
4814  this->volume = value.as_float();
4815  return true;
4816  }
4817  default:
4818  return false;
4819  }
4820 }
4822  buffer.encode_fixed32(1, this->key);
4823  buffer.encode_bool(2, this->has_command);
4824  buffer.encode_enum<enums::MediaPlayerCommand>(3, this->command);
4825  buffer.encode_bool(4, this->has_volume);
4826  buffer.encode_float(5, this->volume);
4827  buffer.encode_bool(6, this->has_media_url);
4828  buffer.encode_string(7, this->media_url);
4829 }
4830 #ifdef HAS_PROTO_MESSAGE_DUMP
4831 void MediaPlayerCommandRequest::dump_to(std::string &out) const {
4832  __attribute__((unused)) char buffer[64];
4833  out.append("MediaPlayerCommandRequest {\n");
4834  out.append(" key: ");
4835  sprintf(buffer, "%u", this->key);
4836  out.append(buffer);
4837  out.append("\n");
4838 
4839  out.append(" has_command: ");
4840  out.append(YESNO(this->has_command));
4841  out.append("\n");
4842 
4843  out.append(" command: ");
4844  out.append(proto_enum_to_string<enums::MediaPlayerCommand>(this->command));
4845  out.append("\n");
4846 
4847  out.append(" has_volume: ");
4848  out.append(YESNO(this->has_volume));
4849  out.append("\n");
4850 
4851  out.append(" volume: ");
4852  sprintf(buffer, "%g", this->volume);
4853  out.append(buffer);
4854  out.append("\n");
4855 
4856  out.append(" has_media_url: ");
4857  out.append(YESNO(this->has_media_url));
4858  out.append("\n");
4859 
4860  out.append(" media_url: ");
4861  out.append("'").append(this->media_url).append("'");
4862  out.append("\n");
4863  out.append("}");
4864 }
4865 #endif
4867 #ifdef HAS_PROTO_MESSAGE_DUMP
4869  out.append("SubscribeBluetoothLEAdvertisementsRequest {}");
4870 }
4871 #endif
4872 bool BluetoothServiceData::decode_varint(uint32_t field_id, ProtoVarInt value) {
4873  switch (field_id) {
4874  case 2: {
4875  this->data.push_back(value.as_uint32());
4876  return true;
4877  }
4878  default:
4879  return false;
4880  }
4881 }
4883  switch (field_id) {
4884  case 1: {
4885  this->uuid = value.as_string();
4886  return true;
4887  }
4888  default:
4889  return false;
4890  }
4891 }
4893  buffer.encode_string(1, this->uuid);
4894  for (auto &it : this->data) {
4895  buffer.encode_uint32(2, it, true);
4896  }
4897 }
4898 #ifdef HAS_PROTO_MESSAGE_DUMP
4899 void BluetoothServiceData::dump_to(std::string &out) const {
4900  __attribute__((unused)) char buffer[64];
4901  out.append("BluetoothServiceData {\n");
4902  out.append(" uuid: ");
4903  out.append("'").append(this->uuid).append("'");
4904  out.append("\n");
4905 
4906  for (const auto &it : this->data) {
4907  out.append(" data: ");
4908  sprintf(buffer, "%u", it);
4909  out.append(buffer);
4910  out.append("\n");
4911  }
4912  out.append("}");
4913 }
4914 #endif
4916  switch (field_id) {
4917  case 1: {
4918  this->address = value.as_uint64();
4919  return true;
4920  }
4921  case 3: {
4922  this->rssi = value.as_sint32();
4923  return true;
4924  }
4925  default:
4926  return false;
4927  }
4928 }
4930  switch (field_id) {
4931  case 2: {
4932  this->name = value.as_string();
4933  return true;
4934  }
4935  case 4: {
4936  this->service_uuids.push_back(value.as_string());
4937  return true;
4938  }
4939  case 5: {
4940  this->service_data.push_back(value.as_message<BluetoothServiceData>());
4941  return true;
4942  }
4943  case 6: {
4944  this->manufacturer_data.push_back(value.as_message<BluetoothServiceData>());
4945  return true;
4946  }
4947  default:
4948  return false;
4949  }
4950 }
4952  buffer.encode_uint64(1, this->address);
4953  buffer.encode_string(2, this->name);
4954  buffer.encode_sint32(3, this->rssi);
4955  for (auto &it : this->service_uuids) {
4956  buffer.encode_string(4, it, true);
4957  }
4958  for (auto &it : this->service_data) {
4959  buffer.encode_message<BluetoothServiceData>(5, it, true);
4960  }
4961  for (auto &it : this->manufacturer_data) {
4962  buffer.encode_message<BluetoothServiceData>(6, it, true);
4963  }
4964 }
4965 #ifdef HAS_PROTO_MESSAGE_DUMP
4966 void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
4967  __attribute__((unused)) char buffer[64];
4968  out.append("BluetoothLEAdvertisementResponse {\n");
4969  out.append(" address: ");
4970  sprintf(buffer, "%llu", this->address);
4971  out.append(buffer);
4972  out.append("\n");
4973 
4974  out.append(" name: ");
4975  out.append("'").append(this->name).append("'");
4976  out.append("\n");
4977 
4978  out.append(" rssi: ");
4979  sprintf(buffer, "%d", this->rssi);
4980  out.append(buffer);
4981  out.append("\n");
4982 
4983  for (const auto &it : this->service_uuids) {
4984  out.append(" service_uuids: ");
4985  out.append("'").append(it).append("'");
4986  out.append("\n");
4987  }
4988 
4989  for (const auto &it : this->service_data) {
4990  out.append(" service_data: ");
4991  it.dump_to(out);
4992  out.append("\n");
4993  }
4994 
4995  for (const auto &it : this->manufacturer_data) {
4996  out.append(" manufacturer_data: ");
4997  it.dump_to(out);
4998  out.append("\n");
4999  }
5000  out.append("}");
5001 }
5002 #endif
5003 
5004 } // namespace api
5005 } // namespace esphome
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:834
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2711
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4821
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:1010
void encode_fixed32(uint32_t field_id, uint32_t value, bool force=false)
Definition: proto.h:188
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4087
float target_temperature_low
Definition: climate.h:552
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4014
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4395
const char * name
Definition: stm32flash.h:78
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2371
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:738
int32_t as_sint32() const
Definition: proto.h:56
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4752
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:1214
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4212
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:453
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:930
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:470
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3515
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:1113
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2303
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4186
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:466
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4537
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:1264
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4058
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3918
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4807
Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit.
Definition: proto.h:15
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:966
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4415
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:1320
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2930
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2534
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2352
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:724
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4915
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3175
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4658
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4020
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:478
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:608
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2491
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:3165
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:824
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:848
void encode_float(uint32_t field_id, float value, bool force=false)
Definition: proto.h:215
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:3131
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3121
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4405
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:1790
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4269
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:482
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:612
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:1710
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:3713
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:1836
std::string as_string() const
Definition: proto.h:96
int speed
Definition: fan.h:35
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4123
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2632
void encode_uint64(uint32_t field_id, uint64_t value, bool force=false)
Definition: proto.h:176
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2577
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:682
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2185
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4255
float tilt
Definition: cover.h:15
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4497
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2978
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3297
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4073
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:399
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2203
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:1061
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:3042
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4000
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2407
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:1021
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4547
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4345
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2852
float target_temperature_high
Definition: climate.h:553
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:464
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2866
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4866
float as_float() const
Definition: proto.h:113
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:3990
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:992
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:506
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:554
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2471
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:343
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3195
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2824
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2461
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3699
ClimateSwingMode swing_mode
Definition: climate.h:548
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3349
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4868
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:422
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2077
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4668
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:434
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:3219
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2884
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2547
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2804
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:480
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2790
void encode_sint32(uint32_t field_id, int32_t value, bool force=false)
Definition: proto.h:237
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:772
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:355
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2747
int32_t as_int32() const
Definition: proto.h:48
uint32_t as_fixed32() const
Definition: proto.h:111
FanDirection direction
Definition: fan.h:37
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2357
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4230
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:2136
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4636
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2765
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:3759
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:604
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4250
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:476
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:3852
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:1123
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:754
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4039
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4596
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4966
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2715
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2876
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2734
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2229
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2342
uint64_t as_uint64() const
Definition: proto.h:45
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4240
uint8_t custom_preset
Definition: climate.h:546
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4448
void encode_bool(uint32_t field_id, bool value, bool force=false)
Definition: proto.h:182
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:3059
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3233
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2709
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4468
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:432
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2614
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:616
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:4136
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3052
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:3185
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2834
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2958
BedjetMode mode
BedJet operating mode.
Definition: bedjet_codec.h:151
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2051
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:614
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4892
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4113
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2427
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:798
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4321
uint8_t type
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2596
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:540
void encode_uint32(uint32_t field_id, uint32_t value, bool force=false)
Definition: proto.h:170
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:1233
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4929
void encode_int32(uint32_t field_id, int32_t value, bool force=false)
Definition: proto.h:226
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:392
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4717
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2481
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:1571
enum esphome::EntityCategory __attribute__
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:938
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2251
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2729
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2166
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:912
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:4882
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:1780
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2318
uint8_t options
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:378
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2619
ClimateFanMode fan_mode
Definition: climate.h:540
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:1991
bool as_bool() const
Definition: proto.h:46
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4196
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:1224
std::string client_info
Definition: api_pb2.h:163
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:3555
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2678
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:748
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3870
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:472
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:1091
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:1581
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4053
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:3111
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:4458
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:2600
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:3633
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:4606
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:1137
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:364
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:1419
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:2771
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2239
void dump_to(std::string &out) const override
Definition: api_pb2.cpp:610
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:2792
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition: api_pb2.cpp:3089
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition: api_pb2.cpp:4176
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2594
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2571
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition: api_pb2.cpp:3327
void encode(ProtoWriteBuffer buffer) const override
Definition: api_pb2.cpp:2664