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