ESPHome  2024.5.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 #include <cinttypes>
7 
8 namespace esphome {
9 namespace api {
10 
11 #ifdef HAS_PROTO_MESSAGE_DUMP
12 template<> const char *proto_enum_to_string<enums::EntityCategory>(enums::EntityCategory value) {
13  switch (value) {
15  return "ENTITY_CATEGORY_NONE";
17  return "ENTITY_CATEGORY_CONFIG";
19  return "ENTITY_CATEGORY_DIAGNOSTIC";
20  default:
21  return "UNKNOWN";
22  }
23 }
24 #endif
25 #ifdef HAS_PROTO_MESSAGE_DUMP
26 template<> const char *proto_enum_to_string<enums::LegacyCoverState>(enums::LegacyCoverState value) {
27  switch (value) {
29  return "LEGACY_COVER_STATE_OPEN";
31  return "LEGACY_COVER_STATE_CLOSED";
32  default:
33  return "UNKNOWN";
34  }
35 }
36 #endif
37 #ifdef HAS_PROTO_MESSAGE_DUMP
38 template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverOperation value) {
39  switch (value) {
41  return "COVER_OPERATION_IDLE";
43  return "COVER_OPERATION_IS_OPENING";
45  return "COVER_OPERATION_IS_CLOSING";
46  default:
47  return "UNKNOWN";
48  }
49 }
50 #endif
51 #ifdef HAS_PROTO_MESSAGE_DUMP
52 template<> const char *proto_enum_to_string<enums::LegacyCoverCommand>(enums::LegacyCoverCommand value) {
53  switch (value) {
55  return "LEGACY_COVER_COMMAND_OPEN";
57  return "LEGACY_COVER_COMMAND_CLOSE";
59  return "LEGACY_COVER_COMMAND_STOP";
60  default:
61  return "UNKNOWN";
62  }
63 }
64 #endif
65 #ifdef HAS_PROTO_MESSAGE_DUMP
66 template<> const char *proto_enum_to_string<enums::FanSpeed>(enums::FanSpeed value) {
67  switch (value) {
69  return "FAN_SPEED_LOW";
71  return "FAN_SPEED_MEDIUM";
73  return "FAN_SPEED_HIGH";
74  default:
75  return "UNKNOWN";
76  }
77 }
78 #endif
79 #ifdef HAS_PROTO_MESSAGE_DUMP
80 template<> const char *proto_enum_to_string<enums::FanDirection>(enums::FanDirection value) {
81  switch (value) {
83  return "FAN_DIRECTION_FORWARD";
85  return "FAN_DIRECTION_REVERSE";
86  default:
87  return "UNKNOWN";
88  }
89 }
90 #endif
91 #ifdef HAS_PROTO_MESSAGE_DUMP
92 template<> const char *proto_enum_to_string<enums::ColorMode>(enums::ColorMode value) {
93  switch (value) {
95  return "COLOR_MODE_UNKNOWN";
97  return "COLOR_MODE_ON_OFF";
99  return "COLOR_MODE_BRIGHTNESS";
101  return "COLOR_MODE_WHITE";
103  return "COLOR_MODE_COLOR_TEMPERATURE";
105  return "COLOR_MODE_COLD_WARM_WHITE";
107  return "COLOR_MODE_RGB";
109  return "COLOR_MODE_RGB_WHITE";
111  return "COLOR_MODE_RGB_COLOR_TEMPERATURE";
113  return "COLOR_MODE_RGB_COLD_WARM_WHITE";
114  default:
115  return "UNKNOWN";
116  }
117 }
118 #endif
119 #ifdef HAS_PROTO_MESSAGE_DUMP
120 template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::SensorStateClass value) {
121  switch (value) {
123  return "STATE_CLASS_NONE";
125  return "STATE_CLASS_MEASUREMENT";
127  return "STATE_CLASS_TOTAL_INCREASING";
129  return "STATE_CLASS_TOTAL";
130  default:
131  return "UNKNOWN";
132  }
133 }
134 #endif
135 #ifdef HAS_PROTO_MESSAGE_DUMP
136 template<> const char *proto_enum_to_string<enums::SensorLastResetType>(enums::SensorLastResetType value) {
137  switch (value) {
139  return "LAST_RESET_NONE";
141  return "LAST_RESET_NEVER";
143  return "LAST_RESET_AUTO";
144  default:
145  return "UNKNOWN";
146  }
147 }
148 #endif
149 #ifdef HAS_PROTO_MESSAGE_DUMP
150 template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel value) {
151  switch (value) {
153  return "LOG_LEVEL_NONE";
155  return "LOG_LEVEL_ERROR";
157  return "LOG_LEVEL_WARN";
159  return "LOG_LEVEL_INFO";
161  return "LOG_LEVEL_CONFIG";
163  return "LOG_LEVEL_DEBUG";
165  return "LOG_LEVEL_VERBOSE";
167  return "LOG_LEVEL_VERY_VERBOSE";
168  default:
169  return "UNKNOWN";
170  }
171 }
172 #endif
173 #ifdef HAS_PROTO_MESSAGE_DUMP
174 template<> const char *proto_enum_to_string<enums::ServiceArgType>(enums::ServiceArgType value) {
175  switch (value) {
177  return "SERVICE_ARG_TYPE_BOOL";
179  return "SERVICE_ARG_TYPE_INT";
181  return "SERVICE_ARG_TYPE_FLOAT";
183  return "SERVICE_ARG_TYPE_STRING";
185  return "SERVICE_ARG_TYPE_BOOL_ARRAY";
187  return "SERVICE_ARG_TYPE_INT_ARRAY";
189  return "SERVICE_ARG_TYPE_FLOAT_ARRAY";
191  return "SERVICE_ARG_TYPE_STRING_ARRAY";
192  default:
193  return "UNKNOWN";
194  }
195 }
196 #endif
197 #ifdef HAS_PROTO_MESSAGE_DUMP
198 template<> const char *proto_enum_to_string<enums::ClimateMode>(enums::ClimateMode value) {
199  switch (value) {
201  return "CLIMATE_MODE_OFF";
203  return "CLIMATE_MODE_HEAT_COOL";
205  return "CLIMATE_MODE_COOL";
207  return "CLIMATE_MODE_HEAT";
209  return "CLIMATE_MODE_FAN_ONLY";
211  return "CLIMATE_MODE_DRY";
213  return "CLIMATE_MODE_AUTO";
214  default:
215  return "UNKNOWN";
216  }
217 }
218 #endif
219 #ifdef HAS_PROTO_MESSAGE_DUMP
220 template<> const char *proto_enum_to_string<enums::ClimateFanMode>(enums::ClimateFanMode value) {
221  switch (value) {
223  return "CLIMATE_FAN_ON";
225  return "CLIMATE_FAN_OFF";
227  return "CLIMATE_FAN_AUTO";
229  return "CLIMATE_FAN_LOW";
231  return "CLIMATE_FAN_MEDIUM";
233  return "CLIMATE_FAN_HIGH";
235  return "CLIMATE_FAN_MIDDLE";
237  return "CLIMATE_FAN_FOCUS";
239  return "CLIMATE_FAN_DIFFUSE";
241  return "CLIMATE_FAN_QUIET";
242  default:
243  return "UNKNOWN";
244  }
245 }
246 #endif
247 #ifdef HAS_PROTO_MESSAGE_DUMP
248 template<> const char *proto_enum_to_string<enums::ClimateSwingMode>(enums::ClimateSwingMode value) {
249  switch (value) {
251  return "CLIMATE_SWING_OFF";
253  return "CLIMATE_SWING_BOTH";
255  return "CLIMATE_SWING_VERTICAL";
257  return "CLIMATE_SWING_HORIZONTAL";
258  default:
259  return "UNKNOWN";
260  }
261 }
262 #endif
263 #ifdef HAS_PROTO_MESSAGE_DUMP
264 template<> const char *proto_enum_to_string<enums::ClimateAction>(enums::ClimateAction value) {
265  switch (value) {
267  return "CLIMATE_ACTION_OFF";
269  return "CLIMATE_ACTION_COOLING";
271  return "CLIMATE_ACTION_HEATING";
273  return "CLIMATE_ACTION_IDLE";
275  return "CLIMATE_ACTION_DRYING";
277  return "CLIMATE_ACTION_FAN";
278  default:
279  return "UNKNOWN";
280  }
281 }
282 #endif
283 #ifdef HAS_PROTO_MESSAGE_DUMP
284 template<> const char *proto_enum_to_string<enums::ClimatePreset>(enums::ClimatePreset value) {
285  switch (value) {
287  return "CLIMATE_PRESET_NONE";
289  return "CLIMATE_PRESET_HOME";
291  return "CLIMATE_PRESET_AWAY";
293  return "CLIMATE_PRESET_BOOST";
295  return "CLIMATE_PRESET_COMFORT";
297  return "CLIMATE_PRESET_ECO";
299  return "CLIMATE_PRESET_SLEEP";
301  return "CLIMATE_PRESET_ACTIVITY";
302  default:
303  return "UNKNOWN";
304  }
305 }
306 #endif
307 #ifdef HAS_PROTO_MESSAGE_DUMP
308 template<> const char *proto_enum_to_string<enums::NumberMode>(enums::NumberMode value) {
309  switch (value) {
311  return "NUMBER_MODE_AUTO";
313  return "NUMBER_MODE_BOX";
315  return "NUMBER_MODE_SLIDER";
316  default:
317  return "UNKNOWN";
318  }
319 }
320 #endif
321 #ifdef HAS_PROTO_MESSAGE_DUMP
322 template<> const char *proto_enum_to_string<enums::LockState>(enums::LockState value) {
323  switch (value) {
325  return "LOCK_STATE_NONE";
327  return "LOCK_STATE_LOCKED";
329  return "LOCK_STATE_UNLOCKED";
331  return "LOCK_STATE_JAMMED";
333  return "LOCK_STATE_LOCKING";
335  return "LOCK_STATE_UNLOCKING";
336  default:
337  return "UNKNOWN";
338  }
339 }
340 #endif
341 #ifdef HAS_PROTO_MESSAGE_DUMP
342 template<> const char *proto_enum_to_string<enums::LockCommand>(enums::LockCommand value) {
343  switch (value) {
344  case enums::LOCK_UNLOCK:
345  return "LOCK_UNLOCK";
346  case enums::LOCK_LOCK:
347  return "LOCK_LOCK";
348  case enums::LOCK_OPEN:
349  return "LOCK_OPEN";
350  default:
351  return "UNKNOWN";
352  }
353 }
354 #endif
355 #ifdef HAS_PROTO_MESSAGE_DUMP
356 template<> const char *proto_enum_to_string<enums::MediaPlayerState>(enums::MediaPlayerState value) {
357  switch (value) {
359  return "MEDIA_PLAYER_STATE_NONE";
361  return "MEDIA_PLAYER_STATE_IDLE";
363  return "MEDIA_PLAYER_STATE_PLAYING";
365  return "MEDIA_PLAYER_STATE_PAUSED";
366  default:
367  return "UNKNOWN";
368  }
369 }
370 #endif
371 #ifdef HAS_PROTO_MESSAGE_DUMP
372 template<> const char *proto_enum_to_string<enums::MediaPlayerCommand>(enums::MediaPlayerCommand value) {
373  switch (value) {
375  return "MEDIA_PLAYER_COMMAND_PLAY";
377  return "MEDIA_PLAYER_COMMAND_PAUSE";
379  return "MEDIA_PLAYER_COMMAND_STOP";
381  return "MEDIA_PLAYER_COMMAND_MUTE";
383  return "MEDIA_PLAYER_COMMAND_UNMUTE";
384  default:
385  return "UNKNOWN";
386  }
387 }
388 #endif
389 #ifdef HAS_PROTO_MESSAGE_DUMP
390 template<>
391 const char *proto_enum_to_string<enums::BluetoothDeviceRequestType>(enums::BluetoothDeviceRequestType value) {
392  switch (value) {
394  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT";
396  return "BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT";
398  return "BLUETOOTH_DEVICE_REQUEST_TYPE_PAIR";
400  return "BLUETOOTH_DEVICE_REQUEST_TYPE_UNPAIR";
402  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITH_CACHE";
404  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE";
406  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CLEAR_CACHE";
407  default:
408  return "UNKNOWN";
409  }
410 }
411 #endif
412 #ifdef HAS_PROTO_MESSAGE_DUMP
413 template<>
414 const char *proto_enum_to_string<enums::VoiceAssistantSubscribeFlag>(enums::VoiceAssistantSubscribeFlag value) {
415  switch (value) {
417  return "VOICE_ASSISTANT_SUBSCRIBE_NONE";
419  return "VOICE_ASSISTANT_SUBSCRIBE_API_AUDIO";
420  default:
421  return "UNKNOWN";
422  }
423 }
424 #endif
425 #ifdef HAS_PROTO_MESSAGE_DUMP
426 template<> const char *proto_enum_to_string<enums::VoiceAssistantRequestFlag>(enums::VoiceAssistantRequestFlag value) {
427  switch (value) {
429  return "VOICE_ASSISTANT_REQUEST_NONE";
431  return "VOICE_ASSISTANT_REQUEST_USE_VAD";
433  return "VOICE_ASSISTANT_REQUEST_USE_WAKE_WORD";
434  default:
435  return "UNKNOWN";
436  }
437 }
438 #endif
439 #ifdef HAS_PROTO_MESSAGE_DUMP
440 template<> const char *proto_enum_to_string<enums::VoiceAssistantEvent>(enums::VoiceAssistantEvent value) {
441  switch (value) {
443  return "VOICE_ASSISTANT_ERROR";
445  return "VOICE_ASSISTANT_RUN_START";
447  return "VOICE_ASSISTANT_RUN_END";
449  return "VOICE_ASSISTANT_STT_START";
451  return "VOICE_ASSISTANT_STT_END";
453  return "VOICE_ASSISTANT_INTENT_START";
455  return "VOICE_ASSISTANT_INTENT_END";
457  return "VOICE_ASSISTANT_TTS_START";
459  return "VOICE_ASSISTANT_TTS_END";
461  return "VOICE_ASSISTANT_WAKE_WORD_START";
463  return "VOICE_ASSISTANT_WAKE_WORD_END";
465  return "VOICE_ASSISTANT_STT_VAD_START";
467  return "VOICE_ASSISTANT_STT_VAD_END";
469  return "VOICE_ASSISTANT_TTS_STREAM_START";
471  return "VOICE_ASSISTANT_TTS_STREAM_END";
472  default:
473  return "UNKNOWN";
474  }
475 }
476 #endif
477 #ifdef HAS_PROTO_MESSAGE_DUMP
478 template<> const char *proto_enum_to_string<enums::AlarmControlPanelState>(enums::AlarmControlPanelState value) {
479  switch (value) {
481  return "ALARM_STATE_DISARMED";
483  return "ALARM_STATE_ARMED_HOME";
485  return "ALARM_STATE_ARMED_AWAY";
487  return "ALARM_STATE_ARMED_NIGHT";
489  return "ALARM_STATE_ARMED_VACATION";
491  return "ALARM_STATE_ARMED_CUSTOM_BYPASS";
493  return "ALARM_STATE_PENDING";
495  return "ALARM_STATE_ARMING";
497  return "ALARM_STATE_DISARMING";
499  return "ALARM_STATE_TRIGGERED";
500  default:
501  return "UNKNOWN";
502  }
503 }
504 #endif
505 #ifdef HAS_PROTO_MESSAGE_DUMP
506 template<>
507 const char *proto_enum_to_string<enums::AlarmControlPanelStateCommand>(enums::AlarmControlPanelStateCommand value) {
508  switch (value) {
510  return "ALARM_CONTROL_PANEL_DISARM";
512  return "ALARM_CONTROL_PANEL_ARM_AWAY";
514  return "ALARM_CONTROL_PANEL_ARM_HOME";
516  return "ALARM_CONTROL_PANEL_ARM_NIGHT";
518  return "ALARM_CONTROL_PANEL_ARM_VACATION";
520  return "ALARM_CONTROL_PANEL_ARM_CUSTOM_BYPASS";
522  return "ALARM_CONTROL_PANEL_TRIGGER";
523  default:
524  return "UNKNOWN";
525  }
526 }
527 #endif
528 #ifdef HAS_PROTO_MESSAGE_DUMP
529 template<> const char *proto_enum_to_string<enums::TextMode>(enums::TextMode value) {
530  switch (value) {
532  return "TEXT_MODE_TEXT";
534  return "TEXT_MODE_PASSWORD";
535  default:
536  return "UNKNOWN";
537  }
538 }
539 #endif
540 #ifdef HAS_PROTO_MESSAGE_DUMP
541 template<> const char *proto_enum_to_string<enums::ValveOperation>(enums::ValveOperation value) {
542  switch (value) {
544  return "VALVE_OPERATION_IDLE";
546  return "VALVE_OPERATION_IS_OPENING";
548  return "VALVE_OPERATION_IS_CLOSING";
549  default:
550  return "UNKNOWN";
551  }
552 }
553 #endif
554 bool HelloRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
555  switch (field_id) {
556  case 2: {
557  this->api_version_major = value.as_uint32();
558  return true;
559  }
560  case 3: {
561  this->api_version_minor = value.as_uint32();
562  return true;
563  }
564  default:
565  return false;
566  }
567 }
568 bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
569  switch (field_id) {
570  case 1: {
571  this->client_info = value.as_string();
572  return true;
573  }
574  default:
575  return false;
576  }
577 }
579  buffer.encode_string(1, this->client_info);
580  buffer.encode_uint32(2, this->api_version_major);
581  buffer.encode_uint32(3, this->api_version_minor);
582 }
583 #ifdef HAS_PROTO_MESSAGE_DUMP
584 void HelloRequest::dump_to(std::string &out) const {
585  __attribute__((unused)) char buffer[64];
586  out.append("HelloRequest {\n");
587  out.append(" client_info: ");
588  out.append("'").append(this->client_info).append("'");
589  out.append("\n");
590 
591  out.append(" api_version_major: ");
592  sprintf(buffer, "%" PRIu32, this->api_version_major);
593  out.append(buffer);
594  out.append("\n");
595 
596  out.append(" api_version_minor: ");
597  sprintf(buffer, "%" PRIu32, this->api_version_minor);
598  out.append(buffer);
599  out.append("\n");
600  out.append("}");
601 }
602 #endif
603 bool HelloResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
604  switch (field_id) {
605  case 1: {
606  this->api_version_major = value.as_uint32();
607  return true;
608  }
609  case 2: {
610  this->api_version_minor = value.as_uint32();
611  return true;
612  }
613  default:
614  return false;
615  }
616 }
617 bool HelloResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
618  switch (field_id) {
619  case 3: {
620  this->server_info = value.as_string();
621  return true;
622  }
623  case 4: {
624  this->name = value.as_string();
625  return true;
626  }
627  default:
628  return false;
629  }
630 }
632  buffer.encode_uint32(1, this->api_version_major);
633  buffer.encode_uint32(2, this->api_version_minor);
634  buffer.encode_string(3, this->server_info);
635  buffer.encode_string(4, this->name);
636 }
637 #ifdef HAS_PROTO_MESSAGE_DUMP
638 void HelloResponse::dump_to(std::string &out) const {
639  __attribute__((unused)) char buffer[64];
640  out.append("HelloResponse {\n");
641  out.append(" api_version_major: ");
642  sprintf(buffer, "%" PRIu32, this->api_version_major);
643  out.append(buffer);
644  out.append("\n");
645 
646  out.append(" api_version_minor: ");
647  sprintf(buffer, "%" PRIu32, this->api_version_minor);
648  out.append(buffer);
649  out.append("\n");
650 
651  out.append(" server_info: ");
652  out.append("'").append(this->server_info).append("'");
653  out.append("\n");
654 
655  out.append(" name: ");
656  out.append("'").append(this->name).append("'");
657  out.append("\n");
658  out.append("}");
659 }
660 #endif
661 bool ConnectRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
662  switch (field_id) {
663  case 1: {
664  this->password = value.as_string();
665  return true;
666  }
667  default:
668  return false;
669  }
670 }
671 void ConnectRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->password); }
672 #ifdef HAS_PROTO_MESSAGE_DUMP
673 void ConnectRequest::dump_to(std::string &out) const {
674  __attribute__((unused)) char buffer[64];
675  out.append("ConnectRequest {\n");
676  out.append(" password: ");
677  out.append("'").append(this->password).append("'");
678  out.append("\n");
679  out.append("}");
680 }
681 #endif
682 bool ConnectResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
683  switch (field_id) {
684  case 1: {
685  this->invalid_password = value.as_bool();
686  return true;
687  }
688  default:
689  return false;
690  }
691 }
692 void ConnectResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->invalid_password); }
693 #ifdef HAS_PROTO_MESSAGE_DUMP
694 void ConnectResponse::dump_to(std::string &out) const {
695  __attribute__((unused)) char buffer[64];
696  out.append("ConnectResponse {\n");
697  out.append(" invalid_password: ");
698  out.append(YESNO(this->invalid_password));
699  out.append("\n");
700  out.append("}");
701 }
702 #endif
704 #ifdef HAS_PROTO_MESSAGE_DUMP
705 void DisconnectRequest::dump_to(std::string &out) const { out.append("DisconnectRequest {}"); }
706 #endif
708 #ifdef HAS_PROTO_MESSAGE_DUMP
709 void DisconnectResponse::dump_to(std::string &out) const { out.append("DisconnectResponse {}"); }
710 #endif
712 #ifdef HAS_PROTO_MESSAGE_DUMP
713 void PingRequest::dump_to(std::string &out) const { out.append("PingRequest {}"); }
714 #endif
716 #ifdef HAS_PROTO_MESSAGE_DUMP
717 void PingResponse::dump_to(std::string &out) const { out.append("PingResponse {}"); }
718 #endif
720 #ifdef HAS_PROTO_MESSAGE_DUMP
721 void DeviceInfoRequest::dump_to(std::string &out) const { out.append("DeviceInfoRequest {}"); }
722 #endif
723 bool DeviceInfoResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
724  switch (field_id) {
725  case 1: {
726  this->uses_password = value.as_bool();
727  return true;
728  }
729  case 7: {
730  this->has_deep_sleep = value.as_bool();
731  return true;
732  }
733  case 10: {
734  this->webserver_port = value.as_uint32();
735  return true;
736  }
737  case 11: {
738  this->legacy_bluetooth_proxy_version = value.as_uint32();
739  return true;
740  }
741  case 15: {
742  this->bluetooth_proxy_feature_flags = value.as_uint32();
743  return true;
744  }
745  case 14: {
746  this->legacy_voice_assistant_version = value.as_uint32();
747  return true;
748  }
749  case 17: {
750  this->voice_assistant_feature_flags = value.as_uint32();
751  return true;
752  }
753  default:
754  return false;
755  }
756 }
758  switch (field_id) {
759  case 2: {
760  this->name = value.as_string();
761  return true;
762  }
763  case 3: {
764  this->mac_address = value.as_string();
765  return true;
766  }
767  case 4: {
768  this->esphome_version = value.as_string();
769  return true;
770  }
771  case 5: {
772  this->compilation_time = value.as_string();
773  return true;
774  }
775  case 6: {
776  this->model = value.as_string();
777  return true;
778  }
779  case 8: {
780  this->project_name = value.as_string();
781  return true;
782  }
783  case 9: {
784  this->project_version = value.as_string();
785  return true;
786  }
787  case 12: {
788  this->manufacturer = value.as_string();
789  return true;
790  }
791  case 13: {
792  this->friendly_name = value.as_string();
793  return true;
794  }
795  case 16: {
796  this->suggested_area = value.as_string();
797  return true;
798  }
799  default:
800  return false;
801  }
802 }
804  buffer.encode_bool(1, this->uses_password);
805  buffer.encode_string(2, this->name);
806  buffer.encode_string(3, this->mac_address);
807  buffer.encode_string(4, this->esphome_version);
808  buffer.encode_string(5, this->compilation_time);
809  buffer.encode_string(6, this->model);
810  buffer.encode_bool(7, this->has_deep_sleep);
811  buffer.encode_string(8, this->project_name);
812  buffer.encode_string(9, this->project_version);
813  buffer.encode_uint32(10, this->webserver_port);
814  buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
815  buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
816  buffer.encode_string(12, this->manufacturer);
817  buffer.encode_string(13, this->friendly_name);
818  buffer.encode_uint32(14, this->legacy_voice_assistant_version);
819  buffer.encode_uint32(17, this->voice_assistant_feature_flags);
820  buffer.encode_string(16, this->suggested_area);
821 }
822 #ifdef HAS_PROTO_MESSAGE_DUMP
823 void DeviceInfoResponse::dump_to(std::string &out) const {
824  __attribute__((unused)) char buffer[64];
825  out.append("DeviceInfoResponse {\n");
826  out.append(" uses_password: ");
827  out.append(YESNO(this->uses_password));
828  out.append("\n");
829 
830  out.append(" name: ");
831  out.append("'").append(this->name).append("'");
832  out.append("\n");
833 
834  out.append(" mac_address: ");
835  out.append("'").append(this->mac_address).append("'");
836  out.append("\n");
837 
838  out.append(" esphome_version: ");
839  out.append("'").append(this->esphome_version).append("'");
840  out.append("\n");
841 
842  out.append(" compilation_time: ");
843  out.append("'").append(this->compilation_time).append("'");
844  out.append("\n");
845 
846  out.append(" model: ");
847  out.append("'").append(this->model).append("'");
848  out.append("\n");
849 
850  out.append(" has_deep_sleep: ");
851  out.append(YESNO(this->has_deep_sleep));
852  out.append("\n");
853 
854  out.append(" project_name: ");
855  out.append("'").append(this->project_name).append("'");
856  out.append("\n");
857 
858  out.append(" project_version: ");
859  out.append("'").append(this->project_version).append("'");
860  out.append("\n");
861 
862  out.append(" webserver_port: ");
863  sprintf(buffer, "%" PRIu32, this->webserver_port);
864  out.append(buffer);
865  out.append("\n");
866 
867  out.append(" legacy_bluetooth_proxy_version: ");
868  sprintf(buffer, "%" PRIu32, this->legacy_bluetooth_proxy_version);
869  out.append(buffer);
870  out.append("\n");
871 
872  out.append(" bluetooth_proxy_feature_flags: ");
873  sprintf(buffer, "%" PRIu32, this->bluetooth_proxy_feature_flags);
874  out.append(buffer);
875  out.append("\n");
876 
877  out.append(" manufacturer: ");
878  out.append("'").append(this->manufacturer).append("'");
879  out.append("\n");
880 
881  out.append(" friendly_name: ");
882  out.append("'").append(this->friendly_name).append("'");
883  out.append("\n");
884 
885  out.append(" legacy_voice_assistant_version: ");
886  sprintf(buffer, "%" PRIu32, this->legacy_voice_assistant_version);
887  out.append(buffer);
888  out.append("\n");
889 
890  out.append(" voice_assistant_feature_flags: ");
891  sprintf(buffer, "%" PRIu32, this->voice_assistant_feature_flags);
892  out.append(buffer);
893  out.append("\n");
894 
895  out.append(" suggested_area: ");
896  out.append("'").append(this->suggested_area).append("'");
897  out.append("\n");
898  out.append("}");
899 }
900 #endif
902 #ifdef HAS_PROTO_MESSAGE_DUMP
903 void ListEntitiesRequest::dump_to(std::string &out) const { out.append("ListEntitiesRequest {}"); }
904 #endif
906 #ifdef HAS_PROTO_MESSAGE_DUMP
907 void ListEntitiesDoneResponse::dump_to(std::string &out) const { out.append("ListEntitiesDoneResponse {}"); }
908 #endif
910 #ifdef HAS_PROTO_MESSAGE_DUMP
911 void SubscribeStatesRequest::dump_to(std::string &out) const { out.append("SubscribeStatesRequest {}"); }
912 #endif
914  switch (field_id) {
915  case 6: {
916  this->is_status_binary_sensor = value.as_bool();
917  return true;
918  }
919  case 7: {
920  this->disabled_by_default = value.as_bool();
921  return true;
922  }
923  case 9: {
924  this->entity_category = value.as_enum<enums::EntityCategory>();
925  return true;
926  }
927  default:
928  return false;
929  }
930 }
932  switch (field_id) {
933  case 1: {
934  this->object_id = value.as_string();
935  return true;
936  }
937  case 3: {
938  this->name = value.as_string();
939  return true;
940  }
941  case 4: {
942  this->unique_id = value.as_string();
943  return true;
944  }
945  case 5: {
946  this->device_class = value.as_string();
947  return true;
948  }
949  case 8: {
950  this->icon = value.as_string();
951  return true;
952  }
953  default:
954  return false;
955  }
956 }
958  switch (field_id) {
959  case 2: {
960  this->key = value.as_fixed32();
961  return true;
962  }
963  default:
964  return false;
965  }
966 }
968  buffer.encode_string(1, this->object_id);
969  buffer.encode_fixed32(2, this->key);
970  buffer.encode_string(3, this->name);
971  buffer.encode_string(4, this->unique_id);
972  buffer.encode_string(5, this->device_class);
973  buffer.encode_bool(6, this->is_status_binary_sensor);
974  buffer.encode_bool(7, this->disabled_by_default);
975  buffer.encode_string(8, this->icon);
976  buffer.encode_enum<enums::EntityCategory>(9, this->entity_category);
977 }
978 #ifdef HAS_PROTO_MESSAGE_DUMP
979 void ListEntitiesBinarySensorResponse::dump_to(std::string &out) const {
980  __attribute__((unused)) char buffer[64];
981  out.append("ListEntitiesBinarySensorResponse {\n");
982  out.append(" object_id: ");
983  out.append("'").append(this->object_id).append("'");
984  out.append("\n");
985 
986  out.append(" key: ");
987  sprintf(buffer, "%" PRIu32, this->key);
988  out.append(buffer);
989  out.append("\n");
990 
991  out.append(" name: ");
992  out.append("'").append(this->name).append("'");
993  out.append("\n");
994 
995  out.append(" unique_id: ");
996  out.append("'").append(this->unique_id).append("'");
997  out.append("\n");
998 
999  out.append(" device_class: ");
1000  out.append("'").append(this->device_class).append("'");
1001  out.append("\n");
1002 
1003  out.append(" is_status_binary_sensor: ");
1004  out.append(YESNO(this->is_status_binary_sensor));
1005  out.append("\n");
1006 
1007  out.append(" disabled_by_default: ");
1008  out.append(YESNO(this->disabled_by_default));
1009  out.append("\n");
1010 
1011  out.append(" icon: ");
1012  out.append("'").append(this->icon).append("'");
1013  out.append("\n");
1014 
1015  out.append(" entity_category: ");
1016  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1017  out.append("\n");
1018  out.append("}");
1019 }
1020 #endif
1022  switch (field_id) {
1023  case 2: {
1024  this->state = value.as_bool();
1025  return true;
1026  }
1027  case 3: {
1028  this->missing_state = value.as_bool();
1029  return true;
1030  }
1031  default:
1032  return false;
1033  }
1034 }
1035 bool BinarySensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1036  switch (field_id) {
1037  case 1: {
1038  this->key = value.as_fixed32();
1039  return true;
1040  }
1041  default:
1042  return false;
1043  }
1044 }
1046  buffer.encode_fixed32(1, this->key);
1047  buffer.encode_bool(2, this->state);
1048  buffer.encode_bool(3, this->missing_state);
1049 }
1050 #ifdef HAS_PROTO_MESSAGE_DUMP
1051 void BinarySensorStateResponse::dump_to(std::string &out) const {
1052  __attribute__((unused)) char buffer[64];
1053  out.append("BinarySensorStateResponse {\n");
1054  out.append(" key: ");
1055  sprintf(buffer, "%" PRIu32, this->key);
1056  out.append(buffer);
1057  out.append("\n");
1058 
1059  out.append(" state: ");
1060  out.append(YESNO(this->state));
1061  out.append("\n");
1062 
1063  out.append(" missing_state: ");
1064  out.append(YESNO(this->missing_state));
1065  out.append("\n");
1066  out.append("}");
1067 }
1068 #endif
1070  switch (field_id) {
1071  case 5: {
1072  this->assumed_state = value.as_bool();
1073  return true;
1074  }
1075  case 6: {
1076  this->supports_position = value.as_bool();
1077  return true;
1078  }
1079  case 7: {
1080  this->supports_tilt = value.as_bool();
1081  return true;
1082  }
1083  case 9: {
1084  this->disabled_by_default = value.as_bool();
1085  return true;
1086  }
1087  case 11: {
1088  this->entity_category = value.as_enum<enums::EntityCategory>();
1089  return true;
1090  }
1091  case 12: {
1092  this->supports_stop = value.as_bool();
1093  return true;
1094  }
1095  default:
1096  return false;
1097  }
1098 }
1100  switch (field_id) {
1101  case 1: {
1102  this->object_id = value.as_string();
1103  return true;
1104  }
1105  case 3: {
1106  this->name = value.as_string();
1107  return true;
1108  }
1109  case 4: {
1110  this->unique_id = value.as_string();
1111  return true;
1112  }
1113  case 8: {
1114  this->device_class = value.as_string();
1115  return true;
1116  }
1117  case 10: {
1118  this->icon = value.as_string();
1119  return true;
1120  }
1121  default:
1122  return false;
1123  }
1124 }
1125 bool ListEntitiesCoverResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1126  switch (field_id) {
1127  case 2: {
1128  this->key = value.as_fixed32();
1129  return true;
1130  }
1131  default:
1132  return false;
1133  }
1134 }
1136  buffer.encode_string(1, this->object_id);
1137  buffer.encode_fixed32(2, this->key);
1138  buffer.encode_string(3, this->name);
1139  buffer.encode_string(4, this->unique_id);
1140  buffer.encode_bool(5, this->assumed_state);
1141  buffer.encode_bool(6, this->supports_position);
1142  buffer.encode_bool(7, this->supports_tilt);
1143  buffer.encode_string(8, this->device_class);
1144  buffer.encode_bool(9, this->disabled_by_default);
1145  buffer.encode_string(10, this->icon);
1146  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1147  buffer.encode_bool(12, this->supports_stop);
1148 }
1149 #ifdef HAS_PROTO_MESSAGE_DUMP
1150 void ListEntitiesCoverResponse::dump_to(std::string &out) const {
1151  __attribute__((unused)) char buffer[64];
1152  out.append("ListEntitiesCoverResponse {\n");
1153  out.append(" object_id: ");
1154  out.append("'").append(this->object_id).append("'");
1155  out.append("\n");
1156 
1157  out.append(" key: ");
1158  sprintf(buffer, "%" PRIu32, this->key);
1159  out.append(buffer);
1160  out.append("\n");
1161 
1162  out.append(" name: ");
1163  out.append("'").append(this->name).append("'");
1164  out.append("\n");
1165 
1166  out.append(" unique_id: ");
1167  out.append("'").append(this->unique_id).append("'");
1168  out.append("\n");
1169 
1170  out.append(" assumed_state: ");
1171  out.append(YESNO(this->assumed_state));
1172  out.append("\n");
1173 
1174  out.append(" supports_position: ");
1175  out.append(YESNO(this->supports_position));
1176  out.append("\n");
1177 
1178  out.append(" supports_tilt: ");
1179  out.append(YESNO(this->supports_tilt));
1180  out.append("\n");
1181 
1182  out.append(" device_class: ");
1183  out.append("'").append(this->device_class).append("'");
1184  out.append("\n");
1185 
1186  out.append(" disabled_by_default: ");
1187  out.append(YESNO(this->disabled_by_default));
1188  out.append("\n");
1189 
1190  out.append(" icon: ");
1191  out.append("'").append(this->icon).append("'");
1192  out.append("\n");
1193 
1194  out.append(" entity_category: ");
1195  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1196  out.append("\n");
1197 
1198  out.append(" supports_stop: ");
1199  out.append(YESNO(this->supports_stop));
1200  out.append("\n");
1201  out.append("}");
1202 }
1203 #endif
1204 bool CoverStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1205  switch (field_id) {
1206  case 2: {
1207  this->legacy_state = value.as_enum<enums::LegacyCoverState>();
1208  return true;
1209  }
1210  case 5: {
1211  this->current_operation = value.as_enum<enums::CoverOperation>();
1212  return true;
1213  }
1214  default:
1215  return false;
1216  }
1217 }
1218 bool CoverStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1219  switch (field_id) {
1220  case 1: {
1221  this->key = value.as_fixed32();
1222  return true;
1223  }
1224  case 3: {
1225  this->position = value.as_float();
1226  return true;
1227  }
1228  case 4: {
1229  this->tilt = value.as_float();
1230  return true;
1231  }
1232  default:
1233  return false;
1234  }
1235 }
1237  buffer.encode_fixed32(1, this->key);
1238  buffer.encode_enum<enums::LegacyCoverState>(2, this->legacy_state);
1239  buffer.encode_float(3, this->position);
1240  buffer.encode_float(4, this->tilt);
1241  buffer.encode_enum<enums::CoverOperation>(5, this->current_operation);
1242 }
1243 #ifdef HAS_PROTO_MESSAGE_DUMP
1244 void CoverStateResponse::dump_to(std::string &out) const {
1245  __attribute__((unused)) char buffer[64];
1246  out.append("CoverStateResponse {\n");
1247  out.append(" key: ");
1248  sprintf(buffer, "%" PRIu32, this->key);
1249  out.append(buffer);
1250  out.append("\n");
1251 
1252  out.append(" legacy_state: ");
1253  out.append(proto_enum_to_string<enums::LegacyCoverState>(this->legacy_state));
1254  out.append("\n");
1255 
1256  out.append(" position: ");
1257  sprintf(buffer, "%g", this->position);
1258  out.append(buffer);
1259  out.append("\n");
1260 
1261  out.append(" tilt: ");
1262  sprintf(buffer, "%g", this->tilt);
1263  out.append(buffer);
1264  out.append("\n");
1265 
1266  out.append(" current_operation: ");
1267  out.append(proto_enum_to_string<enums::CoverOperation>(this->current_operation));
1268  out.append("\n");
1269  out.append("}");
1270 }
1271 #endif
1272 bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1273  switch (field_id) {
1274  case 2: {
1275  this->has_legacy_command = value.as_bool();
1276  return true;
1277  }
1278  case 3: {
1279  this->legacy_command = value.as_enum<enums::LegacyCoverCommand>();
1280  return true;
1281  }
1282  case 4: {
1283  this->has_position = value.as_bool();
1284  return true;
1285  }
1286  case 6: {
1287  this->has_tilt = value.as_bool();
1288  return true;
1289  }
1290  case 8: {
1291  this->stop = value.as_bool();
1292  return true;
1293  }
1294  default:
1295  return false;
1296  }
1297 }
1298 bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1299  switch (field_id) {
1300  case 1: {
1301  this->key = value.as_fixed32();
1302  return true;
1303  }
1304  case 5: {
1305  this->position = value.as_float();
1306  return true;
1307  }
1308  case 7: {
1309  this->tilt = value.as_float();
1310  return true;
1311  }
1312  default:
1313  return false;
1314  }
1315 }
1317  buffer.encode_fixed32(1, this->key);
1318  buffer.encode_bool(2, this->has_legacy_command);
1319  buffer.encode_enum<enums::LegacyCoverCommand>(3, this->legacy_command);
1320  buffer.encode_bool(4, this->has_position);
1321  buffer.encode_float(5, this->position);
1322  buffer.encode_bool(6, this->has_tilt);
1323  buffer.encode_float(7, this->tilt);
1324  buffer.encode_bool(8, this->stop);
1325 }
1326 #ifdef HAS_PROTO_MESSAGE_DUMP
1327 void CoverCommandRequest::dump_to(std::string &out) const {
1328  __attribute__((unused)) char buffer[64];
1329  out.append("CoverCommandRequest {\n");
1330  out.append(" key: ");
1331  sprintf(buffer, "%" PRIu32, this->key);
1332  out.append(buffer);
1333  out.append("\n");
1334 
1335  out.append(" has_legacy_command: ");
1336  out.append(YESNO(this->has_legacy_command));
1337  out.append("\n");
1338 
1339  out.append(" legacy_command: ");
1340  out.append(proto_enum_to_string<enums::LegacyCoverCommand>(this->legacy_command));
1341  out.append("\n");
1342 
1343  out.append(" has_position: ");
1344  out.append(YESNO(this->has_position));
1345  out.append("\n");
1346 
1347  out.append(" position: ");
1348  sprintf(buffer, "%g", this->position);
1349  out.append(buffer);
1350  out.append("\n");
1351 
1352  out.append(" has_tilt: ");
1353  out.append(YESNO(this->has_tilt));
1354  out.append("\n");
1355 
1356  out.append(" tilt: ");
1357  sprintf(buffer, "%g", this->tilt);
1358  out.append(buffer);
1359  out.append("\n");
1360 
1361  out.append(" stop: ");
1362  out.append(YESNO(this->stop));
1363  out.append("\n");
1364  out.append("}");
1365 }
1366 #endif
1367 bool ListEntitiesFanResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1368  switch (field_id) {
1369  case 5: {
1370  this->supports_oscillation = value.as_bool();
1371  return true;
1372  }
1373  case 6: {
1374  this->supports_speed = value.as_bool();
1375  return true;
1376  }
1377  case 7: {
1378  this->supports_direction = value.as_bool();
1379  return true;
1380  }
1381  case 8: {
1382  this->supported_speed_count = value.as_int32();
1383  return true;
1384  }
1385  case 9: {
1386  this->disabled_by_default = value.as_bool();
1387  return true;
1388  }
1389  case 11: {
1390  this->entity_category = value.as_enum<enums::EntityCategory>();
1391  return true;
1392  }
1393  default:
1394  return false;
1395  }
1396 }
1398  switch (field_id) {
1399  case 1: {
1400  this->object_id = value.as_string();
1401  return true;
1402  }
1403  case 3: {
1404  this->name = value.as_string();
1405  return true;
1406  }
1407  case 4: {
1408  this->unique_id = value.as_string();
1409  return true;
1410  }
1411  case 10: {
1412  this->icon = value.as_string();
1413  return true;
1414  }
1415  case 12: {
1416  this->supported_preset_modes.push_back(value.as_string());
1417  return true;
1418  }
1419  default:
1420  return false;
1421  }
1422 }
1423 bool ListEntitiesFanResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1424  switch (field_id) {
1425  case 2: {
1426  this->key = value.as_fixed32();
1427  return true;
1428  }
1429  default:
1430  return false;
1431  }
1432 }
1434  buffer.encode_string(1, this->object_id);
1435  buffer.encode_fixed32(2, this->key);
1436  buffer.encode_string(3, this->name);
1437  buffer.encode_string(4, this->unique_id);
1438  buffer.encode_bool(5, this->supports_oscillation);
1439  buffer.encode_bool(6, this->supports_speed);
1440  buffer.encode_bool(7, this->supports_direction);
1441  buffer.encode_int32(8, this->supported_speed_count);
1442  buffer.encode_bool(9, this->disabled_by_default);
1443  buffer.encode_string(10, this->icon);
1444  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1445  for (auto &it : this->supported_preset_modes) {
1446  buffer.encode_string(12, it, true);
1447  }
1448 }
1449 #ifdef HAS_PROTO_MESSAGE_DUMP
1450 void ListEntitiesFanResponse::dump_to(std::string &out) const {
1451  __attribute__((unused)) char buffer[64];
1452  out.append("ListEntitiesFanResponse {\n");
1453  out.append(" object_id: ");
1454  out.append("'").append(this->object_id).append("'");
1455  out.append("\n");
1456 
1457  out.append(" key: ");
1458  sprintf(buffer, "%" PRIu32, this->key);
1459  out.append(buffer);
1460  out.append("\n");
1461 
1462  out.append(" name: ");
1463  out.append("'").append(this->name).append("'");
1464  out.append("\n");
1465 
1466  out.append(" unique_id: ");
1467  out.append("'").append(this->unique_id).append("'");
1468  out.append("\n");
1469 
1470  out.append(" supports_oscillation: ");
1471  out.append(YESNO(this->supports_oscillation));
1472  out.append("\n");
1473 
1474  out.append(" supports_speed: ");
1475  out.append(YESNO(this->supports_speed));
1476  out.append("\n");
1477 
1478  out.append(" supports_direction: ");
1479  out.append(YESNO(this->supports_direction));
1480  out.append("\n");
1481 
1482  out.append(" supported_speed_count: ");
1483  sprintf(buffer, "%" PRId32, this->supported_speed_count);
1484  out.append(buffer);
1485  out.append("\n");
1486 
1487  out.append(" disabled_by_default: ");
1488  out.append(YESNO(this->disabled_by_default));
1489  out.append("\n");
1490 
1491  out.append(" icon: ");
1492  out.append("'").append(this->icon).append("'");
1493  out.append("\n");
1494 
1495  out.append(" entity_category: ");
1496  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1497  out.append("\n");
1498 
1499  for (const auto &it : this->supported_preset_modes) {
1500  out.append(" supported_preset_modes: ");
1501  out.append("'").append(it).append("'");
1502  out.append("\n");
1503  }
1504  out.append("}");
1505 }
1506 #endif
1507 bool FanStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1508  switch (field_id) {
1509  case 2: {
1510  this->state = value.as_bool();
1511  return true;
1512  }
1513  case 3: {
1514  this->oscillating = value.as_bool();
1515  return true;
1516  }
1517  case 4: {
1518  this->speed = value.as_enum<enums::FanSpeed>();
1519  return true;
1520  }
1521  case 5: {
1522  this->direction = value.as_enum<enums::FanDirection>();
1523  return true;
1524  }
1525  case 6: {
1526  this->speed_level = value.as_int32();
1527  return true;
1528  }
1529  default:
1530  return false;
1531  }
1532 }
1534  switch (field_id) {
1535  case 7: {
1536  this->preset_mode = value.as_string();
1537  return true;
1538  }
1539  default:
1540  return false;
1541  }
1542 }
1543 bool FanStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1544  switch (field_id) {
1545  case 1: {
1546  this->key = value.as_fixed32();
1547  return true;
1548  }
1549  default:
1550  return false;
1551  }
1552 }
1554  buffer.encode_fixed32(1, this->key);
1555  buffer.encode_bool(2, this->state);
1556  buffer.encode_bool(3, this->oscillating);
1557  buffer.encode_enum<enums::FanSpeed>(4, this->speed);
1558  buffer.encode_enum<enums::FanDirection>(5, this->direction);
1559  buffer.encode_int32(6, this->speed_level);
1560  buffer.encode_string(7, this->preset_mode);
1561 }
1562 #ifdef HAS_PROTO_MESSAGE_DUMP
1563 void FanStateResponse::dump_to(std::string &out) const {
1564  __attribute__((unused)) char buffer[64];
1565  out.append("FanStateResponse {\n");
1566  out.append(" key: ");
1567  sprintf(buffer, "%" PRIu32, this->key);
1568  out.append(buffer);
1569  out.append("\n");
1570 
1571  out.append(" state: ");
1572  out.append(YESNO(this->state));
1573  out.append("\n");
1574 
1575  out.append(" oscillating: ");
1576  out.append(YESNO(this->oscillating));
1577  out.append("\n");
1578 
1579  out.append(" speed: ");
1580  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1581  out.append("\n");
1582 
1583  out.append(" direction: ");
1584  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1585  out.append("\n");
1586 
1587  out.append(" speed_level: ");
1588  sprintf(buffer, "%" PRId32, this->speed_level);
1589  out.append(buffer);
1590  out.append("\n");
1591 
1592  out.append(" preset_mode: ");
1593  out.append("'").append(this->preset_mode).append("'");
1594  out.append("\n");
1595  out.append("}");
1596 }
1597 #endif
1598 bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1599  switch (field_id) {
1600  case 2: {
1601  this->has_state = value.as_bool();
1602  return true;
1603  }
1604  case 3: {
1605  this->state = value.as_bool();
1606  return true;
1607  }
1608  case 4: {
1609  this->has_speed = value.as_bool();
1610  return true;
1611  }
1612  case 5: {
1613  this->speed = value.as_enum<enums::FanSpeed>();
1614  return true;
1615  }
1616  case 6: {
1617  this->has_oscillating = value.as_bool();
1618  return true;
1619  }
1620  case 7: {
1621  this->oscillating = value.as_bool();
1622  return true;
1623  }
1624  case 8: {
1625  this->has_direction = value.as_bool();
1626  return true;
1627  }
1628  case 9: {
1629  this->direction = value.as_enum<enums::FanDirection>();
1630  return true;
1631  }
1632  case 10: {
1633  this->has_speed_level = value.as_bool();
1634  return true;
1635  }
1636  case 11: {
1637  this->speed_level = value.as_int32();
1638  return true;
1639  }
1640  case 12: {
1641  this->has_preset_mode = value.as_bool();
1642  return true;
1643  }
1644  default:
1645  return false;
1646  }
1647 }
1649  switch (field_id) {
1650  case 13: {
1651  this->preset_mode = value.as_string();
1652  return true;
1653  }
1654  default:
1655  return false;
1656  }
1657 }
1658 bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1659  switch (field_id) {
1660  case 1: {
1661  this->key = value.as_fixed32();
1662  return true;
1663  }
1664  default:
1665  return false;
1666  }
1667 }
1669  buffer.encode_fixed32(1, this->key);
1670  buffer.encode_bool(2, this->has_state);
1671  buffer.encode_bool(3, this->state);
1672  buffer.encode_bool(4, this->has_speed);
1673  buffer.encode_enum<enums::FanSpeed>(5, this->speed);
1674  buffer.encode_bool(6, this->has_oscillating);
1675  buffer.encode_bool(7, this->oscillating);
1676  buffer.encode_bool(8, this->has_direction);
1677  buffer.encode_enum<enums::FanDirection>(9, this->direction);
1678  buffer.encode_bool(10, this->has_speed_level);
1679  buffer.encode_int32(11, this->speed_level);
1680  buffer.encode_bool(12, this->has_preset_mode);
1681  buffer.encode_string(13, this->preset_mode);
1682 }
1683 #ifdef HAS_PROTO_MESSAGE_DUMP
1684 void FanCommandRequest::dump_to(std::string &out) const {
1685  __attribute__((unused)) char buffer[64];
1686  out.append("FanCommandRequest {\n");
1687  out.append(" key: ");
1688  sprintf(buffer, "%" PRIu32, this->key);
1689  out.append(buffer);
1690  out.append("\n");
1691 
1692  out.append(" has_state: ");
1693  out.append(YESNO(this->has_state));
1694  out.append("\n");
1695 
1696  out.append(" state: ");
1697  out.append(YESNO(this->state));
1698  out.append("\n");
1699 
1700  out.append(" has_speed: ");
1701  out.append(YESNO(this->has_speed));
1702  out.append("\n");
1703 
1704  out.append(" speed: ");
1705  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1706  out.append("\n");
1707 
1708  out.append(" has_oscillating: ");
1709  out.append(YESNO(this->has_oscillating));
1710  out.append("\n");
1711 
1712  out.append(" oscillating: ");
1713  out.append(YESNO(this->oscillating));
1714  out.append("\n");
1715 
1716  out.append(" has_direction: ");
1717  out.append(YESNO(this->has_direction));
1718  out.append("\n");
1719 
1720  out.append(" direction: ");
1721  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1722  out.append("\n");
1723 
1724  out.append(" has_speed_level: ");
1725  out.append(YESNO(this->has_speed_level));
1726  out.append("\n");
1727 
1728  out.append(" speed_level: ");
1729  sprintf(buffer, "%" PRId32, this->speed_level);
1730  out.append(buffer);
1731  out.append("\n");
1732 
1733  out.append(" has_preset_mode: ");
1734  out.append(YESNO(this->has_preset_mode));
1735  out.append("\n");
1736 
1737  out.append(" preset_mode: ");
1738  out.append("'").append(this->preset_mode).append("'");
1739  out.append("\n");
1740  out.append("}");
1741 }
1742 #endif
1744  switch (field_id) {
1745  case 12: {
1746  this->supported_color_modes.push_back(value.as_enum<enums::ColorMode>());
1747  return true;
1748  }
1749  case 5: {
1750  this->legacy_supports_brightness = value.as_bool();
1751  return true;
1752  }
1753  case 6: {
1754  this->legacy_supports_rgb = value.as_bool();
1755  return true;
1756  }
1757  case 7: {
1758  this->legacy_supports_white_value = value.as_bool();
1759  return true;
1760  }
1761  case 8: {
1762  this->legacy_supports_color_temperature = value.as_bool();
1763  return true;
1764  }
1765  case 13: {
1766  this->disabled_by_default = value.as_bool();
1767  return true;
1768  }
1769  case 15: {
1770  this->entity_category = value.as_enum<enums::EntityCategory>();
1771  return true;
1772  }
1773  default:
1774  return false;
1775  }
1776 }
1778  switch (field_id) {
1779  case 1: {
1780  this->object_id = value.as_string();
1781  return true;
1782  }
1783  case 3: {
1784  this->name = value.as_string();
1785  return true;
1786  }
1787  case 4: {
1788  this->unique_id = value.as_string();
1789  return true;
1790  }
1791  case 11: {
1792  this->effects.push_back(value.as_string());
1793  return true;
1794  }
1795  case 14: {
1796  this->icon = value.as_string();
1797  return true;
1798  }
1799  default:
1800  return false;
1801  }
1802 }
1803 bool ListEntitiesLightResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1804  switch (field_id) {
1805  case 2: {
1806  this->key = value.as_fixed32();
1807  return true;
1808  }
1809  case 9: {
1810  this->min_mireds = value.as_float();
1811  return true;
1812  }
1813  case 10: {
1814  this->max_mireds = value.as_float();
1815  return true;
1816  }
1817  default:
1818  return false;
1819  }
1820 }
1822  buffer.encode_string(1, this->object_id);
1823  buffer.encode_fixed32(2, this->key);
1824  buffer.encode_string(3, this->name);
1825  buffer.encode_string(4, this->unique_id);
1826  for (auto &it : this->supported_color_modes) {
1827  buffer.encode_enum<enums::ColorMode>(12, it, true);
1828  }
1829  buffer.encode_bool(5, this->legacy_supports_brightness);
1830  buffer.encode_bool(6, this->legacy_supports_rgb);
1831  buffer.encode_bool(7, this->legacy_supports_white_value);
1832  buffer.encode_bool(8, this->legacy_supports_color_temperature);
1833  buffer.encode_float(9, this->min_mireds);
1834  buffer.encode_float(10, this->max_mireds);
1835  for (auto &it : this->effects) {
1836  buffer.encode_string(11, it, true);
1837  }
1838  buffer.encode_bool(13, this->disabled_by_default);
1839  buffer.encode_string(14, this->icon);
1840  buffer.encode_enum<enums::EntityCategory>(15, this->entity_category);
1841 }
1842 #ifdef HAS_PROTO_MESSAGE_DUMP
1843 void ListEntitiesLightResponse::dump_to(std::string &out) const {
1844  __attribute__((unused)) char buffer[64];
1845  out.append("ListEntitiesLightResponse {\n");
1846  out.append(" object_id: ");
1847  out.append("'").append(this->object_id).append("'");
1848  out.append("\n");
1849 
1850  out.append(" key: ");
1851  sprintf(buffer, "%" PRIu32, this->key);
1852  out.append(buffer);
1853  out.append("\n");
1854 
1855  out.append(" name: ");
1856  out.append("'").append(this->name).append("'");
1857  out.append("\n");
1858 
1859  out.append(" unique_id: ");
1860  out.append("'").append(this->unique_id).append("'");
1861  out.append("\n");
1862 
1863  for (const auto &it : this->supported_color_modes) {
1864  out.append(" supported_color_modes: ");
1865  out.append(proto_enum_to_string<enums::ColorMode>(it));
1866  out.append("\n");
1867  }
1868 
1869  out.append(" legacy_supports_brightness: ");
1870  out.append(YESNO(this->legacy_supports_brightness));
1871  out.append("\n");
1872 
1873  out.append(" legacy_supports_rgb: ");
1874  out.append(YESNO(this->legacy_supports_rgb));
1875  out.append("\n");
1876 
1877  out.append(" legacy_supports_white_value: ");
1878  out.append(YESNO(this->legacy_supports_white_value));
1879  out.append("\n");
1880 
1881  out.append(" legacy_supports_color_temperature: ");
1882  out.append(YESNO(this->legacy_supports_color_temperature));
1883  out.append("\n");
1884 
1885  out.append(" min_mireds: ");
1886  sprintf(buffer, "%g", this->min_mireds);
1887  out.append(buffer);
1888  out.append("\n");
1889 
1890  out.append(" max_mireds: ");
1891  sprintf(buffer, "%g", this->max_mireds);
1892  out.append(buffer);
1893  out.append("\n");
1894 
1895  for (const auto &it : this->effects) {
1896  out.append(" effects: ");
1897  out.append("'").append(it).append("'");
1898  out.append("\n");
1899  }
1900 
1901  out.append(" disabled_by_default: ");
1902  out.append(YESNO(this->disabled_by_default));
1903  out.append("\n");
1904 
1905  out.append(" icon: ");
1906  out.append("'").append(this->icon).append("'");
1907  out.append("\n");
1908 
1909  out.append(" entity_category: ");
1910  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1911  out.append("\n");
1912  out.append("}");
1913 }
1914 #endif
1915 bool LightStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1916  switch (field_id) {
1917  case 2: {
1918  this->state = value.as_bool();
1919  return true;
1920  }
1921  case 11: {
1922  this->color_mode = value.as_enum<enums::ColorMode>();
1923  return true;
1924  }
1925  default:
1926  return false;
1927  }
1928 }
1930  switch (field_id) {
1931  case 9: {
1932  this->effect = value.as_string();
1933  return true;
1934  }
1935  default:
1936  return false;
1937  }
1938 }
1939 bool LightStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1940  switch (field_id) {
1941  case 1: {
1942  this->key = value.as_fixed32();
1943  return true;
1944  }
1945  case 3: {
1946  this->brightness = value.as_float();
1947  return true;
1948  }
1949  case 10: {
1950  this->color_brightness = value.as_float();
1951  return true;
1952  }
1953  case 4: {
1954  this->red = value.as_float();
1955  return true;
1956  }
1957  case 5: {
1958  this->green = value.as_float();
1959  return true;
1960  }
1961  case 6: {
1962  this->blue = value.as_float();
1963  return true;
1964  }
1965  case 7: {
1966  this->white = value.as_float();
1967  return true;
1968  }
1969  case 8: {
1970  this->color_temperature = value.as_float();
1971  return true;
1972  }
1973  case 12: {
1974  this->cold_white = value.as_float();
1975  return true;
1976  }
1977  case 13: {
1978  this->warm_white = value.as_float();
1979  return true;
1980  }
1981  default:
1982  return false;
1983  }
1984 }
1986  buffer.encode_fixed32(1, this->key);
1987  buffer.encode_bool(2, this->state);
1988  buffer.encode_float(3, this->brightness);
1989  buffer.encode_enum<enums::ColorMode>(11, this->color_mode);
1990  buffer.encode_float(10, this->color_brightness);
1991  buffer.encode_float(4, this->red);
1992  buffer.encode_float(5, this->green);
1993  buffer.encode_float(6, this->blue);
1994  buffer.encode_float(7, this->white);
1995  buffer.encode_float(8, this->color_temperature);
1996  buffer.encode_float(12, this->cold_white);
1997  buffer.encode_float(13, this->warm_white);
1998  buffer.encode_string(9, this->effect);
1999 }
2000 #ifdef HAS_PROTO_MESSAGE_DUMP
2001 void LightStateResponse::dump_to(std::string &out) const {
2002  __attribute__((unused)) char buffer[64];
2003  out.append("LightStateResponse {\n");
2004  out.append(" key: ");
2005  sprintf(buffer, "%" PRIu32, this->key);
2006  out.append(buffer);
2007  out.append("\n");
2008 
2009  out.append(" state: ");
2010  out.append(YESNO(this->state));
2011  out.append("\n");
2012 
2013  out.append(" brightness: ");
2014  sprintf(buffer, "%g", this->brightness);
2015  out.append(buffer);
2016  out.append("\n");
2017 
2018  out.append(" color_mode: ");
2019  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
2020  out.append("\n");
2021 
2022  out.append(" color_brightness: ");
2023  sprintf(buffer, "%g", this->color_brightness);
2024  out.append(buffer);
2025  out.append("\n");
2026 
2027  out.append(" red: ");
2028  sprintf(buffer, "%g", this->red);
2029  out.append(buffer);
2030  out.append("\n");
2031 
2032  out.append(" green: ");
2033  sprintf(buffer, "%g", this->green);
2034  out.append(buffer);
2035  out.append("\n");
2036 
2037  out.append(" blue: ");
2038  sprintf(buffer, "%g", this->blue);
2039  out.append(buffer);
2040  out.append("\n");
2041 
2042  out.append(" white: ");
2043  sprintf(buffer, "%g", this->white);
2044  out.append(buffer);
2045  out.append("\n");
2046 
2047  out.append(" color_temperature: ");
2048  sprintf(buffer, "%g", this->color_temperature);
2049  out.append(buffer);
2050  out.append("\n");
2051 
2052  out.append(" cold_white: ");
2053  sprintf(buffer, "%g", this->cold_white);
2054  out.append(buffer);
2055  out.append("\n");
2056 
2057  out.append(" warm_white: ");
2058  sprintf(buffer, "%g", this->warm_white);
2059  out.append(buffer);
2060  out.append("\n");
2061 
2062  out.append(" effect: ");
2063  out.append("'").append(this->effect).append("'");
2064  out.append("\n");
2065  out.append("}");
2066 }
2067 #endif
2068 bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2069  switch (field_id) {
2070  case 2: {
2071  this->has_state = value.as_bool();
2072  return true;
2073  }
2074  case 3: {
2075  this->state = value.as_bool();
2076  return true;
2077  }
2078  case 4: {
2079  this->has_brightness = value.as_bool();
2080  return true;
2081  }
2082  case 22: {
2083  this->has_color_mode = value.as_bool();
2084  return true;
2085  }
2086  case 23: {
2087  this->color_mode = value.as_enum<enums::ColorMode>();
2088  return true;
2089  }
2090  case 20: {
2091  this->has_color_brightness = value.as_bool();
2092  return true;
2093  }
2094  case 6: {
2095  this->has_rgb = value.as_bool();
2096  return true;
2097  }
2098  case 10: {
2099  this->has_white = value.as_bool();
2100  return true;
2101  }
2102  case 12: {
2103  this->has_color_temperature = value.as_bool();
2104  return true;
2105  }
2106  case 24: {
2107  this->has_cold_white = value.as_bool();
2108  return true;
2109  }
2110  case 26: {
2111  this->has_warm_white = value.as_bool();
2112  return true;
2113  }
2114  case 14: {
2115  this->has_transition_length = value.as_bool();
2116  return true;
2117  }
2118  case 15: {
2119  this->transition_length = value.as_uint32();
2120  return true;
2121  }
2122  case 16: {
2123  this->has_flash_length = value.as_bool();
2124  return true;
2125  }
2126  case 17: {
2127  this->flash_length = value.as_uint32();
2128  return true;
2129  }
2130  case 18: {
2131  this->has_effect = value.as_bool();
2132  return true;
2133  }
2134  default:
2135  return false;
2136  }
2137 }
2139  switch (field_id) {
2140  case 19: {
2141  this->effect = value.as_string();
2142  return true;
2143  }
2144  default:
2145  return false;
2146  }
2147 }
2148 bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2149  switch (field_id) {
2150  case 1: {
2151  this->key = value.as_fixed32();
2152  return true;
2153  }
2154  case 5: {
2155  this->brightness = value.as_float();
2156  return true;
2157  }
2158  case 21: {
2159  this->color_brightness = value.as_float();
2160  return true;
2161  }
2162  case 7: {
2163  this->red = value.as_float();
2164  return true;
2165  }
2166  case 8: {
2167  this->green = value.as_float();
2168  return true;
2169  }
2170  case 9: {
2171  this->blue = value.as_float();
2172  return true;
2173  }
2174  case 11: {
2175  this->white = value.as_float();
2176  return true;
2177  }
2178  case 13: {
2179  this->color_temperature = value.as_float();
2180  return true;
2181  }
2182  case 25: {
2183  this->cold_white = value.as_float();
2184  return true;
2185  }
2186  case 27: {
2187  this->warm_white = value.as_float();
2188  return true;
2189  }
2190  default:
2191  return false;
2192  }
2193 }
2195  buffer.encode_fixed32(1, this->key);
2196  buffer.encode_bool(2, this->has_state);
2197  buffer.encode_bool(3, this->state);
2198  buffer.encode_bool(4, this->has_brightness);
2199  buffer.encode_float(5, this->brightness);
2200  buffer.encode_bool(22, this->has_color_mode);
2201  buffer.encode_enum<enums::ColorMode>(23, this->color_mode);
2202  buffer.encode_bool(20, this->has_color_brightness);
2203  buffer.encode_float(21, this->color_brightness);
2204  buffer.encode_bool(6, this->has_rgb);
2205  buffer.encode_float(7, this->red);
2206  buffer.encode_float(8, this->green);
2207  buffer.encode_float(9, this->blue);
2208  buffer.encode_bool(10, this->has_white);
2209  buffer.encode_float(11, this->white);
2210  buffer.encode_bool(12, this->has_color_temperature);
2211  buffer.encode_float(13, this->color_temperature);
2212  buffer.encode_bool(24, this->has_cold_white);
2213  buffer.encode_float(25, this->cold_white);
2214  buffer.encode_bool(26, this->has_warm_white);
2215  buffer.encode_float(27, this->warm_white);
2216  buffer.encode_bool(14, this->has_transition_length);
2217  buffer.encode_uint32(15, this->transition_length);
2218  buffer.encode_bool(16, this->has_flash_length);
2219  buffer.encode_uint32(17, this->flash_length);
2220  buffer.encode_bool(18, this->has_effect);
2221  buffer.encode_string(19, this->effect);
2222 }
2223 #ifdef HAS_PROTO_MESSAGE_DUMP
2224 void LightCommandRequest::dump_to(std::string &out) const {
2225  __attribute__((unused)) char buffer[64];
2226  out.append("LightCommandRequest {\n");
2227  out.append(" key: ");
2228  sprintf(buffer, "%" PRIu32, this->key);
2229  out.append(buffer);
2230  out.append("\n");
2231 
2232  out.append(" has_state: ");
2233  out.append(YESNO(this->has_state));
2234  out.append("\n");
2235 
2236  out.append(" state: ");
2237  out.append(YESNO(this->state));
2238  out.append("\n");
2239 
2240  out.append(" has_brightness: ");
2241  out.append(YESNO(this->has_brightness));
2242  out.append("\n");
2243 
2244  out.append(" brightness: ");
2245  sprintf(buffer, "%g", this->brightness);
2246  out.append(buffer);
2247  out.append("\n");
2248 
2249  out.append(" has_color_mode: ");
2250  out.append(YESNO(this->has_color_mode));
2251  out.append("\n");
2252 
2253  out.append(" color_mode: ");
2254  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
2255  out.append("\n");
2256 
2257  out.append(" has_color_brightness: ");
2258  out.append(YESNO(this->has_color_brightness));
2259  out.append("\n");
2260 
2261  out.append(" color_brightness: ");
2262  sprintf(buffer, "%g", this->color_brightness);
2263  out.append(buffer);
2264  out.append("\n");
2265 
2266  out.append(" has_rgb: ");
2267  out.append(YESNO(this->has_rgb));
2268  out.append("\n");
2269 
2270  out.append(" red: ");
2271  sprintf(buffer, "%g", this->red);
2272  out.append(buffer);
2273  out.append("\n");
2274 
2275  out.append(" green: ");
2276  sprintf(buffer, "%g", this->green);
2277  out.append(buffer);
2278  out.append("\n");
2279 
2280  out.append(" blue: ");
2281  sprintf(buffer, "%g", this->blue);
2282  out.append(buffer);
2283  out.append("\n");
2284 
2285  out.append(" has_white: ");
2286  out.append(YESNO(this->has_white));
2287  out.append("\n");
2288 
2289  out.append(" white: ");
2290  sprintf(buffer, "%g", this->white);
2291  out.append(buffer);
2292  out.append("\n");
2293 
2294  out.append(" has_color_temperature: ");
2295  out.append(YESNO(this->has_color_temperature));
2296  out.append("\n");
2297 
2298  out.append(" color_temperature: ");
2299  sprintf(buffer, "%g", this->color_temperature);
2300  out.append(buffer);
2301  out.append("\n");
2302 
2303  out.append(" has_cold_white: ");
2304  out.append(YESNO(this->has_cold_white));
2305  out.append("\n");
2306 
2307  out.append(" cold_white: ");
2308  sprintf(buffer, "%g", this->cold_white);
2309  out.append(buffer);
2310  out.append("\n");
2311 
2312  out.append(" has_warm_white: ");
2313  out.append(YESNO(this->has_warm_white));
2314  out.append("\n");
2315 
2316  out.append(" warm_white: ");
2317  sprintf(buffer, "%g", this->warm_white);
2318  out.append(buffer);
2319  out.append("\n");
2320 
2321  out.append(" has_transition_length: ");
2322  out.append(YESNO(this->has_transition_length));
2323  out.append("\n");
2324 
2325  out.append(" transition_length: ");
2326  sprintf(buffer, "%" PRIu32, this->transition_length);
2327  out.append(buffer);
2328  out.append("\n");
2329 
2330  out.append(" has_flash_length: ");
2331  out.append(YESNO(this->has_flash_length));
2332  out.append("\n");
2333 
2334  out.append(" flash_length: ");
2335  sprintf(buffer, "%" PRIu32, this->flash_length);
2336  out.append(buffer);
2337  out.append("\n");
2338 
2339  out.append(" has_effect: ");
2340  out.append(YESNO(this->has_effect));
2341  out.append("\n");
2342 
2343  out.append(" effect: ");
2344  out.append("'").append(this->effect).append("'");
2345  out.append("\n");
2346  out.append("}");
2347 }
2348 #endif
2350  switch (field_id) {
2351  case 7: {
2352  this->accuracy_decimals = value.as_int32();
2353  return true;
2354  }
2355  case 8: {
2356  this->force_update = value.as_bool();
2357  return true;
2358  }
2359  case 10: {
2360  this->state_class = value.as_enum<enums::SensorStateClass>();
2361  return true;
2362  }
2363  case 11: {
2364  this->legacy_last_reset_type = value.as_enum<enums::SensorLastResetType>();
2365  return true;
2366  }
2367  case 12: {
2368  this->disabled_by_default = value.as_bool();
2369  return true;
2370  }
2371  case 13: {
2372  this->entity_category = value.as_enum<enums::EntityCategory>();
2373  return true;
2374  }
2375  default:
2376  return false;
2377  }
2378 }
2380  switch (field_id) {
2381  case 1: {
2382  this->object_id = value.as_string();
2383  return true;
2384  }
2385  case 3: {
2386  this->name = value.as_string();
2387  return true;
2388  }
2389  case 4: {
2390  this->unique_id = value.as_string();
2391  return true;
2392  }
2393  case 5: {
2394  this->icon = value.as_string();
2395  return true;
2396  }
2397  case 6: {
2398  this->unit_of_measurement = value.as_string();
2399  return true;
2400  }
2401  case 9: {
2402  this->device_class = value.as_string();
2403  return true;
2404  }
2405  default:
2406  return false;
2407  }
2408 }
2410  switch (field_id) {
2411  case 2: {
2412  this->key = value.as_fixed32();
2413  return true;
2414  }
2415  default:
2416  return false;
2417  }
2418 }
2420  buffer.encode_string(1, this->object_id);
2421  buffer.encode_fixed32(2, this->key);
2422  buffer.encode_string(3, this->name);
2423  buffer.encode_string(4, this->unique_id);
2424  buffer.encode_string(5, this->icon);
2425  buffer.encode_string(6, this->unit_of_measurement);
2426  buffer.encode_int32(7, this->accuracy_decimals);
2427  buffer.encode_bool(8, this->force_update);
2428  buffer.encode_string(9, this->device_class);
2429  buffer.encode_enum<enums::SensorStateClass>(10, this->state_class);
2430  buffer.encode_enum<enums::SensorLastResetType>(11, this->legacy_last_reset_type);
2431  buffer.encode_bool(12, this->disabled_by_default);
2432  buffer.encode_enum<enums::EntityCategory>(13, this->entity_category);
2433 }
2434 #ifdef HAS_PROTO_MESSAGE_DUMP
2435 void ListEntitiesSensorResponse::dump_to(std::string &out) const {
2436  __attribute__((unused)) char buffer[64];
2437  out.append("ListEntitiesSensorResponse {\n");
2438  out.append(" object_id: ");
2439  out.append("'").append(this->object_id).append("'");
2440  out.append("\n");
2441 
2442  out.append(" key: ");
2443  sprintf(buffer, "%" PRIu32, this->key);
2444  out.append(buffer);
2445  out.append("\n");
2446 
2447  out.append(" name: ");
2448  out.append("'").append(this->name).append("'");
2449  out.append("\n");
2450 
2451  out.append(" unique_id: ");
2452  out.append("'").append(this->unique_id).append("'");
2453  out.append("\n");
2454 
2455  out.append(" icon: ");
2456  out.append("'").append(this->icon).append("'");
2457  out.append("\n");
2458 
2459  out.append(" unit_of_measurement: ");
2460  out.append("'").append(this->unit_of_measurement).append("'");
2461  out.append("\n");
2462 
2463  out.append(" accuracy_decimals: ");
2464  sprintf(buffer, "%" PRId32, this->accuracy_decimals);
2465  out.append(buffer);
2466  out.append("\n");
2467 
2468  out.append(" force_update: ");
2469  out.append(YESNO(this->force_update));
2470  out.append("\n");
2471 
2472  out.append(" device_class: ");
2473  out.append("'").append(this->device_class).append("'");
2474  out.append("\n");
2475 
2476  out.append(" state_class: ");
2477  out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
2478  out.append("\n");
2479 
2480  out.append(" legacy_last_reset_type: ");
2481  out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type));
2482  out.append("\n");
2483 
2484  out.append(" disabled_by_default: ");
2485  out.append(YESNO(this->disabled_by_default));
2486  out.append("\n");
2487 
2488  out.append(" entity_category: ");
2489  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2490  out.append("\n");
2491  out.append("}");
2492 }
2493 #endif
2494 bool SensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2495  switch (field_id) {
2496  case 3: {
2497  this->missing_state = value.as_bool();
2498  return true;
2499  }
2500  default:
2501  return false;
2502  }
2503 }
2504 bool SensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2505  switch (field_id) {
2506  case 1: {
2507  this->key = value.as_fixed32();
2508  return true;
2509  }
2510  case 2: {
2511  this->state = value.as_float();
2512  return true;
2513  }
2514  default:
2515  return false;
2516  }
2517 }
2519  buffer.encode_fixed32(1, this->key);
2520  buffer.encode_float(2, this->state);
2521  buffer.encode_bool(3, this->missing_state);
2522 }
2523 #ifdef HAS_PROTO_MESSAGE_DUMP
2524 void SensorStateResponse::dump_to(std::string &out) const {
2525  __attribute__((unused)) char buffer[64];
2526  out.append("SensorStateResponse {\n");
2527  out.append(" key: ");
2528  sprintf(buffer, "%" PRIu32, this->key);
2529  out.append(buffer);
2530  out.append("\n");
2531 
2532  out.append(" state: ");
2533  sprintf(buffer, "%g", this->state);
2534  out.append(buffer);
2535  out.append("\n");
2536 
2537  out.append(" missing_state: ");
2538  out.append(YESNO(this->missing_state));
2539  out.append("\n");
2540  out.append("}");
2541 }
2542 #endif
2544  switch (field_id) {
2545  case 6: {
2546  this->assumed_state = value.as_bool();
2547  return true;
2548  }
2549  case 7: {
2550  this->disabled_by_default = value.as_bool();
2551  return true;
2552  }
2553  case 8: {
2554  this->entity_category = value.as_enum<enums::EntityCategory>();
2555  return true;
2556  }
2557  default:
2558  return false;
2559  }
2560 }
2562  switch (field_id) {
2563  case 1: {
2564  this->object_id = value.as_string();
2565  return true;
2566  }
2567  case 3: {
2568  this->name = value.as_string();
2569  return true;
2570  }
2571  case 4: {
2572  this->unique_id = value.as_string();
2573  return true;
2574  }
2575  case 5: {
2576  this->icon = value.as_string();
2577  return true;
2578  }
2579  case 9: {
2580  this->device_class = value.as_string();
2581  return true;
2582  }
2583  default:
2584  return false;
2585  }
2586 }
2588  switch (field_id) {
2589  case 2: {
2590  this->key = value.as_fixed32();
2591  return true;
2592  }
2593  default:
2594  return false;
2595  }
2596 }
2598  buffer.encode_string(1, this->object_id);
2599  buffer.encode_fixed32(2, this->key);
2600  buffer.encode_string(3, this->name);
2601  buffer.encode_string(4, this->unique_id);
2602  buffer.encode_string(5, this->icon);
2603  buffer.encode_bool(6, this->assumed_state);
2604  buffer.encode_bool(7, this->disabled_by_default);
2605  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
2606  buffer.encode_string(9, this->device_class);
2607 }
2608 #ifdef HAS_PROTO_MESSAGE_DUMP
2609 void ListEntitiesSwitchResponse::dump_to(std::string &out) const {
2610  __attribute__((unused)) char buffer[64];
2611  out.append("ListEntitiesSwitchResponse {\n");
2612  out.append(" object_id: ");
2613  out.append("'").append(this->object_id).append("'");
2614  out.append("\n");
2615 
2616  out.append(" key: ");
2617  sprintf(buffer, "%" PRIu32, this->key);
2618  out.append(buffer);
2619  out.append("\n");
2620 
2621  out.append(" name: ");
2622  out.append("'").append(this->name).append("'");
2623  out.append("\n");
2624 
2625  out.append(" unique_id: ");
2626  out.append("'").append(this->unique_id).append("'");
2627  out.append("\n");
2628 
2629  out.append(" icon: ");
2630  out.append("'").append(this->icon).append("'");
2631  out.append("\n");
2632 
2633  out.append(" assumed_state: ");
2634  out.append(YESNO(this->assumed_state));
2635  out.append("\n");
2636 
2637  out.append(" disabled_by_default: ");
2638  out.append(YESNO(this->disabled_by_default));
2639  out.append("\n");
2640 
2641  out.append(" entity_category: ");
2642  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2643  out.append("\n");
2644 
2645  out.append(" device_class: ");
2646  out.append("'").append(this->device_class).append("'");
2647  out.append("\n");
2648  out.append("}");
2649 }
2650 #endif
2651 bool SwitchStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2652  switch (field_id) {
2653  case 2: {
2654  this->state = value.as_bool();
2655  return true;
2656  }
2657  default:
2658  return false;
2659  }
2660 }
2661 bool SwitchStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2662  switch (field_id) {
2663  case 1: {
2664  this->key = value.as_fixed32();
2665  return true;
2666  }
2667  default:
2668  return false;
2669  }
2670 }
2672  buffer.encode_fixed32(1, this->key);
2673  buffer.encode_bool(2, this->state);
2674 }
2675 #ifdef HAS_PROTO_MESSAGE_DUMP
2676 void SwitchStateResponse::dump_to(std::string &out) const {
2677  __attribute__((unused)) char buffer[64];
2678  out.append("SwitchStateResponse {\n");
2679  out.append(" key: ");
2680  sprintf(buffer, "%" PRIu32, this->key);
2681  out.append(buffer);
2682  out.append("\n");
2683 
2684  out.append(" state: ");
2685  out.append(YESNO(this->state));
2686  out.append("\n");
2687  out.append("}");
2688 }
2689 #endif
2690 bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2691  switch (field_id) {
2692  case 2: {
2693  this->state = value.as_bool();
2694  return true;
2695  }
2696  default:
2697  return false;
2698  }
2699 }
2700 bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2701  switch (field_id) {
2702  case 1: {
2703  this->key = value.as_fixed32();
2704  return true;
2705  }
2706  default:
2707  return false;
2708  }
2709 }
2711  buffer.encode_fixed32(1, this->key);
2712  buffer.encode_bool(2, this->state);
2713 }
2714 #ifdef HAS_PROTO_MESSAGE_DUMP
2715 void SwitchCommandRequest::dump_to(std::string &out) const {
2716  __attribute__((unused)) char buffer[64];
2717  out.append("SwitchCommandRequest {\n");
2718  out.append(" key: ");
2719  sprintf(buffer, "%" PRIu32, this->key);
2720  out.append(buffer);
2721  out.append("\n");
2722 
2723  out.append(" state: ");
2724  out.append(YESNO(this->state));
2725  out.append("\n");
2726  out.append("}");
2727 }
2728 #endif
2730  switch (field_id) {
2731  case 6: {
2732  this->disabled_by_default = value.as_bool();
2733  return true;
2734  }
2735  case 7: {
2736  this->entity_category = value.as_enum<enums::EntityCategory>();
2737  return true;
2738  }
2739  default:
2740  return false;
2741  }
2742 }
2744  switch (field_id) {
2745  case 1: {
2746  this->object_id = value.as_string();
2747  return true;
2748  }
2749  case 3: {
2750  this->name = value.as_string();
2751  return true;
2752  }
2753  case 4: {
2754  this->unique_id = value.as_string();
2755  return true;
2756  }
2757  case 5: {
2758  this->icon = value.as_string();
2759  return true;
2760  }
2761  case 8: {
2762  this->device_class = value.as_string();
2763  return true;
2764  }
2765  default:
2766  return false;
2767  }
2768 }
2770  switch (field_id) {
2771  case 2: {
2772  this->key = value.as_fixed32();
2773  return true;
2774  }
2775  default:
2776  return false;
2777  }
2778 }
2780  buffer.encode_string(1, this->object_id);
2781  buffer.encode_fixed32(2, this->key);
2782  buffer.encode_string(3, this->name);
2783  buffer.encode_string(4, this->unique_id);
2784  buffer.encode_string(5, this->icon);
2785  buffer.encode_bool(6, this->disabled_by_default);
2786  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
2787  buffer.encode_string(8, this->device_class);
2788 }
2789 #ifdef HAS_PROTO_MESSAGE_DUMP
2790 void ListEntitiesTextSensorResponse::dump_to(std::string &out) const {
2791  __attribute__((unused)) char buffer[64];
2792  out.append("ListEntitiesTextSensorResponse {\n");
2793  out.append(" object_id: ");
2794  out.append("'").append(this->object_id).append("'");
2795  out.append("\n");
2796 
2797  out.append(" key: ");
2798  sprintf(buffer, "%" PRIu32, this->key);
2799  out.append(buffer);
2800  out.append("\n");
2801 
2802  out.append(" name: ");
2803  out.append("'").append(this->name).append("'");
2804  out.append("\n");
2805 
2806  out.append(" unique_id: ");
2807  out.append("'").append(this->unique_id).append("'");
2808  out.append("\n");
2809 
2810  out.append(" icon: ");
2811  out.append("'").append(this->icon).append("'");
2812  out.append("\n");
2813 
2814  out.append(" disabled_by_default: ");
2815  out.append(YESNO(this->disabled_by_default));
2816  out.append("\n");
2817 
2818  out.append(" entity_category: ");
2819  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2820  out.append("\n");
2821 
2822  out.append(" device_class: ");
2823  out.append("'").append(this->device_class).append("'");
2824  out.append("\n");
2825  out.append("}");
2826 }
2827 #endif
2828 bool TextSensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2829  switch (field_id) {
2830  case 3: {
2831  this->missing_state = value.as_bool();
2832  return true;
2833  }
2834  default:
2835  return false;
2836  }
2837 }
2839  switch (field_id) {
2840  case 2: {
2841  this->state = value.as_string();
2842  return true;
2843  }
2844  default:
2845  return false;
2846  }
2847 }
2848 bool TextSensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2849  switch (field_id) {
2850  case 1: {
2851  this->key = value.as_fixed32();
2852  return true;
2853  }
2854  default:
2855  return false;
2856  }
2857 }
2859  buffer.encode_fixed32(1, this->key);
2860  buffer.encode_string(2, this->state);
2861  buffer.encode_bool(3, this->missing_state);
2862 }
2863 #ifdef HAS_PROTO_MESSAGE_DUMP
2864 void TextSensorStateResponse::dump_to(std::string &out) const {
2865  __attribute__((unused)) char buffer[64];
2866  out.append("TextSensorStateResponse {\n");
2867  out.append(" key: ");
2868  sprintf(buffer, "%" PRIu32, this->key);
2869  out.append(buffer);
2870  out.append("\n");
2871 
2872  out.append(" state: ");
2873  out.append("'").append(this->state).append("'");
2874  out.append("\n");
2875 
2876  out.append(" missing_state: ");
2877  out.append(YESNO(this->missing_state));
2878  out.append("\n");
2879  out.append("}");
2880 }
2881 #endif
2882 bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2883  switch (field_id) {
2884  case 1: {
2885  this->level = value.as_enum<enums::LogLevel>();
2886  return true;
2887  }
2888  case 2: {
2889  this->dump_config = value.as_bool();
2890  return true;
2891  }
2892  default:
2893  return false;
2894  }
2895 }
2897  buffer.encode_enum<enums::LogLevel>(1, this->level);
2898  buffer.encode_bool(2, this->dump_config);
2899 }
2900 #ifdef HAS_PROTO_MESSAGE_DUMP
2901 void SubscribeLogsRequest::dump_to(std::string &out) const {
2902  __attribute__((unused)) char buffer[64];
2903  out.append("SubscribeLogsRequest {\n");
2904  out.append(" level: ");
2905  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2906  out.append("\n");
2907 
2908  out.append(" dump_config: ");
2909  out.append(YESNO(this->dump_config));
2910  out.append("\n");
2911  out.append("}");
2912 }
2913 #endif
2914 bool SubscribeLogsResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2915  switch (field_id) {
2916  case 1: {
2917  this->level = value.as_enum<enums::LogLevel>();
2918  return true;
2919  }
2920  case 4: {
2921  this->send_failed = value.as_bool();
2922  return true;
2923  }
2924  default:
2925  return false;
2926  }
2927 }
2929  switch (field_id) {
2930  case 3: {
2931  this->message = value.as_string();
2932  return true;
2933  }
2934  default:
2935  return false;
2936  }
2937 }
2939  buffer.encode_enum<enums::LogLevel>(1, this->level);
2940  buffer.encode_string(3, this->message);
2941  buffer.encode_bool(4, this->send_failed);
2942 }
2943 #ifdef HAS_PROTO_MESSAGE_DUMP
2944 void SubscribeLogsResponse::dump_to(std::string &out) const {
2945  __attribute__((unused)) char buffer[64];
2946  out.append("SubscribeLogsResponse {\n");
2947  out.append(" level: ");
2948  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2949  out.append("\n");
2950 
2951  out.append(" message: ");
2952  out.append("'").append(this->message).append("'");
2953  out.append("\n");
2954 
2955  out.append(" send_failed: ");
2956  out.append(YESNO(this->send_failed));
2957  out.append("\n");
2958  out.append("}");
2959 }
2960 #endif
2962 #ifdef HAS_PROTO_MESSAGE_DUMP
2964  out.append("SubscribeHomeassistantServicesRequest {}");
2965 }
2966 #endif
2968  switch (field_id) {
2969  case 1: {
2970  this->key = value.as_string();
2971  return true;
2972  }
2973  case 2: {
2974  this->value = value.as_string();
2975  return true;
2976  }
2977  default:
2978  return false;
2979  }
2980 }
2982  buffer.encode_string(1, this->key);
2983  buffer.encode_string(2, this->value);
2984 }
2985 #ifdef HAS_PROTO_MESSAGE_DUMP
2986 void HomeassistantServiceMap::dump_to(std::string &out) const {
2987  __attribute__((unused)) char buffer[64];
2988  out.append("HomeassistantServiceMap {\n");
2989  out.append(" key: ");
2990  out.append("'").append(this->key).append("'");
2991  out.append("\n");
2992 
2993  out.append(" value: ");
2994  out.append("'").append(this->value).append("'");
2995  out.append("\n");
2996  out.append("}");
2997 }
2998 #endif
3000  switch (field_id) {
3001  case 5: {
3002  this->is_event = value.as_bool();
3003  return true;
3004  }
3005  default:
3006  return false;
3007  }
3008 }
3010  switch (field_id) {
3011  case 1: {
3012  this->service = value.as_string();
3013  return true;
3014  }
3015  case 2: {
3016  this->data.push_back(value.as_message<HomeassistantServiceMap>());
3017  return true;
3018  }
3019  case 3: {
3020  this->data_template.push_back(value.as_message<HomeassistantServiceMap>());
3021  return true;
3022  }
3023  case 4: {
3024  this->variables.push_back(value.as_message<HomeassistantServiceMap>());
3025  return true;
3026  }
3027  default:
3028  return false;
3029  }
3030 }
3032  buffer.encode_string(1, this->service);
3033  for (auto &it : this->data) {
3034  buffer.encode_message<HomeassistantServiceMap>(2, it, true);
3035  }
3036  for (auto &it : this->data_template) {
3037  buffer.encode_message<HomeassistantServiceMap>(3, it, true);
3038  }
3039  for (auto &it : this->variables) {
3040  buffer.encode_message<HomeassistantServiceMap>(4, it, true);
3041  }
3042  buffer.encode_bool(5, this->is_event);
3043 }
3044 #ifdef HAS_PROTO_MESSAGE_DUMP
3045 void HomeassistantServiceResponse::dump_to(std::string &out) const {
3046  __attribute__((unused)) char buffer[64];
3047  out.append("HomeassistantServiceResponse {\n");
3048  out.append(" service: ");
3049  out.append("'").append(this->service).append("'");
3050  out.append("\n");
3051 
3052  for (const auto &it : this->data) {
3053  out.append(" data: ");
3054  it.dump_to(out);
3055  out.append("\n");
3056  }
3057 
3058  for (const auto &it : this->data_template) {
3059  out.append(" data_template: ");
3060  it.dump_to(out);
3061  out.append("\n");
3062  }
3063 
3064  for (const auto &it : this->variables) {
3065  out.append(" variables: ");
3066  it.dump_to(out);
3067  out.append("\n");
3068  }
3069 
3070  out.append(" is_event: ");
3071  out.append(YESNO(this->is_event));
3072  out.append("\n");
3073  out.append("}");
3074 }
3075 #endif
3077 #ifdef HAS_PROTO_MESSAGE_DUMP
3078 void SubscribeHomeAssistantStatesRequest::dump_to(std::string &out) const {
3079  out.append("SubscribeHomeAssistantStatesRequest {}");
3080 }
3081 #endif
3083  switch (field_id) {
3084  case 1: {
3085  this->entity_id = value.as_string();
3086  return true;
3087  }
3088  case 2: {
3089  this->attribute = value.as_string();
3090  return true;
3091  }
3092  default:
3093  return false;
3094  }
3095 }
3097  buffer.encode_string(1, this->entity_id);
3098  buffer.encode_string(2, this->attribute);
3099 }
3100 #ifdef HAS_PROTO_MESSAGE_DUMP
3101 void SubscribeHomeAssistantStateResponse::dump_to(std::string &out) const {
3102  __attribute__((unused)) char buffer[64];
3103  out.append("SubscribeHomeAssistantStateResponse {\n");
3104  out.append(" entity_id: ");
3105  out.append("'").append(this->entity_id).append("'");
3106  out.append("\n");
3107 
3108  out.append(" attribute: ");
3109  out.append("'").append(this->attribute).append("'");
3110  out.append("\n");
3111  out.append("}");
3112 }
3113 #endif
3115  switch (field_id) {
3116  case 1: {
3117  this->entity_id = value.as_string();
3118  return true;
3119  }
3120  case 2: {
3121  this->state = value.as_string();
3122  return true;
3123  }
3124  case 3: {
3125  this->attribute = value.as_string();
3126  return true;
3127  }
3128  default:
3129  return false;
3130  }
3131 }
3133  buffer.encode_string(1, this->entity_id);
3134  buffer.encode_string(2, this->state);
3135  buffer.encode_string(3, this->attribute);
3136 }
3137 #ifdef HAS_PROTO_MESSAGE_DUMP
3138 void HomeAssistantStateResponse::dump_to(std::string &out) const {
3139  __attribute__((unused)) char buffer[64];
3140  out.append("HomeAssistantStateResponse {\n");
3141  out.append(" entity_id: ");
3142  out.append("'").append(this->entity_id).append("'");
3143  out.append("\n");
3144 
3145  out.append(" state: ");
3146  out.append("'").append(this->state).append("'");
3147  out.append("\n");
3148 
3149  out.append(" attribute: ");
3150  out.append("'").append(this->attribute).append("'");
3151  out.append("\n");
3152  out.append("}");
3153 }
3154 #endif
3156 #ifdef HAS_PROTO_MESSAGE_DUMP
3157 void GetTimeRequest::dump_to(std::string &out) const { out.append("GetTimeRequest {}"); }
3158 #endif
3159 bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3160  switch (field_id) {
3161  case 1: {
3162  this->epoch_seconds = value.as_fixed32();
3163  return true;
3164  }
3165  default:
3166  return false;
3167  }
3168 }
3169 void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->epoch_seconds); }
3170 #ifdef HAS_PROTO_MESSAGE_DUMP
3171 void GetTimeResponse::dump_to(std::string &out) const {
3172  __attribute__((unused)) char buffer[64];
3173  out.append("GetTimeResponse {\n");
3174  out.append(" epoch_seconds: ");
3175  sprintf(buffer, "%" PRIu32, this->epoch_seconds);
3176  out.append(buffer);
3177  out.append("\n");
3178  out.append("}");
3179 }
3180 #endif
3182  switch (field_id) {
3183  case 2: {
3184  this->type = value.as_enum<enums::ServiceArgType>();
3185  return true;
3186  }
3187  default:
3188  return false;
3189  }
3190 }
3192  switch (field_id) {
3193  case 1: {
3194  this->name = value.as_string();
3195  return true;
3196  }
3197  default:
3198  return false;
3199  }
3200 }
3202  buffer.encode_string(1, this->name);
3203  buffer.encode_enum<enums::ServiceArgType>(2, this->type);
3204 }
3205 #ifdef HAS_PROTO_MESSAGE_DUMP
3206 void ListEntitiesServicesArgument::dump_to(std::string &out) const {
3207  __attribute__((unused)) char buffer[64];
3208  out.append("ListEntitiesServicesArgument {\n");
3209  out.append(" name: ");
3210  out.append("'").append(this->name).append("'");
3211  out.append("\n");
3212 
3213  out.append(" type: ");
3214  out.append(proto_enum_to_string<enums::ServiceArgType>(this->type));
3215  out.append("\n");
3216  out.append("}");
3217 }
3218 #endif
3220  switch (field_id) {
3221  case 1: {
3222  this->name = value.as_string();
3223  return true;
3224  }
3225  case 3: {
3226  this->args.push_back(value.as_message<ListEntitiesServicesArgument>());
3227  return true;
3228  }
3229  default:
3230  return false;
3231  }
3232 }
3234  switch (field_id) {
3235  case 2: {
3236  this->key = value.as_fixed32();
3237  return true;
3238  }
3239  default:
3240  return false;
3241  }
3242 }
3244  buffer.encode_string(1, this->name);
3245  buffer.encode_fixed32(2, this->key);
3246  for (auto &it : this->args) {
3247  buffer.encode_message<ListEntitiesServicesArgument>(3, it, true);
3248  }
3249 }
3250 #ifdef HAS_PROTO_MESSAGE_DUMP
3251 void ListEntitiesServicesResponse::dump_to(std::string &out) const {
3252  __attribute__((unused)) char buffer[64];
3253  out.append("ListEntitiesServicesResponse {\n");
3254  out.append(" name: ");
3255  out.append("'").append(this->name).append("'");
3256  out.append("\n");
3257 
3258  out.append(" key: ");
3259  sprintf(buffer, "%" PRIu32, this->key);
3260  out.append(buffer);
3261  out.append("\n");
3262 
3263  for (const auto &it : this->args) {
3264  out.append(" args: ");
3265  it.dump_to(out);
3266  out.append("\n");
3267  }
3268  out.append("}");
3269 }
3270 #endif
3271 bool ExecuteServiceArgument::decode_varint(uint32_t field_id, ProtoVarInt value) {
3272  switch (field_id) {
3273  case 1: {
3274  this->bool_ = value.as_bool();
3275  return true;
3276  }
3277  case 2: {
3278  this->legacy_int = value.as_int32();
3279  return true;
3280  }
3281  case 5: {
3282  this->int_ = value.as_sint32();
3283  return true;
3284  }
3285  case 6: {
3286  this->bool_array.push_back(value.as_bool());
3287  return true;
3288  }
3289  case 7: {
3290  this->int_array.push_back(value.as_sint32());
3291  return true;
3292  }
3293  default:
3294  return false;
3295  }
3296 }
3298  switch (field_id) {
3299  case 4: {
3300  this->string_ = value.as_string();
3301  return true;
3302  }
3303  case 9: {
3304  this->string_array.push_back(value.as_string());
3305  return true;
3306  }
3307  default:
3308  return false;
3309  }
3310 }
3311 bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
3312  switch (field_id) {
3313  case 3: {
3314  this->float_ = value.as_float();
3315  return true;
3316  }
3317  case 8: {
3318  this->float_array.push_back(value.as_float());
3319  return true;
3320  }
3321  default:
3322  return false;
3323  }
3324 }
3326  buffer.encode_bool(1, this->bool_);
3327  buffer.encode_int32(2, this->legacy_int);
3328  buffer.encode_float(3, this->float_);
3329  buffer.encode_string(4, this->string_);
3330  buffer.encode_sint32(5, this->int_);
3331  for (auto it : this->bool_array) {
3332  buffer.encode_bool(6, it, true);
3333  }
3334  for (auto &it : this->int_array) {
3335  buffer.encode_sint32(7, it, true);
3336  }
3337  for (auto &it : this->float_array) {
3338  buffer.encode_float(8, it, true);
3339  }
3340  for (auto &it : this->string_array) {
3341  buffer.encode_string(9, it, true);
3342  }
3343 }
3344 #ifdef HAS_PROTO_MESSAGE_DUMP
3345 void ExecuteServiceArgument::dump_to(std::string &out) const {
3346  __attribute__((unused)) char buffer[64];
3347  out.append("ExecuteServiceArgument {\n");
3348  out.append(" bool_: ");
3349  out.append(YESNO(this->bool_));
3350  out.append("\n");
3351 
3352  out.append(" legacy_int: ");
3353  sprintf(buffer, "%" PRId32, this->legacy_int);
3354  out.append(buffer);
3355  out.append("\n");
3356 
3357  out.append(" float_: ");
3358  sprintf(buffer, "%g", this->float_);
3359  out.append(buffer);
3360  out.append("\n");
3361 
3362  out.append(" string_: ");
3363  out.append("'").append(this->string_).append("'");
3364  out.append("\n");
3365 
3366  out.append(" int_: ");
3367  sprintf(buffer, "%" PRId32, this->int_);
3368  out.append(buffer);
3369  out.append("\n");
3370 
3371  for (const auto it : this->bool_array) {
3372  out.append(" bool_array: ");
3373  out.append(YESNO(it));
3374  out.append("\n");
3375  }
3376 
3377  for (const auto &it : this->int_array) {
3378  out.append(" int_array: ");
3379  sprintf(buffer, "%" PRId32, it);
3380  out.append(buffer);
3381  out.append("\n");
3382  }
3383 
3384  for (const auto &it : this->float_array) {
3385  out.append(" float_array: ");
3386  sprintf(buffer, "%g", it);
3387  out.append(buffer);
3388  out.append("\n");
3389  }
3390 
3391  for (const auto &it : this->string_array) {
3392  out.append(" string_array: ");
3393  out.append("'").append(it).append("'");
3394  out.append("\n");
3395  }
3396  out.append("}");
3397 }
3398 #endif
3400  switch (field_id) {
3401  case 2: {
3402  this->args.push_back(value.as_message<ExecuteServiceArgument>());
3403  return true;
3404  }
3405  default:
3406  return false;
3407  }
3408 }
3409 bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3410  switch (field_id) {
3411  case 1: {
3412  this->key = value.as_fixed32();
3413  return true;
3414  }
3415  default:
3416  return false;
3417  }
3418 }
3420  buffer.encode_fixed32(1, this->key);
3421  for (auto &it : this->args) {
3422  buffer.encode_message<ExecuteServiceArgument>(2, it, true);
3423  }
3424 }
3425 #ifdef HAS_PROTO_MESSAGE_DUMP
3426 void ExecuteServiceRequest::dump_to(std::string &out) const {
3427  __attribute__((unused)) char buffer[64];
3428  out.append("ExecuteServiceRequest {\n");
3429  out.append(" key: ");
3430  sprintf(buffer, "%" PRIu32, this->key);
3431  out.append(buffer);
3432  out.append("\n");
3433 
3434  for (const auto &it : this->args) {
3435  out.append(" args: ");
3436  it.dump_to(out);
3437  out.append("\n");
3438  }
3439  out.append("}");
3440 }
3441 #endif
3443  switch (field_id) {
3444  case 5: {
3445  this->disabled_by_default = value.as_bool();
3446  return true;
3447  }
3448  case 7: {
3449  this->entity_category = value.as_enum<enums::EntityCategory>();
3450  return true;
3451  }
3452  default:
3453  return false;
3454  }
3455 }
3457  switch (field_id) {
3458  case 1: {
3459  this->object_id = value.as_string();
3460  return true;
3461  }
3462  case 3: {
3463  this->name = value.as_string();
3464  return true;
3465  }
3466  case 4: {
3467  this->unique_id = value.as_string();
3468  return true;
3469  }
3470  case 6: {
3471  this->icon = value.as_string();
3472  return true;
3473  }
3474  default:
3475  return false;
3476  }
3477 }
3479  switch (field_id) {
3480  case 2: {
3481  this->key = value.as_fixed32();
3482  return true;
3483  }
3484  default:
3485  return false;
3486  }
3487 }
3489  buffer.encode_string(1, this->object_id);
3490  buffer.encode_fixed32(2, this->key);
3491  buffer.encode_string(3, this->name);
3492  buffer.encode_string(4, this->unique_id);
3493  buffer.encode_bool(5, this->disabled_by_default);
3494  buffer.encode_string(6, this->icon);
3495  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
3496 }
3497 #ifdef HAS_PROTO_MESSAGE_DUMP
3498 void ListEntitiesCameraResponse::dump_to(std::string &out) const {
3499  __attribute__((unused)) char buffer[64];
3500  out.append("ListEntitiesCameraResponse {\n");
3501  out.append(" object_id: ");
3502  out.append("'").append(this->object_id).append("'");
3503  out.append("\n");
3504 
3505  out.append(" key: ");
3506  sprintf(buffer, "%" PRIu32, this->key);
3507  out.append(buffer);
3508  out.append("\n");
3509 
3510  out.append(" name: ");
3511  out.append("'").append(this->name).append("'");
3512  out.append("\n");
3513 
3514  out.append(" unique_id: ");
3515  out.append("'").append(this->unique_id).append("'");
3516  out.append("\n");
3517 
3518  out.append(" disabled_by_default: ");
3519  out.append(YESNO(this->disabled_by_default));
3520  out.append("\n");
3521 
3522  out.append(" icon: ");
3523  out.append("'").append(this->icon).append("'");
3524  out.append("\n");
3525 
3526  out.append(" entity_category: ");
3527  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3528  out.append("\n");
3529  out.append("}");
3530 }
3531 #endif
3532 bool CameraImageResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3533  switch (field_id) {
3534  case 3: {
3535  this->done = value.as_bool();
3536  return true;
3537  }
3538  default:
3539  return false;
3540  }
3541 }
3543  switch (field_id) {
3544  case 2: {
3545  this->data = value.as_string();
3546  return true;
3547  }
3548  default:
3549  return false;
3550  }
3551 }
3552 bool CameraImageResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3553  switch (field_id) {
3554  case 1: {
3555  this->key = value.as_fixed32();
3556  return true;
3557  }
3558  default:
3559  return false;
3560  }
3561 }
3563  buffer.encode_fixed32(1, this->key);
3564  buffer.encode_string(2, this->data);
3565  buffer.encode_bool(3, this->done);
3566 }
3567 #ifdef HAS_PROTO_MESSAGE_DUMP
3568 void CameraImageResponse::dump_to(std::string &out) const {
3569  __attribute__((unused)) char buffer[64];
3570  out.append("CameraImageResponse {\n");
3571  out.append(" key: ");
3572  sprintf(buffer, "%" PRIu32, this->key);
3573  out.append(buffer);
3574  out.append("\n");
3575 
3576  out.append(" data: ");
3577  out.append("'").append(this->data).append("'");
3578  out.append("\n");
3579 
3580  out.append(" done: ");
3581  out.append(YESNO(this->done));
3582  out.append("\n");
3583  out.append("}");
3584 }
3585 #endif
3586 bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3587  switch (field_id) {
3588  case 1: {
3589  this->single = value.as_bool();
3590  return true;
3591  }
3592  case 2: {
3593  this->stream = value.as_bool();
3594  return true;
3595  }
3596  default:
3597  return false;
3598  }
3599 }
3601  buffer.encode_bool(1, this->single);
3602  buffer.encode_bool(2, this->stream);
3603 }
3604 #ifdef HAS_PROTO_MESSAGE_DUMP
3605 void CameraImageRequest::dump_to(std::string &out) const {
3606  __attribute__((unused)) char buffer[64];
3607  out.append("CameraImageRequest {\n");
3608  out.append(" single: ");
3609  out.append(YESNO(this->single));
3610  out.append("\n");
3611 
3612  out.append(" stream: ");
3613  out.append(YESNO(this->stream));
3614  out.append("\n");
3615  out.append("}");
3616 }
3617 #endif
3619  switch (field_id) {
3620  case 5: {
3621  this->supports_current_temperature = value.as_bool();
3622  return true;
3623  }
3624  case 6: {
3625  this->supports_two_point_target_temperature = value.as_bool();
3626  return true;
3627  }
3628  case 7: {
3629  this->supported_modes.push_back(value.as_enum<enums::ClimateMode>());
3630  return true;
3631  }
3632  case 11: {
3633  this->legacy_supports_away = value.as_bool();
3634  return true;
3635  }
3636  case 12: {
3637  this->supports_action = value.as_bool();
3638  return true;
3639  }
3640  case 13: {
3641  this->supported_fan_modes.push_back(value.as_enum<enums::ClimateFanMode>());
3642  return true;
3643  }
3644  case 14: {
3645  this->supported_swing_modes.push_back(value.as_enum<enums::ClimateSwingMode>());
3646  return true;
3647  }
3648  case 16: {
3649  this->supported_presets.push_back(value.as_enum<enums::ClimatePreset>());
3650  return true;
3651  }
3652  case 18: {
3653  this->disabled_by_default = value.as_bool();
3654  return true;
3655  }
3656  case 20: {
3657  this->entity_category = value.as_enum<enums::EntityCategory>();
3658  return true;
3659  }
3660  case 22: {
3661  this->supports_current_humidity = value.as_bool();
3662  return true;
3663  }
3664  case 23: {
3665  this->supports_target_humidity = value.as_bool();
3666  return true;
3667  }
3668  default:
3669  return false;
3670  }
3671 }
3673  switch (field_id) {
3674  case 1: {
3675  this->object_id = value.as_string();
3676  return true;
3677  }
3678  case 3: {
3679  this->name = value.as_string();
3680  return true;
3681  }
3682  case 4: {
3683  this->unique_id = value.as_string();
3684  return true;
3685  }
3686  case 15: {
3687  this->supported_custom_fan_modes.push_back(value.as_string());
3688  return true;
3689  }
3690  case 17: {
3691  this->supported_custom_presets.push_back(value.as_string());
3692  return true;
3693  }
3694  case 19: {
3695  this->icon = value.as_string();
3696  return true;
3697  }
3698  default:
3699  return false;
3700  }
3701 }
3703  switch (field_id) {
3704  case 2: {
3705  this->key = value.as_fixed32();
3706  return true;
3707  }
3708  case 8: {
3709  this->visual_min_temperature = value.as_float();
3710  return true;
3711  }
3712  case 9: {
3713  this->visual_max_temperature = value.as_float();
3714  return true;
3715  }
3716  case 10: {
3717  this->visual_target_temperature_step = value.as_float();
3718  return true;
3719  }
3720  case 21: {
3721  this->visual_current_temperature_step = value.as_float();
3722  return true;
3723  }
3724  case 24: {
3725  this->visual_min_humidity = value.as_float();
3726  return true;
3727  }
3728  case 25: {
3729  this->visual_max_humidity = value.as_float();
3730  return true;
3731  }
3732  default:
3733  return false;
3734  }
3735 }
3737  buffer.encode_string(1, this->object_id);
3738  buffer.encode_fixed32(2, this->key);
3739  buffer.encode_string(3, this->name);
3740  buffer.encode_string(4, this->unique_id);
3741  buffer.encode_bool(5, this->supports_current_temperature);
3742  buffer.encode_bool(6, this->supports_two_point_target_temperature);
3743  for (auto &it : this->supported_modes) {
3744  buffer.encode_enum<enums::ClimateMode>(7, it, true);
3745  }
3746  buffer.encode_float(8, this->visual_min_temperature);
3747  buffer.encode_float(9, this->visual_max_temperature);
3748  buffer.encode_float(10, this->visual_target_temperature_step);
3749  buffer.encode_bool(11, this->legacy_supports_away);
3750  buffer.encode_bool(12, this->supports_action);
3751  for (auto &it : this->supported_fan_modes) {
3752  buffer.encode_enum<enums::ClimateFanMode>(13, it, true);
3753  }
3754  for (auto &it : this->supported_swing_modes) {
3755  buffer.encode_enum<enums::ClimateSwingMode>(14, it, true);
3756  }
3757  for (auto &it : this->supported_custom_fan_modes) {
3758  buffer.encode_string(15, it, true);
3759  }
3760  for (auto &it : this->supported_presets) {
3761  buffer.encode_enum<enums::ClimatePreset>(16, it, true);
3762  }
3763  for (auto &it : this->supported_custom_presets) {
3764  buffer.encode_string(17, it, true);
3765  }
3766  buffer.encode_bool(18, this->disabled_by_default);
3767  buffer.encode_string(19, this->icon);
3768  buffer.encode_enum<enums::EntityCategory>(20, this->entity_category);
3769  buffer.encode_float(21, this->visual_current_temperature_step);
3770  buffer.encode_bool(22, this->supports_current_humidity);
3771  buffer.encode_bool(23, this->supports_target_humidity);
3772  buffer.encode_float(24, this->visual_min_humidity);
3773  buffer.encode_float(25, this->visual_max_humidity);
3774 }
3775 #ifdef HAS_PROTO_MESSAGE_DUMP
3776 void ListEntitiesClimateResponse::dump_to(std::string &out) const {
3777  __attribute__((unused)) char buffer[64];
3778  out.append("ListEntitiesClimateResponse {\n");
3779  out.append(" object_id: ");
3780  out.append("'").append(this->object_id).append("'");
3781  out.append("\n");
3782 
3783  out.append(" key: ");
3784  sprintf(buffer, "%" PRIu32, this->key);
3785  out.append(buffer);
3786  out.append("\n");
3787 
3788  out.append(" name: ");
3789  out.append("'").append(this->name).append("'");
3790  out.append("\n");
3791 
3792  out.append(" unique_id: ");
3793  out.append("'").append(this->unique_id).append("'");
3794  out.append("\n");
3795 
3796  out.append(" supports_current_temperature: ");
3797  out.append(YESNO(this->supports_current_temperature));
3798  out.append("\n");
3799 
3800  out.append(" supports_two_point_target_temperature: ");
3801  out.append(YESNO(this->supports_two_point_target_temperature));
3802  out.append("\n");
3803 
3804  for (const auto &it : this->supported_modes) {
3805  out.append(" supported_modes: ");
3806  out.append(proto_enum_to_string<enums::ClimateMode>(it));
3807  out.append("\n");
3808  }
3809 
3810  out.append(" visual_min_temperature: ");
3811  sprintf(buffer, "%g", this->visual_min_temperature);
3812  out.append(buffer);
3813  out.append("\n");
3814 
3815  out.append(" visual_max_temperature: ");
3816  sprintf(buffer, "%g", this->visual_max_temperature);
3817  out.append(buffer);
3818  out.append("\n");
3819 
3820  out.append(" visual_target_temperature_step: ");
3821  sprintf(buffer, "%g", this->visual_target_temperature_step);
3822  out.append(buffer);
3823  out.append("\n");
3824 
3825  out.append(" legacy_supports_away: ");
3826  out.append(YESNO(this->legacy_supports_away));
3827  out.append("\n");
3828 
3829  out.append(" supports_action: ");
3830  out.append(YESNO(this->supports_action));
3831  out.append("\n");
3832 
3833  for (const auto &it : this->supported_fan_modes) {
3834  out.append(" supported_fan_modes: ");
3835  out.append(proto_enum_to_string<enums::ClimateFanMode>(it));
3836  out.append("\n");
3837  }
3838 
3839  for (const auto &it : this->supported_swing_modes) {
3840  out.append(" supported_swing_modes: ");
3841  out.append(proto_enum_to_string<enums::ClimateSwingMode>(it));
3842  out.append("\n");
3843  }
3844 
3845  for (const auto &it : this->supported_custom_fan_modes) {
3846  out.append(" supported_custom_fan_modes: ");
3847  out.append("'").append(it).append("'");
3848  out.append("\n");
3849  }
3850 
3851  for (const auto &it : this->supported_presets) {
3852  out.append(" supported_presets: ");
3853  out.append(proto_enum_to_string<enums::ClimatePreset>(it));
3854  out.append("\n");
3855  }
3856 
3857  for (const auto &it : this->supported_custom_presets) {
3858  out.append(" supported_custom_presets: ");
3859  out.append("'").append(it).append("'");
3860  out.append("\n");
3861  }
3862 
3863  out.append(" disabled_by_default: ");
3864  out.append(YESNO(this->disabled_by_default));
3865  out.append("\n");
3866 
3867  out.append(" icon: ");
3868  out.append("'").append(this->icon).append("'");
3869  out.append("\n");
3870 
3871  out.append(" entity_category: ");
3872  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3873  out.append("\n");
3874 
3875  out.append(" visual_current_temperature_step: ");
3876  sprintf(buffer, "%g", this->visual_current_temperature_step);
3877  out.append(buffer);
3878  out.append("\n");
3879 
3880  out.append(" supports_current_humidity: ");
3881  out.append(YESNO(this->supports_current_humidity));
3882  out.append("\n");
3883 
3884  out.append(" supports_target_humidity: ");
3885  out.append(YESNO(this->supports_target_humidity));
3886  out.append("\n");
3887 
3888  out.append(" visual_min_humidity: ");
3889  sprintf(buffer, "%g", this->visual_min_humidity);
3890  out.append(buffer);
3891  out.append("\n");
3892 
3893  out.append(" visual_max_humidity: ");
3894  sprintf(buffer, "%g", this->visual_max_humidity);
3895  out.append(buffer);
3896  out.append("\n");
3897  out.append("}");
3898 }
3899 #endif
3900 bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3901  switch (field_id) {
3902  case 2: {
3903  this->mode = value.as_enum<enums::ClimateMode>();
3904  return true;
3905  }
3906  case 7: {
3907  this->unused_legacy_away = value.as_bool();
3908  return true;
3909  }
3910  case 8: {
3911  this->action = value.as_enum<enums::ClimateAction>();
3912  return true;
3913  }
3914  case 9: {
3915  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3916  return true;
3917  }
3918  case 10: {
3919  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3920  return true;
3921  }
3922  case 12: {
3923  this->preset = value.as_enum<enums::ClimatePreset>();
3924  return true;
3925  }
3926  default:
3927  return false;
3928  }
3929 }
3931  switch (field_id) {
3932  case 11: {
3933  this->custom_fan_mode = value.as_string();
3934  return true;
3935  }
3936  case 13: {
3937  this->custom_preset = value.as_string();
3938  return true;
3939  }
3940  default:
3941  return false;
3942  }
3943 }
3944 bool ClimateStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3945  switch (field_id) {
3946  case 1: {
3947  this->key = value.as_fixed32();
3948  return true;
3949  }
3950  case 3: {
3951  this->current_temperature = value.as_float();
3952  return true;
3953  }
3954  case 4: {
3955  this->target_temperature = value.as_float();
3956  return true;
3957  }
3958  case 5: {
3959  this->target_temperature_low = value.as_float();
3960  return true;
3961  }
3962  case 6: {
3963  this->target_temperature_high = value.as_float();
3964  return true;
3965  }
3966  case 14: {
3967  this->current_humidity = value.as_float();
3968  return true;
3969  }
3970  case 15: {
3971  this->target_humidity = value.as_float();
3972  return true;
3973  }
3974  default:
3975  return false;
3976  }
3977 }
3979  buffer.encode_fixed32(1, this->key);
3980  buffer.encode_enum<enums::ClimateMode>(2, this->mode);
3981  buffer.encode_float(3, this->current_temperature);
3982  buffer.encode_float(4, this->target_temperature);
3983  buffer.encode_float(5, this->target_temperature_low);
3984  buffer.encode_float(6, this->target_temperature_high);
3985  buffer.encode_bool(7, this->unused_legacy_away);
3986  buffer.encode_enum<enums::ClimateAction>(8, this->action);
3987  buffer.encode_enum<enums::ClimateFanMode>(9, this->fan_mode);
3988  buffer.encode_enum<enums::ClimateSwingMode>(10, this->swing_mode);
3989  buffer.encode_string(11, this->custom_fan_mode);
3990  buffer.encode_enum<enums::ClimatePreset>(12, this->preset);
3991  buffer.encode_string(13, this->custom_preset);
3992  buffer.encode_float(14, this->current_humidity);
3993  buffer.encode_float(15, this->target_humidity);
3994 }
3995 #ifdef HAS_PROTO_MESSAGE_DUMP
3996 void ClimateStateResponse::dump_to(std::string &out) const {
3997  __attribute__((unused)) char buffer[64];
3998  out.append("ClimateStateResponse {\n");
3999  out.append(" key: ");
4000  sprintf(buffer, "%" PRIu32, this->key);
4001  out.append(buffer);
4002  out.append("\n");
4003 
4004  out.append(" mode: ");
4005  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
4006  out.append("\n");
4007 
4008  out.append(" current_temperature: ");
4009  sprintf(buffer, "%g", this->current_temperature);
4010  out.append(buffer);
4011  out.append("\n");
4012 
4013  out.append(" target_temperature: ");
4014  sprintf(buffer, "%g", this->target_temperature);
4015  out.append(buffer);
4016  out.append("\n");
4017 
4018  out.append(" target_temperature_low: ");
4019  sprintf(buffer, "%g", this->target_temperature_low);
4020  out.append(buffer);
4021  out.append("\n");
4022 
4023  out.append(" target_temperature_high: ");
4024  sprintf(buffer, "%g", this->target_temperature_high);
4025  out.append(buffer);
4026  out.append("\n");
4027 
4028  out.append(" unused_legacy_away: ");
4029  out.append(YESNO(this->unused_legacy_away));
4030  out.append("\n");
4031 
4032  out.append(" action: ");
4033  out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
4034  out.append("\n");
4035 
4036  out.append(" fan_mode: ");
4037  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
4038  out.append("\n");
4039 
4040  out.append(" swing_mode: ");
4041  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
4042  out.append("\n");
4043 
4044  out.append(" custom_fan_mode: ");
4045  out.append("'").append(this->custom_fan_mode).append("'");
4046  out.append("\n");
4047 
4048  out.append(" preset: ");
4049  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
4050  out.append("\n");
4051 
4052  out.append(" custom_preset: ");
4053  out.append("'").append(this->custom_preset).append("'");
4054  out.append("\n");
4055 
4056  out.append(" current_humidity: ");
4057  sprintf(buffer, "%g", this->current_humidity);
4058  out.append(buffer);
4059  out.append("\n");
4060 
4061  out.append(" target_humidity: ");
4062  sprintf(buffer, "%g", this->target_humidity);
4063  out.append(buffer);
4064  out.append("\n");
4065  out.append("}");
4066 }
4067 #endif
4068 bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4069  switch (field_id) {
4070  case 2: {
4071  this->has_mode = value.as_bool();
4072  return true;
4073  }
4074  case 3: {
4075  this->mode = value.as_enum<enums::ClimateMode>();
4076  return true;
4077  }
4078  case 4: {
4079  this->has_target_temperature = value.as_bool();
4080  return true;
4081  }
4082  case 6: {
4083  this->has_target_temperature_low = value.as_bool();
4084  return true;
4085  }
4086  case 8: {
4087  this->has_target_temperature_high = value.as_bool();
4088  return true;
4089  }
4090  case 10: {
4091  this->unused_has_legacy_away = value.as_bool();
4092  return true;
4093  }
4094  case 11: {
4095  this->unused_legacy_away = value.as_bool();
4096  return true;
4097  }
4098  case 12: {
4099  this->has_fan_mode = value.as_bool();
4100  return true;
4101  }
4102  case 13: {
4103  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
4104  return true;
4105  }
4106  case 14: {
4107  this->has_swing_mode = value.as_bool();
4108  return true;
4109  }
4110  case 15: {
4111  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
4112  return true;
4113  }
4114  case 16: {
4115  this->has_custom_fan_mode = value.as_bool();
4116  return true;
4117  }
4118  case 18: {
4119  this->has_preset = value.as_bool();
4120  return true;
4121  }
4122  case 19: {
4123  this->preset = value.as_enum<enums::ClimatePreset>();
4124  return true;
4125  }
4126  case 20: {
4127  this->has_custom_preset = value.as_bool();
4128  return true;
4129  }
4130  case 22: {
4131  this->has_target_humidity = value.as_bool();
4132  return true;
4133  }
4134  default:
4135  return false;
4136  }
4137 }
4139  switch (field_id) {
4140  case 17: {
4141  this->custom_fan_mode = value.as_string();
4142  return true;
4143  }
4144  case 21: {
4145  this->custom_preset = value.as_string();
4146  return true;
4147  }
4148  default:
4149  return false;
4150  }
4151 }
4152 bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4153  switch (field_id) {
4154  case 1: {
4155  this->key = value.as_fixed32();
4156  return true;
4157  }
4158  case 5: {
4159  this->target_temperature = value.as_float();
4160  return true;
4161  }
4162  case 7: {
4163  this->target_temperature_low = value.as_float();
4164  return true;
4165  }
4166  case 9: {
4167  this->target_temperature_high = value.as_float();
4168  return true;
4169  }
4170  case 23: {
4171  this->target_humidity = value.as_float();
4172  return true;
4173  }
4174  default:
4175  return false;
4176  }
4177 }
4179  buffer.encode_fixed32(1, this->key);
4180  buffer.encode_bool(2, this->has_mode);
4181  buffer.encode_enum<enums::ClimateMode>(3, this->mode);
4182  buffer.encode_bool(4, this->has_target_temperature);
4183  buffer.encode_float(5, this->target_temperature);
4184  buffer.encode_bool(6, this->has_target_temperature_low);
4185  buffer.encode_float(7, this->target_temperature_low);
4186  buffer.encode_bool(8, this->has_target_temperature_high);
4187  buffer.encode_float(9, this->target_temperature_high);
4188  buffer.encode_bool(10, this->unused_has_legacy_away);
4189  buffer.encode_bool(11, this->unused_legacy_away);
4190  buffer.encode_bool(12, this->has_fan_mode);
4191  buffer.encode_enum<enums::ClimateFanMode>(13, this->fan_mode);
4192  buffer.encode_bool(14, this->has_swing_mode);
4193  buffer.encode_enum<enums::ClimateSwingMode>(15, this->swing_mode);
4194  buffer.encode_bool(16, this->has_custom_fan_mode);
4195  buffer.encode_string(17, this->custom_fan_mode);
4196  buffer.encode_bool(18, this->has_preset);
4197  buffer.encode_enum<enums::ClimatePreset>(19, this->preset);
4198  buffer.encode_bool(20, this->has_custom_preset);
4199  buffer.encode_string(21, this->custom_preset);
4200  buffer.encode_bool(22, this->has_target_humidity);
4201  buffer.encode_float(23, this->target_humidity);
4202 }
4203 #ifdef HAS_PROTO_MESSAGE_DUMP
4204 void ClimateCommandRequest::dump_to(std::string &out) const {
4205  __attribute__((unused)) char buffer[64];
4206  out.append("ClimateCommandRequest {\n");
4207  out.append(" key: ");
4208  sprintf(buffer, "%" PRIu32, this->key);
4209  out.append(buffer);
4210  out.append("\n");
4211 
4212  out.append(" has_mode: ");
4213  out.append(YESNO(this->has_mode));
4214  out.append("\n");
4215 
4216  out.append(" mode: ");
4217  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
4218  out.append("\n");
4219 
4220  out.append(" has_target_temperature: ");
4221  out.append(YESNO(this->has_target_temperature));
4222  out.append("\n");
4223 
4224  out.append(" target_temperature: ");
4225  sprintf(buffer, "%g", this->target_temperature);
4226  out.append(buffer);
4227  out.append("\n");
4228 
4229  out.append(" has_target_temperature_low: ");
4230  out.append(YESNO(this->has_target_temperature_low));
4231  out.append("\n");
4232 
4233  out.append(" target_temperature_low: ");
4234  sprintf(buffer, "%g", this->target_temperature_low);
4235  out.append(buffer);
4236  out.append("\n");
4237 
4238  out.append(" has_target_temperature_high: ");
4239  out.append(YESNO(this->has_target_temperature_high));
4240  out.append("\n");
4241 
4242  out.append(" target_temperature_high: ");
4243  sprintf(buffer, "%g", this->target_temperature_high);
4244  out.append(buffer);
4245  out.append("\n");
4246 
4247  out.append(" unused_has_legacy_away: ");
4248  out.append(YESNO(this->unused_has_legacy_away));
4249  out.append("\n");
4250 
4251  out.append(" unused_legacy_away: ");
4252  out.append(YESNO(this->unused_legacy_away));
4253  out.append("\n");
4254 
4255  out.append(" has_fan_mode: ");
4256  out.append(YESNO(this->has_fan_mode));
4257  out.append("\n");
4258 
4259  out.append(" fan_mode: ");
4260  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
4261  out.append("\n");
4262 
4263  out.append(" has_swing_mode: ");
4264  out.append(YESNO(this->has_swing_mode));
4265  out.append("\n");
4266 
4267  out.append(" swing_mode: ");
4268  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
4269  out.append("\n");
4270 
4271  out.append(" has_custom_fan_mode: ");
4272  out.append(YESNO(this->has_custom_fan_mode));
4273  out.append("\n");
4274 
4275  out.append(" custom_fan_mode: ");
4276  out.append("'").append(this->custom_fan_mode).append("'");
4277  out.append("\n");
4278 
4279  out.append(" has_preset: ");
4280  out.append(YESNO(this->has_preset));
4281  out.append("\n");
4282 
4283  out.append(" preset: ");
4284  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
4285  out.append("\n");
4286 
4287  out.append(" has_custom_preset: ");
4288  out.append(YESNO(this->has_custom_preset));
4289  out.append("\n");
4290 
4291  out.append(" custom_preset: ");
4292  out.append("'").append(this->custom_preset).append("'");
4293  out.append("\n");
4294 
4295  out.append(" has_target_humidity: ");
4296  out.append(YESNO(this->has_target_humidity));
4297  out.append("\n");
4298 
4299  out.append(" target_humidity: ");
4300  sprintf(buffer, "%g", this->target_humidity);
4301  out.append(buffer);
4302  out.append("\n");
4303  out.append("}");
4304 }
4305 #endif
4307  switch (field_id) {
4308  case 9: {
4309  this->disabled_by_default = value.as_bool();
4310  return true;
4311  }
4312  case 10: {
4313  this->entity_category = value.as_enum<enums::EntityCategory>();
4314  return true;
4315  }
4316  case 12: {
4317  this->mode = value.as_enum<enums::NumberMode>();
4318  return true;
4319  }
4320  default:
4321  return false;
4322  }
4323 }
4325  switch (field_id) {
4326  case 1: {
4327  this->object_id = value.as_string();
4328  return true;
4329  }
4330  case 3: {
4331  this->name = value.as_string();
4332  return true;
4333  }
4334  case 4: {
4335  this->unique_id = value.as_string();
4336  return true;
4337  }
4338  case 5: {
4339  this->icon = value.as_string();
4340  return true;
4341  }
4342  case 11: {
4343  this->unit_of_measurement = value.as_string();
4344  return true;
4345  }
4346  case 13: {
4347  this->device_class = value.as_string();
4348  return true;
4349  }
4350  default:
4351  return false;
4352  }
4353 }
4355  switch (field_id) {
4356  case 2: {
4357  this->key = value.as_fixed32();
4358  return true;
4359  }
4360  case 6: {
4361  this->min_value = value.as_float();
4362  return true;
4363  }
4364  case 7: {
4365  this->max_value = value.as_float();
4366  return true;
4367  }
4368  case 8: {
4369  this->step = value.as_float();
4370  return true;
4371  }
4372  default:
4373  return false;
4374  }
4375 }
4377  buffer.encode_string(1, this->object_id);
4378  buffer.encode_fixed32(2, this->key);
4379  buffer.encode_string(3, this->name);
4380  buffer.encode_string(4, this->unique_id);
4381  buffer.encode_string(5, this->icon);
4382  buffer.encode_float(6, this->min_value);
4383  buffer.encode_float(7, this->max_value);
4384  buffer.encode_float(8, this->step);
4385  buffer.encode_bool(9, this->disabled_by_default);
4386  buffer.encode_enum<enums::EntityCategory>(10, this->entity_category);
4387  buffer.encode_string(11, this->unit_of_measurement);
4388  buffer.encode_enum<enums::NumberMode>(12, this->mode);
4389  buffer.encode_string(13, this->device_class);
4390 }
4391 #ifdef HAS_PROTO_MESSAGE_DUMP
4392 void ListEntitiesNumberResponse::dump_to(std::string &out) const {
4393  __attribute__((unused)) char buffer[64];
4394  out.append("ListEntitiesNumberResponse {\n");
4395  out.append(" object_id: ");
4396  out.append("'").append(this->object_id).append("'");
4397  out.append("\n");
4398 
4399  out.append(" key: ");
4400  sprintf(buffer, "%" PRIu32, this->key);
4401  out.append(buffer);
4402  out.append("\n");
4403 
4404  out.append(" name: ");
4405  out.append("'").append(this->name).append("'");
4406  out.append("\n");
4407 
4408  out.append(" unique_id: ");
4409  out.append("'").append(this->unique_id).append("'");
4410  out.append("\n");
4411 
4412  out.append(" icon: ");
4413  out.append("'").append(this->icon).append("'");
4414  out.append("\n");
4415 
4416  out.append(" min_value: ");
4417  sprintf(buffer, "%g", this->min_value);
4418  out.append(buffer);
4419  out.append("\n");
4420 
4421  out.append(" max_value: ");
4422  sprintf(buffer, "%g", this->max_value);
4423  out.append(buffer);
4424  out.append("\n");
4425 
4426  out.append(" step: ");
4427  sprintf(buffer, "%g", this->step);
4428  out.append(buffer);
4429  out.append("\n");
4430 
4431  out.append(" disabled_by_default: ");
4432  out.append(YESNO(this->disabled_by_default));
4433  out.append("\n");
4434 
4435  out.append(" entity_category: ");
4436  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4437  out.append("\n");
4438 
4439  out.append(" unit_of_measurement: ");
4440  out.append("'").append(this->unit_of_measurement).append("'");
4441  out.append("\n");
4442 
4443  out.append(" mode: ");
4444  out.append(proto_enum_to_string<enums::NumberMode>(this->mode));
4445  out.append("\n");
4446 
4447  out.append(" device_class: ");
4448  out.append("'").append(this->device_class).append("'");
4449  out.append("\n");
4450  out.append("}");
4451 }
4452 #endif
4453 bool NumberStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4454  switch (field_id) {
4455  case 3: {
4456  this->missing_state = value.as_bool();
4457  return true;
4458  }
4459  default:
4460  return false;
4461  }
4462 }
4463 bool NumberStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4464  switch (field_id) {
4465  case 1: {
4466  this->key = value.as_fixed32();
4467  return true;
4468  }
4469  case 2: {
4470  this->state = value.as_float();
4471  return true;
4472  }
4473  default:
4474  return false;
4475  }
4476 }
4478  buffer.encode_fixed32(1, this->key);
4479  buffer.encode_float(2, this->state);
4480  buffer.encode_bool(3, this->missing_state);
4481 }
4482 #ifdef HAS_PROTO_MESSAGE_DUMP
4483 void NumberStateResponse::dump_to(std::string &out) const {
4484  __attribute__((unused)) char buffer[64];
4485  out.append("NumberStateResponse {\n");
4486  out.append(" key: ");
4487  sprintf(buffer, "%" PRIu32, this->key);
4488  out.append(buffer);
4489  out.append("\n");
4490 
4491  out.append(" state: ");
4492  sprintf(buffer, "%g", this->state);
4493  out.append(buffer);
4494  out.append("\n");
4495 
4496  out.append(" missing_state: ");
4497  out.append(YESNO(this->missing_state));
4498  out.append("\n");
4499  out.append("}");
4500 }
4501 #endif
4502 bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4503  switch (field_id) {
4504  case 1: {
4505  this->key = value.as_fixed32();
4506  return true;
4507  }
4508  case 2: {
4509  this->state = value.as_float();
4510  return true;
4511  }
4512  default:
4513  return false;
4514  }
4515 }
4517  buffer.encode_fixed32(1, this->key);
4518  buffer.encode_float(2, this->state);
4519 }
4520 #ifdef HAS_PROTO_MESSAGE_DUMP
4521 void NumberCommandRequest::dump_to(std::string &out) const {
4522  __attribute__((unused)) char buffer[64];
4523  out.append("NumberCommandRequest {\n");
4524  out.append(" key: ");
4525  sprintf(buffer, "%" PRIu32, this->key);
4526  out.append(buffer);
4527  out.append("\n");
4528 
4529  out.append(" state: ");
4530  sprintf(buffer, "%g", this->state);
4531  out.append(buffer);
4532  out.append("\n");
4533  out.append("}");
4534 }
4535 #endif
4537  switch (field_id) {
4538  case 7: {
4539  this->disabled_by_default = value.as_bool();
4540  return true;
4541  }
4542  case 8: {
4543  this->entity_category = value.as_enum<enums::EntityCategory>();
4544  return true;
4545  }
4546  default:
4547  return false;
4548  }
4549 }
4551  switch (field_id) {
4552  case 1: {
4553  this->object_id = value.as_string();
4554  return true;
4555  }
4556  case 3: {
4557  this->name = value.as_string();
4558  return true;
4559  }
4560  case 4: {
4561  this->unique_id = value.as_string();
4562  return true;
4563  }
4564  case 5: {
4565  this->icon = value.as_string();
4566  return true;
4567  }
4568  case 6: {
4569  this->options.push_back(value.as_string());
4570  return true;
4571  }
4572  default:
4573  return false;
4574  }
4575 }
4577  switch (field_id) {
4578  case 2: {
4579  this->key = value.as_fixed32();
4580  return true;
4581  }
4582  default:
4583  return false;
4584  }
4585 }
4587  buffer.encode_string(1, this->object_id);
4588  buffer.encode_fixed32(2, this->key);
4589  buffer.encode_string(3, this->name);
4590  buffer.encode_string(4, this->unique_id);
4591  buffer.encode_string(5, this->icon);
4592  for (auto &it : this->options) {
4593  buffer.encode_string(6, it, true);
4594  }
4595  buffer.encode_bool(7, this->disabled_by_default);
4596  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
4597 }
4598 #ifdef HAS_PROTO_MESSAGE_DUMP
4599 void ListEntitiesSelectResponse::dump_to(std::string &out) const {
4600  __attribute__((unused)) char buffer[64];
4601  out.append("ListEntitiesSelectResponse {\n");
4602  out.append(" object_id: ");
4603  out.append("'").append(this->object_id).append("'");
4604  out.append("\n");
4605 
4606  out.append(" key: ");
4607  sprintf(buffer, "%" PRIu32, this->key);
4608  out.append(buffer);
4609  out.append("\n");
4610 
4611  out.append(" name: ");
4612  out.append("'").append(this->name).append("'");
4613  out.append("\n");
4614 
4615  out.append(" unique_id: ");
4616  out.append("'").append(this->unique_id).append("'");
4617  out.append("\n");
4618 
4619  out.append(" icon: ");
4620  out.append("'").append(this->icon).append("'");
4621  out.append("\n");
4622 
4623  for (const auto &it : this->options) {
4624  out.append(" options: ");
4625  out.append("'").append(it).append("'");
4626  out.append("\n");
4627  }
4628 
4629  out.append(" disabled_by_default: ");
4630  out.append(YESNO(this->disabled_by_default));
4631  out.append("\n");
4632 
4633  out.append(" entity_category: ");
4634  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4635  out.append("\n");
4636  out.append("}");
4637 }
4638 #endif
4639 bool SelectStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4640  switch (field_id) {
4641  case 3: {
4642  this->missing_state = value.as_bool();
4643  return true;
4644  }
4645  default:
4646  return false;
4647  }
4648 }
4650  switch (field_id) {
4651  case 2: {
4652  this->state = value.as_string();
4653  return true;
4654  }
4655  default:
4656  return false;
4657  }
4658 }
4659 bool SelectStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4660  switch (field_id) {
4661  case 1: {
4662  this->key = value.as_fixed32();
4663  return true;
4664  }
4665  default:
4666  return false;
4667  }
4668 }
4670  buffer.encode_fixed32(1, this->key);
4671  buffer.encode_string(2, this->state);
4672  buffer.encode_bool(3, this->missing_state);
4673 }
4674 #ifdef HAS_PROTO_MESSAGE_DUMP
4675 void SelectStateResponse::dump_to(std::string &out) const {
4676  __attribute__((unused)) char buffer[64];
4677  out.append("SelectStateResponse {\n");
4678  out.append(" key: ");
4679  sprintf(buffer, "%" PRIu32, this->key);
4680  out.append(buffer);
4681  out.append("\n");
4682 
4683  out.append(" state: ");
4684  out.append("'").append(this->state).append("'");
4685  out.append("\n");
4686 
4687  out.append(" missing_state: ");
4688  out.append(YESNO(this->missing_state));
4689  out.append("\n");
4690  out.append("}");
4691 }
4692 #endif
4694  switch (field_id) {
4695  case 2: {
4696  this->state = value.as_string();
4697  return true;
4698  }
4699  default:
4700  return false;
4701  }
4702 }
4703 bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4704  switch (field_id) {
4705  case 1: {
4706  this->key = value.as_fixed32();
4707  return true;
4708  }
4709  default:
4710  return false;
4711  }
4712 }
4714  buffer.encode_fixed32(1, this->key);
4715  buffer.encode_string(2, this->state);
4716 }
4717 #ifdef HAS_PROTO_MESSAGE_DUMP
4718 void SelectCommandRequest::dump_to(std::string &out) const {
4719  __attribute__((unused)) char buffer[64];
4720  out.append("SelectCommandRequest {\n");
4721  out.append(" key: ");
4722  sprintf(buffer, "%" PRIu32, this->key);
4723  out.append(buffer);
4724  out.append("\n");
4725 
4726  out.append(" state: ");
4727  out.append("'").append(this->state).append("'");
4728  out.append("\n");
4729  out.append("}");
4730 }
4731 #endif
4733  switch (field_id) {
4734  case 6: {
4735  this->disabled_by_default = value.as_bool();
4736  return true;
4737  }
4738  case 7: {
4739  this->entity_category = value.as_enum<enums::EntityCategory>();
4740  return true;
4741  }
4742  case 8: {
4743  this->assumed_state = value.as_bool();
4744  return true;
4745  }
4746  case 9: {
4747  this->supports_open = value.as_bool();
4748  return true;
4749  }
4750  case 10: {
4751  this->requires_code = value.as_bool();
4752  return true;
4753  }
4754  default:
4755  return false;
4756  }
4757 }
4759  switch (field_id) {
4760  case 1: {
4761  this->object_id = value.as_string();
4762  return true;
4763  }
4764  case 3: {
4765  this->name = value.as_string();
4766  return true;
4767  }
4768  case 4: {
4769  this->unique_id = value.as_string();
4770  return true;
4771  }
4772  case 5: {
4773  this->icon = value.as_string();
4774  return true;
4775  }
4776  case 11: {
4777  this->code_format = value.as_string();
4778  return true;
4779  }
4780  default:
4781  return false;
4782  }
4783 }
4784 bool ListEntitiesLockResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4785  switch (field_id) {
4786  case 2: {
4787  this->key = value.as_fixed32();
4788  return true;
4789  }
4790  default:
4791  return false;
4792  }
4793 }
4795  buffer.encode_string(1, this->object_id);
4796  buffer.encode_fixed32(2, this->key);
4797  buffer.encode_string(3, this->name);
4798  buffer.encode_string(4, this->unique_id);
4799  buffer.encode_string(5, this->icon);
4800  buffer.encode_bool(6, this->disabled_by_default);
4801  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4802  buffer.encode_bool(8, this->assumed_state);
4803  buffer.encode_bool(9, this->supports_open);
4804  buffer.encode_bool(10, this->requires_code);
4805  buffer.encode_string(11, this->code_format);
4806 }
4807 #ifdef HAS_PROTO_MESSAGE_DUMP
4808 void ListEntitiesLockResponse::dump_to(std::string &out) const {
4809  __attribute__((unused)) char buffer[64];
4810  out.append("ListEntitiesLockResponse {\n");
4811  out.append(" object_id: ");
4812  out.append("'").append(this->object_id).append("'");
4813  out.append("\n");
4814 
4815  out.append(" key: ");
4816  sprintf(buffer, "%" PRIu32, this->key);
4817  out.append(buffer);
4818  out.append("\n");
4819 
4820  out.append(" name: ");
4821  out.append("'").append(this->name).append("'");
4822  out.append("\n");
4823 
4824  out.append(" unique_id: ");
4825  out.append("'").append(this->unique_id).append("'");
4826  out.append("\n");
4827 
4828  out.append(" icon: ");
4829  out.append("'").append(this->icon).append("'");
4830  out.append("\n");
4831 
4832  out.append(" disabled_by_default: ");
4833  out.append(YESNO(this->disabled_by_default));
4834  out.append("\n");
4835 
4836  out.append(" entity_category: ");
4837  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4838  out.append("\n");
4839 
4840  out.append(" assumed_state: ");
4841  out.append(YESNO(this->assumed_state));
4842  out.append("\n");
4843 
4844  out.append(" supports_open: ");
4845  out.append(YESNO(this->supports_open));
4846  out.append("\n");
4847 
4848  out.append(" requires_code: ");
4849  out.append(YESNO(this->requires_code));
4850  out.append("\n");
4851 
4852  out.append(" code_format: ");
4853  out.append("'").append(this->code_format).append("'");
4854  out.append("\n");
4855  out.append("}");
4856 }
4857 #endif
4858 bool LockStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4859  switch (field_id) {
4860  case 2: {
4861  this->state = value.as_enum<enums::LockState>();
4862  return true;
4863  }
4864  default:
4865  return false;
4866  }
4867 }
4868 bool LockStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4869  switch (field_id) {
4870  case 1: {
4871  this->key = value.as_fixed32();
4872  return true;
4873  }
4874  default:
4875  return false;
4876  }
4877 }
4879  buffer.encode_fixed32(1, this->key);
4880  buffer.encode_enum<enums::LockState>(2, this->state);
4881 }
4882 #ifdef HAS_PROTO_MESSAGE_DUMP
4883 void LockStateResponse::dump_to(std::string &out) const {
4884  __attribute__((unused)) char buffer[64];
4885  out.append("LockStateResponse {\n");
4886  out.append(" key: ");
4887  sprintf(buffer, "%" PRIu32, this->key);
4888  out.append(buffer);
4889  out.append("\n");
4890 
4891  out.append(" state: ");
4892  out.append(proto_enum_to_string<enums::LockState>(this->state));
4893  out.append("\n");
4894  out.append("}");
4895 }
4896 #endif
4897 bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4898  switch (field_id) {
4899  case 2: {
4900  this->command = value.as_enum<enums::LockCommand>();
4901  return true;
4902  }
4903  case 3: {
4904  this->has_code = value.as_bool();
4905  return true;
4906  }
4907  default:
4908  return false;
4909  }
4910 }
4912  switch (field_id) {
4913  case 4: {
4914  this->code = value.as_string();
4915  return true;
4916  }
4917  default:
4918  return false;
4919  }
4920 }
4921 bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4922  switch (field_id) {
4923  case 1: {
4924  this->key = value.as_fixed32();
4925  return true;
4926  }
4927  default:
4928  return false;
4929  }
4930 }
4932  buffer.encode_fixed32(1, this->key);
4933  buffer.encode_enum<enums::LockCommand>(2, this->command);
4934  buffer.encode_bool(3, this->has_code);
4935  buffer.encode_string(4, this->code);
4936 }
4937 #ifdef HAS_PROTO_MESSAGE_DUMP
4938 void LockCommandRequest::dump_to(std::string &out) const {
4939  __attribute__((unused)) char buffer[64];
4940  out.append("LockCommandRequest {\n");
4941  out.append(" key: ");
4942  sprintf(buffer, "%" PRIu32, this->key);
4943  out.append(buffer);
4944  out.append("\n");
4945 
4946  out.append(" command: ");
4947  out.append(proto_enum_to_string<enums::LockCommand>(this->command));
4948  out.append("\n");
4949 
4950  out.append(" has_code: ");
4951  out.append(YESNO(this->has_code));
4952  out.append("\n");
4953 
4954  out.append(" code: ");
4955  out.append("'").append(this->code).append("'");
4956  out.append("\n");
4957  out.append("}");
4958 }
4959 #endif
4961  switch (field_id) {
4962  case 6: {
4963  this->disabled_by_default = value.as_bool();
4964  return true;
4965  }
4966  case 7: {
4967  this->entity_category = value.as_enum<enums::EntityCategory>();
4968  return true;
4969  }
4970  default:
4971  return false;
4972  }
4973 }
4975  switch (field_id) {
4976  case 1: {
4977  this->object_id = value.as_string();
4978  return true;
4979  }
4980  case 3: {
4981  this->name = value.as_string();
4982  return true;
4983  }
4984  case 4: {
4985  this->unique_id = value.as_string();
4986  return true;
4987  }
4988  case 5: {
4989  this->icon = value.as_string();
4990  return true;
4991  }
4992  case 8: {
4993  this->device_class = value.as_string();
4994  return true;
4995  }
4996  default:
4997  return false;
4998  }
4999 }
5001  switch (field_id) {
5002  case 2: {
5003  this->key = value.as_fixed32();
5004  return true;
5005  }
5006  default:
5007  return false;
5008  }
5009 }
5011  buffer.encode_string(1, this->object_id);
5012  buffer.encode_fixed32(2, this->key);
5013  buffer.encode_string(3, this->name);
5014  buffer.encode_string(4, this->unique_id);
5015  buffer.encode_string(5, this->icon);
5016  buffer.encode_bool(6, this->disabled_by_default);
5017  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
5018  buffer.encode_string(8, this->device_class);
5019 }
5020 #ifdef HAS_PROTO_MESSAGE_DUMP
5021 void ListEntitiesButtonResponse::dump_to(std::string &out) const {
5022  __attribute__((unused)) char buffer[64];
5023  out.append("ListEntitiesButtonResponse {\n");
5024  out.append(" object_id: ");
5025  out.append("'").append(this->object_id).append("'");
5026  out.append("\n");
5027 
5028  out.append(" key: ");
5029  sprintf(buffer, "%" PRIu32, this->key);
5030  out.append(buffer);
5031  out.append("\n");
5032 
5033  out.append(" name: ");
5034  out.append("'").append(this->name).append("'");
5035  out.append("\n");
5036 
5037  out.append(" unique_id: ");
5038  out.append("'").append(this->unique_id).append("'");
5039  out.append("\n");
5040 
5041  out.append(" icon: ");
5042  out.append("'").append(this->icon).append("'");
5043  out.append("\n");
5044 
5045  out.append(" disabled_by_default: ");
5046  out.append(YESNO(this->disabled_by_default));
5047  out.append("\n");
5048 
5049  out.append(" entity_category: ");
5050  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
5051  out.append("\n");
5052 
5053  out.append(" device_class: ");
5054  out.append("'").append(this->device_class).append("'");
5055  out.append("\n");
5056  out.append("}");
5057 }
5058 #endif
5059 bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
5060  switch (field_id) {
5061  case 1: {
5062  this->key = value.as_fixed32();
5063  return true;
5064  }
5065  default:
5066  return false;
5067  }
5068 }
5069 void ButtonCommandRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->key); }
5070 #ifdef HAS_PROTO_MESSAGE_DUMP
5071 void ButtonCommandRequest::dump_to(std::string &out) const {
5072  __attribute__((unused)) char buffer[64];
5073  out.append("ButtonCommandRequest {\n");
5074  out.append(" key: ");
5075  sprintf(buffer, "%" PRIu32, this->key);
5076  out.append(buffer);
5077  out.append("\n");
5078  out.append("}");
5079 }
5080 #endif
5082  switch (field_id) {
5083  case 6: {
5084  this->disabled_by_default = value.as_bool();
5085  return true;
5086  }
5087  case 7: {
5088  this->entity_category = value.as_enum<enums::EntityCategory>();
5089  return true;
5090  }
5091  case 8: {
5092  this->supports_pause = value.as_bool();
5093  return true;
5094  }
5095  default:
5096  return false;
5097  }
5098 }
5100  switch (field_id) {
5101  case 1: {
5102  this->object_id = value.as_string();
5103  return true;
5104  }
5105  case 3: {
5106  this->name = value.as_string();
5107  return true;
5108  }
5109  case 4: {
5110  this->unique_id = value.as_string();
5111  return true;
5112  }
5113  case 5: {
5114  this->icon = value.as_string();
5115  return true;
5116  }
5117  default:
5118  return false;
5119  }
5120 }
5122  switch (field_id) {
5123  case 2: {
5124  this->key = value.as_fixed32();
5125  return true;
5126  }
5127  default:
5128  return false;
5129  }
5130 }
5132  buffer.encode_string(1, this->object_id);
5133  buffer.encode_fixed32(2, this->key);
5134  buffer.encode_string(3, this->name);
5135  buffer.encode_string(4, this->unique_id);
5136  buffer.encode_string(5, this->icon);
5137  buffer.encode_bool(6, this->disabled_by_default);
5138  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
5139  buffer.encode_bool(8, this->supports_pause);
5140 }
5141 #ifdef HAS_PROTO_MESSAGE_DUMP
5142 void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
5143  __attribute__((unused)) char buffer[64];
5144  out.append("ListEntitiesMediaPlayerResponse {\n");
5145  out.append(" object_id: ");
5146  out.append("'").append(this->object_id).append("'");
5147  out.append("\n");
5148 
5149  out.append(" key: ");
5150  sprintf(buffer, "%" PRIu32, this->key);
5151  out.append(buffer);
5152  out.append("\n");
5153 
5154  out.append(" name: ");
5155  out.append("'").append(this->name).append("'");
5156  out.append("\n");
5157 
5158  out.append(" unique_id: ");
5159  out.append("'").append(this->unique_id).append("'");
5160  out.append("\n");
5161 
5162  out.append(" icon: ");
5163  out.append("'").append(this->icon).append("'");
5164  out.append("\n");
5165 
5166  out.append(" disabled_by_default: ");
5167  out.append(YESNO(this->disabled_by_default));
5168  out.append("\n");
5169 
5170  out.append(" entity_category: ");
5171  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
5172  out.append("\n");
5173 
5174  out.append(" supports_pause: ");
5175  out.append(YESNO(this->supports_pause));
5176  out.append("\n");
5177  out.append("}");
5178 }
5179 #endif
5181  switch (field_id) {
5182  case 2: {
5183  this->state = value.as_enum<enums::MediaPlayerState>();
5184  return true;
5185  }
5186  case 4: {
5187  this->muted = value.as_bool();
5188  return true;
5189  }
5190  default:
5191  return false;
5192  }
5193 }
5194 bool MediaPlayerStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
5195  switch (field_id) {
5196  case 1: {
5197  this->key = value.as_fixed32();
5198  return true;
5199  }
5200  case 3: {
5201  this->volume = value.as_float();
5202  return true;
5203  }
5204  default:
5205  return false;
5206  }
5207 }
5209  buffer.encode_fixed32(1, this->key);
5210  buffer.encode_enum<enums::MediaPlayerState>(2, this->state);
5211  buffer.encode_float(3, this->volume);
5212  buffer.encode_bool(4, this->muted);
5213 }
5214 #ifdef HAS_PROTO_MESSAGE_DUMP
5215 void MediaPlayerStateResponse::dump_to(std::string &out) const {
5216  __attribute__((unused)) char buffer[64];
5217  out.append("MediaPlayerStateResponse {\n");
5218  out.append(" key: ");
5219  sprintf(buffer, "%" PRIu32, this->key);
5220  out.append(buffer);
5221  out.append("\n");
5222 
5223  out.append(" state: ");
5224  out.append(proto_enum_to_string<enums::MediaPlayerState>(this->state));
5225  out.append("\n");
5226 
5227  out.append(" volume: ");
5228  sprintf(buffer, "%g", this->volume);
5229  out.append(buffer);
5230  out.append("\n");
5231 
5232  out.append(" muted: ");
5233  out.append(YESNO(this->muted));
5234  out.append("\n");
5235  out.append("}");
5236 }
5237 #endif
5239  switch (field_id) {
5240  case 2: {
5241  this->has_command = value.as_bool();
5242  return true;
5243  }
5244  case 3: {
5245  this->command = value.as_enum<enums::MediaPlayerCommand>();
5246  return true;
5247  }
5248  case 4: {
5249  this->has_volume = value.as_bool();
5250  return true;
5251  }
5252  case 6: {
5253  this->has_media_url = value.as_bool();
5254  return true;
5255  }
5256  case 8: {
5257  this->has_announcement = value.as_bool();
5258  return true;
5259  }
5260  case 9: {
5261  this->announcement = value.as_bool();
5262  return true;
5263  }
5264  default:
5265  return false;
5266  }
5267 }
5269  switch (field_id) {
5270  case 7: {
5271  this->media_url = value.as_string();
5272  return true;
5273  }
5274  default:
5275  return false;
5276  }
5277 }
5278 bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
5279  switch (field_id) {
5280  case 1: {
5281  this->key = value.as_fixed32();
5282  return true;
5283  }
5284  case 5: {
5285  this->volume = value.as_float();
5286  return true;
5287  }
5288  default:
5289  return false;
5290  }
5291 }
5293  buffer.encode_fixed32(1, this->key);
5294  buffer.encode_bool(2, this->has_command);
5295  buffer.encode_enum<enums::MediaPlayerCommand>(3, this->command);
5296  buffer.encode_bool(4, this->has_volume);
5297  buffer.encode_float(5, this->volume);
5298  buffer.encode_bool(6, this->has_media_url);
5299  buffer.encode_string(7, this->media_url);
5300  buffer.encode_bool(8, this->has_announcement);
5301  buffer.encode_bool(9, this->announcement);
5302 }
5303 #ifdef HAS_PROTO_MESSAGE_DUMP
5304 void MediaPlayerCommandRequest::dump_to(std::string &out) const {
5305  __attribute__((unused)) char buffer[64];
5306  out.append("MediaPlayerCommandRequest {\n");
5307  out.append(" key: ");
5308  sprintf(buffer, "%" PRIu32, this->key);
5309  out.append(buffer);
5310  out.append("\n");
5311 
5312  out.append(" has_command: ");
5313  out.append(YESNO(this->has_command));
5314  out.append("\n");
5315 
5316  out.append(" command: ");
5317  out.append(proto_enum_to_string<enums::MediaPlayerCommand>(this->command));
5318  out.append("\n");
5319 
5320  out.append(" has_volume: ");
5321  out.append(YESNO(this->has_volume));
5322  out.append("\n");
5323 
5324  out.append(" volume: ");
5325  sprintf(buffer, "%g", this->volume);
5326  out.append(buffer);
5327  out.append("\n");
5328 
5329  out.append(" has_media_url: ");
5330  out.append(YESNO(this->has_media_url));
5331  out.append("\n");
5332 
5333  out.append(" media_url: ");
5334  out.append("'").append(this->media_url).append("'");
5335  out.append("\n");
5336 
5337  out.append(" has_announcement: ");
5338  out.append(YESNO(this->has_announcement));
5339  out.append("\n");
5340 
5341  out.append(" announcement: ");
5342  out.append(YESNO(this->announcement));
5343  out.append("\n");
5344  out.append("}");
5345 }
5346 #endif
5348  switch (field_id) {
5349  case 1: {
5350  this->flags = value.as_uint32();
5351  return true;
5352  }
5353  default:
5354  return false;
5355  }
5356 }
5358  buffer.encode_uint32(1, this->flags);
5359 }
5360 #ifdef HAS_PROTO_MESSAGE_DUMP
5362  __attribute__((unused)) char buffer[64];
5363  out.append("SubscribeBluetoothLEAdvertisementsRequest {\n");
5364  out.append(" flags: ");
5365  sprintf(buffer, "%" PRIu32, this->flags);
5366  out.append(buffer);
5367  out.append("\n");
5368  out.append("}");
5369 }
5370 #endif
5371 bool BluetoothServiceData::decode_varint(uint32_t field_id, ProtoVarInt value) {
5372  switch (field_id) {
5373  case 2: {
5374  this->legacy_data.push_back(value.as_uint32());
5375  return true;
5376  }
5377  default:
5378  return false;
5379  }
5380 }
5382  switch (field_id) {
5383  case 1: {
5384  this->uuid = value.as_string();
5385  return true;
5386  }
5387  case 3: {
5388  this->data = value.as_string();
5389  return true;
5390  }
5391  default:
5392  return false;
5393  }
5394 }
5396  buffer.encode_string(1, this->uuid);
5397  for (auto &it : this->legacy_data) {
5398  buffer.encode_uint32(2, it, true);
5399  }
5400  buffer.encode_string(3, this->data);
5401 }
5402 #ifdef HAS_PROTO_MESSAGE_DUMP
5403 void BluetoothServiceData::dump_to(std::string &out) const {
5404  __attribute__((unused)) char buffer[64];
5405  out.append("BluetoothServiceData {\n");
5406  out.append(" uuid: ");
5407  out.append("'").append(this->uuid).append("'");
5408  out.append("\n");
5409 
5410  for (const auto &it : this->legacy_data) {
5411  out.append(" legacy_data: ");
5412  sprintf(buffer, "%" PRIu32, it);
5413  out.append(buffer);
5414  out.append("\n");
5415  }
5416 
5417  out.append(" data: ");
5418  out.append("'").append(this->data).append("'");
5419  out.append("\n");
5420  out.append("}");
5421 }
5422 #endif
5424  switch (field_id) {
5425  case 1: {
5426  this->address = value.as_uint64();
5427  return true;
5428  }
5429  case 3: {
5430  this->rssi = value.as_sint32();
5431  return true;
5432  }
5433  case 7: {
5434  this->address_type = value.as_uint32();
5435  return true;
5436  }
5437  default:
5438  return false;
5439  }
5440 }
5442  switch (field_id) {
5443  case 2: {
5444  this->name = value.as_string();
5445  return true;
5446  }
5447  case 4: {
5448  this->service_uuids.push_back(value.as_string());
5449  return true;
5450  }
5451  case 5: {
5452  this->service_data.push_back(value.as_message<BluetoothServiceData>());
5453  return true;
5454  }
5455  case 6: {
5456  this->manufacturer_data.push_back(value.as_message<BluetoothServiceData>());
5457  return true;
5458  }
5459  default:
5460  return false;
5461  }
5462 }
5464  buffer.encode_uint64(1, this->address);
5465  buffer.encode_string(2, this->name);
5466  buffer.encode_sint32(3, this->rssi);
5467  for (auto &it : this->service_uuids) {
5468  buffer.encode_string(4, it, true);
5469  }
5470  for (auto &it : this->service_data) {
5471  buffer.encode_message<BluetoothServiceData>(5, it, true);
5472  }
5473  for (auto &it : this->manufacturer_data) {
5474  buffer.encode_message<BluetoothServiceData>(6, it, true);
5475  }
5476  buffer.encode_uint32(7, this->address_type);
5477 }
5478 #ifdef HAS_PROTO_MESSAGE_DUMP
5479 void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
5480  __attribute__((unused)) char buffer[64];
5481  out.append("BluetoothLEAdvertisementResponse {\n");
5482  out.append(" address: ");
5483  sprintf(buffer, "%llu", this->address);
5484  out.append(buffer);
5485  out.append("\n");
5486 
5487  out.append(" name: ");
5488  out.append("'").append(this->name).append("'");
5489  out.append("\n");
5490 
5491  out.append(" rssi: ");
5492  sprintf(buffer, "%" PRId32, this->rssi);
5493  out.append(buffer);
5494  out.append("\n");
5495 
5496  for (const auto &it : this->service_uuids) {
5497  out.append(" service_uuids: ");
5498  out.append("'").append(it).append("'");
5499  out.append("\n");
5500  }
5501 
5502  for (const auto &it : this->service_data) {
5503  out.append(" service_data: ");
5504  it.dump_to(out);
5505  out.append("\n");
5506  }
5507 
5508  for (const auto &it : this->manufacturer_data) {
5509  out.append(" manufacturer_data: ");
5510  it.dump_to(out);
5511  out.append("\n");
5512  }
5513 
5514  out.append(" address_type: ");
5515  sprintf(buffer, "%" PRIu32, this->address_type);
5516  out.append(buffer);
5517  out.append("\n");
5518  out.append("}");
5519 }
5520 #endif
5522  switch (field_id) {
5523  case 1: {
5524  this->address = value.as_uint64();
5525  return true;
5526  }
5527  case 2: {
5528  this->rssi = value.as_sint32();
5529  return true;
5530  }
5531  case 3: {
5532  this->address_type = value.as_uint32();
5533  return true;
5534  }
5535  default:
5536  return false;
5537  }
5538 }
5540  switch (field_id) {
5541  case 4: {
5542  this->data = value.as_string();
5543  return true;
5544  }
5545  default:
5546  return false;
5547  }
5548 }
5550  buffer.encode_uint64(1, this->address);
5551  buffer.encode_sint32(2, this->rssi);
5552  buffer.encode_uint32(3, this->address_type);
5553  buffer.encode_string(4, this->data);
5554 }
5555 #ifdef HAS_PROTO_MESSAGE_DUMP
5556 void BluetoothLERawAdvertisement::dump_to(std::string &out) const {
5557  __attribute__((unused)) char buffer[64];
5558  out.append("BluetoothLERawAdvertisement {\n");
5559  out.append(" address: ");
5560  sprintf(buffer, "%llu", this->address);
5561  out.append(buffer);
5562  out.append("\n");
5563 
5564  out.append(" rssi: ");
5565  sprintf(buffer, "%" PRId32, this->rssi);
5566  out.append(buffer);
5567  out.append("\n");
5568 
5569  out.append(" address_type: ");
5570  sprintf(buffer, "%" PRIu32, this->address_type);
5571  out.append(buffer);
5572  out.append("\n");
5573 
5574  out.append(" data: ");
5575  out.append("'").append(this->data).append("'");
5576  out.append("\n");
5577  out.append("}");
5578 }
5579 #endif
5581  switch (field_id) {
5582  case 1: {
5583  this->advertisements.push_back(value.as_message<BluetoothLERawAdvertisement>());
5584  return true;
5585  }
5586  default:
5587  return false;
5588  }
5589 }
5591  for (auto &it : this->advertisements) {
5592  buffer.encode_message<BluetoothLERawAdvertisement>(1, it, true);
5593  }
5594 }
5595 #ifdef HAS_PROTO_MESSAGE_DUMP
5597  __attribute__((unused)) char buffer[64];
5598  out.append("BluetoothLERawAdvertisementsResponse {\n");
5599  for (const auto &it : this->advertisements) {
5600  out.append(" advertisements: ");
5601  it.dump_to(out);
5602  out.append("\n");
5603  }
5604  out.append("}");
5605 }
5606 #endif
5607 bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
5608  switch (field_id) {
5609  case 1: {
5610  this->address = value.as_uint64();
5611  return true;
5612  }
5613  case 2: {
5614  this->request_type = value.as_enum<enums::BluetoothDeviceRequestType>();
5615  return true;
5616  }
5617  case 3: {
5618  this->has_address_type = value.as_bool();
5619  return true;
5620  }
5621  case 4: {
5622  this->address_type = value.as_uint32();
5623  return true;
5624  }
5625  default:
5626  return false;
5627  }
5628 }
5630  buffer.encode_uint64(1, this->address);
5631  buffer.encode_enum<enums::BluetoothDeviceRequestType>(2, this->request_type);
5632  buffer.encode_bool(3, this->has_address_type);
5633  buffer.encode_uint32(4, this->address_type);
5634 }
5635 #ifdef HAS_PROTO_MESSAGE_DUMP
5636 void BluetoothDeviceRequest::dump_to(std::string &out) const {
5637  __attribute__((unused)) char buffer[64];
5638  out.append("BluetoothDeviceRequest {\n");
5639  out.append(" address: ");
5640  sprintf(buffer, "%llu", this->address);
5641  out.append(buffer);
5642  out.append("\n");
5643 
5644  out.append(" request_type: ");
5645  out.append(proto_enum_to_string<enums::BluetoothDeviceRequestType>(this->request_type));
5646  out.append("\n");
5647 
5648  out.append(" has_address_type: ");
5649  out.append(YESNO(this->has_address_type));
5650  out.append("\n");
5651 
5652  out.append(" address_type: ");
5653  sprintf(buffer, "%" PRIu32, this->address_type);
5654  out.append(buffer);
5655  out.append("\n");
5656  out.append("}");
5657 }
5658 #endif
5660  switch (field_id) {
5661  case 1: {
5662  this->address = value.as_uint64();
5663  return true;
5664  }
5665  case 2: {
5666  this->connected = value.as_bool();
5667  return true;
5668  }
5669  case 3: {
5670  this->mtu = value.as_uint32();
5671  return true;
5672  }
5673  case 4: {
5674  this->error = value.as_int32();
5675  return true;
5676  }
5677  default:
5678  return false;
5679  }
5680 }
5682  buffer.encode_uint64(1, this->address);
5683  buffer.encode_bool(2, this->connected);
5684  buffer.encode_uint32(3, this->mtu);
5685  buffer.encode_int32(4, this->error);
5686 }
5687 #ifdef HAS_PROTO_MESSAGE_DUMP
5688 void BluetoothDeviceConnectionResponse::dump_to(std::string &out) const {
5689  __attribute__((unused)) char buffer[64];
5690  out.append("BluetoothDeviceConnectionResponse {\n");
5691  out.append(" address: ");
5692  sprintf(buffer, "%llu", this->address);
5693  out.append(buffer);
5694  out.append("\n");
5695 
5696  out.append(" connected: ");
5697  out.append(YESNO(this->connected));
5698  out.append("\n");
5699 
5700  out.append(" mtu: ");
5701  sprintf(buffer, "%" PRIu32, this->mtu);
5702  out.append(buffer);
5703  out.append("\n");
5704 
5705  out.append(" error: ");
5706  sprintf(buffer, "%" PRId32, this->error);
5707  out.append(buffer);
5708  out.append("\n");
5709  out.append("}");
5710 }
5711 #endif
5713  switch (field_id) {
5714  case 1: {
5715  this->address = value.as_uint64();
5716  return true;
5717  }
5718  default:
5719  return false;
5720  }
5721 }
5722 void BluetoothGATTGetServicesRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_uint64(1, this->address); }
5723 #ifdef HAS_PROTO_MESSAGE_DUMP
5724 void BluetoothGATTGetServicesRequest::dump_to(std::string &out) const {
5725  __attribute__((unused)) char buffer[64];
5726  out.append("BluetoothGATTGetServicesRequest {\n");
5727  out.append(" address: ");
5728  sprintf(buffer, "%llu", this->address);
5729  out.append(buffer);
5730  out.append("\n");
5731  out.append("}");
5732 }
5733 #endif
5734 bool BluetoothGATTDescriptor::decode_varint(uint32_t field_id, ProtoVarInt value) {
5735  switch (field_id) {
5736  case 1: {
5737  this->uuid.push_back(value.as_uint64());
5738  return true;
5739  }
5740  case 2: {
5741  this->handle = value.as_uint32();
5742  return true;
5743  }
5744  default:
5745  return false;
5746  }
5747 }
5749  for (auto &it : this->uuid) {
5750  buffer.encode_uint64(1, it, true);
5751  }
5752  buffer.encode_uint32(2, this->handle);
5753 }
5754 #ifdef HAS_PROTO_MESSAGE_DUMP
5755 void BluetoothGATTDescriptor::dump_to(std::string &out) const {
5756  __attribute__((unused)) char buffer[64];
5757  out.append("BluetoothGATTDescriptor {\n");
5758  for (const auto &it : this->uuid) {
5759  out.append(" uuid: ");
5760  sprintf(buffer, "%llu", it);
5761  out.append(buffer);
5762  out.append("\n");
5763  }
5764 
5765  out.append(" handle: ");
5766  sprintf(buffer, "%" PRIu32, this->handle);
5767  out.append(buffer);
5768  out.append("\n");
5769  out.append("}");
5770 }
5771 #endif
5773  switch (field_id) {
5774  case 1: {
5775  this->uuid.push_back(value.as_uint64());
5776  return true;
5777  }
5778  case 2: {
5779  this->handle = value.as_uint32();
5780  return true;
5781  }
5782  case 3: {
5783  this->properties = value.as_uint32();
5784  return true;
5785  }
5786  default:
5787  return false;
5788  }
5789 }
5791  switch (field_id) {
5792  case 4: {
5793  this->descriptors.push_back(value.as_message<BluetoothGATTDescriptor>());
5794  return true;
5795  }
5796  default:
5797  return false;