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