mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 06:33:51 +00:00 
			
		
		
		
	Merge branch 'integration' into memory_api
This commit is contained in:
		| @@ -311,7 +311,7 @@ message BinarySensorStateResponse { | ||||
|   // If the binary sensor does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== COVER ==================== | ||||
| @@ -361,7 +361,7 @@ message CoverStateResponse { | ||||
|   float position = 3; | ||||
|   float tilt = 4; | ||||
|   CoverOperation current_operation = 5; | ||||
|   uint32 device_id = 6; | ||||
|   uint32 device_id = 6 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| enum LegacyCoverCommand { | ||||
| @@ -458,7 +458,7 @@ message FanCommandRequest { | ||||
|   int32 speed_level = 11; | ||||
|   bool has_preset_mode = 12; | ||||
|   string preset_mode = 13; | ||||
|   uint32 device_id = 14; | ||||
|   uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== LIGHT ==================== | ||||
| @@ -520,7 +520,7 @@ message LightStateResponse { | ||||
|   float cold_white = 12; | ||||
|   float warm_white = 13; | ||||
|   string effect = 9; | ||||
|   uint32 device_id = 14; | ||||
|   uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message LightCommandRequest { | ||||
|   option (id) = 32; | ||||
| @@ -556,7 +556,7 @@ message LightCommandRequest { | ||||
|   uint32 flash_length = 17; | ||||
|   bool has_effect = 18; | ||||
|   string effect = 19; | ||||
|   uint32 device_id = 28; | ||||
|   uint32 device_id = 28 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== SENSOR ==================== | ||||
| @@ -594,7 +594,7 @@ message ListEntitiesSensorResponse { | ||||
|   SensorLastResetType legacy_last_reset_type = 11; | ||||
|   bool disabled_by_default = 12; | ||||
|   EntityCategory entity_category = 13; | ||||
|   uint32 device_id = 14; | ||||
|   uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message SensorStateResponse { | ||||
|   option (id) = 25; | ||||
| @@ -608,7 +608,7 @@ message SensorStateResponse { | ||||
|   // If the sensor does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== SWITCH ==================== | ||||
| @@ -639,7 +639,7 @@ message SwitchStateResponse { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   bool state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message SwitchCommandRequest { | ||||
|   option (id) = 33; | ||||
| @@ -650,7 +650,7 @@ message SwitchCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   bool state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== TEXT SENSOR ==================== | ||||
| @@ -683,7 +683,7 @@ message TextSensorStateResponse { | ||||
|   // If the text sensor does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== SUBSCRIBE LOGS ==================== | ||||
| @@ -869,7 +869,7 @@ message CameraImageResponse { | ||||
|   fixed32 key = 1; | ||||
|   bytes data = 2; | ||||
|   bool done = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message CameraImageRequest { | ||||
|   option (id) = 45; | ||||
| @@ -1020,7 +1020,7 @@ message ClimateCommandRequest { | ||||
|   string custom_preset = 21; | ||||
|   bool has_target_humidity = 22; | ||||
|   float target_humidity = 23; | ||||
|   uint32 device_id = 24; | ||||
|   uint32 device_id = 24 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== NUMBER ==================== | ||||
| @@ -1049,7 +1049,7 @@ message ListEntitiesNumberResponse { | ||||
|   string unit_of_measurement = 11; | ||||
|   NumberMode mode = 12; | ||||
|   string device_class = 13; | ||||
|   uint32 device_id = 14; | ||||
|   uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message NumberStateResponse { | ||||
|   option (id) = 50; | ||||
| @@ -1063,7 +1063,7 @@ message NumberStateResponse { | ||||
|   // If the number does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message NumberCommandRequest { | ||||
|   option (id) = 51; | ||||
| @@ -1074,7 +1074,7 @@ message NumberCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   float state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== SELECT ==================== | ||||
| @@ -1107,7 +1107,7 @@ message SelectStateResponse { | ||||
|   // If the select does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message SelectCommandRequest { | ||||
|   option (id) = 54; | ||||
| @@ -1118,7 +1118,7 @@ message SelectCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   string state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== SIREN ==================== | ||||
| @@ -1150,7 +1150,7 @@ message SirenStateResponse { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   bool state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message SirenCommandRequest { | ||||
|   option (id) = 57; | ||||
| @@ -1216,7 +1216,7 @@ message LockStateResponse { | ||||
|   option (no_delay) = true; | ||||
|   fixed32 key = 1; | ||||
|   LockState state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message LockCommandRequest { | ||||
|   option (id) = 60; | ||||
| @@ -1230,7 +1230,7 @@ message LockCommandRequest { | ||||
|   // Not yet implemented: | ||||
|   bool has_code = 3; | ||||
|   string code = 4; | ||||
|   uint32 device_id = 5; | ||||
|   uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== BUTTON ==================== | ||||
| @@ -1259,7 +1259,7 @@ message ButtonCommandRequest { | ||||
|   option (base_class) = "CommandProtoMessage"; | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   uint32 device_id = 2; | ||||
|   uint32 device_id = 2 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== MEDIA PLAYER ==================== | ||||
| @@ -1320,7 +1320,7 @@ message MediaPlayerStateResponse { | ||||
|   MediaPlayerState state = 2; | ||||
|   float volume = 3; | ||||
|   bool muted = 4; | ||||
|   uint32 device_id = 5; | ||||
|   uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message MediaPlayerCommandRequest { | ||||
|   option (id) = 65; | ||||
| @@ -1863,7 +1863,7 @@ message AlarmControlPanelStateResponse { | ||||
|   option (no_delay) = true; | ||||
|   fixed32 key = 1; | ||||
|   AlarmControlPanelState state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| message AlarmControlPanelCommandRequest { | ||||
| @@ -1875,7 +1875,7 @@ message AlarmControlPanelCommandRequest { | ||||
|   fixed32 key = 1; | ||||
|   AlarmControlPanelStateCommand command = 2; | ||||
|   string code = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ===================== TEXT ===================== | ||||
| @@ -1915,7 +1915,7 @@ message TextStateResponse { | ||||
|   // If the Text does not have a valid state yet. | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message TextCommandRequest { | ||||
|   option (id) = 99; | ||||
| @@ -1926,7 +1926,7 @@ message TextCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   string state = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -1961,7 +1961,7 @@ message DateStateResponse { | ||||
|   uint32 year = 3; | ||||
|   uint32 month = 4; | ||||
|   uint32 day = 5; | ||||
|   uint32 device_id = 6; | ||||
|   uint32 device_id = 6 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message DateCommandRequest { | ||||
|   option (id) = 102; | ||||
| @@ -1974,7 +1974,7 @@ message DateCommandRequest { | ||||
|   uint32 year = 2; | ||||
|   uint32 month = 3; | ||||
|   uint32 day = 4; | ||||
|   uint32 device_id = 5; | ||||
|   uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== DATETIME TIME ==================== | ||||
| @@ -2008,7 +2008,7 @@ message TimeStateResponse { | ||||
|   uint32 hour = 3; | ||||
|   uint32 minute = 4; | ||||
|   uint32 second = 5; | ||||
|   uint32 device_id = 6; | ||||
|   uint32 device_id = 6 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message TimeCommandRequest { | ||||
|   option (id) = 105; | ||||
| @@ -2021,7 +2021,7 @@ message TimeCommandRequest { | ||||
|   uint32 hour = 2; | ||||
|   uint32 minute = 3; | ||||
|   uint32 second = 4; | ||||
|   uint32 device_id = 5; | ||||
|   uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== EVENT ==================== | ||||
| @@ -2052,7 +2052,7 @@ message EventResponse { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   string event_type = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== VALVE ==================== | ||||
| @@ -2093,7 +2093,7 @@ message ValveStateResponse { | ||||
|   fixed32 key = 1; | ||||
|   float position = 2; | ||||
|   ValveOperation current_operation = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| message ValveCommandRequest { | ||||
| @@ -2107,7 +2107,7 @@ message ValveCommandRequest { | ||||
|   bool has_position = 2; | ||||
|   float position = 3; | ||||
|   bool stop = 4; | ||||
|   uint32 device_id = 5; | ||||
|   uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== DATETIME DATETIME ==================== | ||||
| @@ -2139,7 +2139,7 @@ message DateTimeStateResponse { | ||||
|   // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller | ||||
|   bool missing_state = 2; | ||||
|   fixed32 epoch_seconds = 3; | ||||
|   uint32 device_id = 4; | ||||
|   uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| message DateTimeCommandRequest { | ||||
|   option (id) = 114; | ||||
| @@ -2150,7 +2150,7 @@ message DateTimeCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   fixed32 epoch_seconds = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // ==================== UPDATE ==================== | ||||
| @@ -2204,5 +2204,5 @@ message UpdateCommandRequest { | ||||
|  | ||||
|   fixed32 key = 1; | ||||
|   UpdateCommand command = 2; | ||||
|   uint32 device_id = 3; | ||||
|   uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|   | ||||
| @@ -277,34 +277,6 @@ class APIConnection : public APIServerConnection { | ||||
|   // Helper function to handle authentication completion | ||||
|   void complete_authentication_(); | ||||
|  | ||||
|   // Helper function to fill common entity info fields | ||||
|   static void fill_entity_info_base(esphome::EntityBase *entity, InfoResponseProtoMessage &response) { | ||||
|     // Set common fields that are shared by all entity types | ||||
|     response.key = entity->get_object_id_hash(); | ||||
|     response.object_id = entity->get_object_id(); | ||||
|  | ||||
|     if (entity->has_own_name()) | ||||
|       response.name = entity->get_name(); | ||||
|  | ||||
|       // Set common EntityBase properties | ||||
| #ifdef USE_ENTITY_ICON | ||||
|     response.icon = entity->get_icon(); | ||||
| #endif | ||||
|     response.disabled_by_default = entity->is_disabled_by_default(); | ||||
|     response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category()); | ||||
| #ifdef USE_DEVICES | ||||
|     response.device_id = entity->get_device_id(); | ||||
| #endif | ||||
|   } | ||||
|  | ||||
|   // Helper function to fill common entity state fields | ||||
|   static void fill_entity_state_base(esphome::EntityBase *entity, StateResponseProtoMessage &response) { | ||||
|     response.key = entity->get_object_id_hash(); | ||||
| #ifdef USE_DEVICES | ||||
|     response.device_id = entity->get_device_id(); | ||||
| #endif | ||||
|   } | ||||
|  | ||||
|   // Non-template helper to encode any ProtoMessage | ||||
|   static uint16_t encode_message_to_buffer(ProtoMessage &msg, uint8_t message_type, APIConnection *conn, | ||||
|                                            uint32_t remaining_size, bool is_single); | ||||
|   | ||||
| @@ -260,13 +260,17 @@ void BinarySensorStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bool(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void BinarySensorStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| #endif | ||||
| #ifdef USE_COVER | ||||
| @@ -312,7 +316,9 @@ void CoverStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_float(3, this->position); | ||||
|   buffer.encode_float(4, this->tilt); | ||||
|   buffer.encode_uint32(5, static_cast<uint32_t>(this->current_operation)); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(6, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void CoverStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
| @@ -320,7 +326,9 @@ void CoverStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_float_field(total_size, 1, this->position); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->tilt); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation)); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -468,9 +476,11 @@ bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 12: | ||||
|       this->has_preset_mode = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 14: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -566,7 +576,9 @@ void LightStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_float(12, this->cold_white); | ||||
|   buffer.encode_float(13, this->warm_white); | ||||
|   buffer.encode_string(9, this->effect); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(14, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void LightStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
| @@ -582,7 +594,9 @@ void LightStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_float_field(total_size, 1, this->cold_white); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->warm_white); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->effect); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -634,9 +648,11 @@ bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 18: | ||||
|       this->has_effect = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 28: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -706,7 +722,9 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint32(11, static_cast<uint32_t>(this->legacy_last_reset_type)); | ||||
|   buffer.encode_bool(12, this->disabled_by_default); | ||||
|   buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category)); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(14, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
| @@ -723,19 +741,25 @@ void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_last_reset_type)); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category)); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void SensorStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_float(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void SensorStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| #endif | ||||
| #ifdef USE_SWITCH | ||||
| @@ -772,21 +796,27 @@ void ListEntitiesSwitchResponse::calculate_size(uint32_t &total_size) const { | ||||
| void SwitchStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bool(2, this->state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(3, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void SwitchStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
|     case 2: | ||||
|       this->state = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -836,13 +866,17 @@ void TextSensorStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_string(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void TextSensorStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| #endif | ||||
| bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
| @@ -1151,13 +1185,17 @@ void CameraImageResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bytes(2, reinterpret_cast<const uint8_t *>(this->data.data()), this->data.size()); | ||||
|   buffer.encode_bool(3, this->done); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void CameraImageResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->data); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->done); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -1362,9 +1400,11 @@ bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) | ||||
|     case 22: | ||||
|       this->has_target_humidity = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 24: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -1422,7 +1462,9 @@ void ListEntitiesNumberResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(11, this->unit_of_measurement); | ||||
|   buffer.encode_uint32(12, static_cast<uint32_t>(this->mode)); | ||||
|   buffer.encode_string(13, this->device_class); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(14, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void ListEntitiesNumberResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
| @@ -1439,25 +1481,33 @@ void ListEntitiesNumberResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unit_of_measurement); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->mode)); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->device_class); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void NumberStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_float(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void NumberStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool NumberCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -1516,19 +1566,25 @@ void SelectStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_string(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void SelectStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool SelectCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -1597,12 +1653,16 @@ void ListEntitiesSirenResponse::calculate_size(uint32_t &total_size) const { | ||||
| void SirenStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bool(2, this->state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(3, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void SirenStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -1696,12 +1756,16 @@ void ListEntitiesLockResponse::calculate_size(uint32_t &total_size) const { | ||||
| void LockStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_uint32(2, static_cast<uint32_t>(this->state)); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(3, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void LockStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state)); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -1711,9 +1775,11 @@ bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 3: | ||||
|       this->has_code = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 5: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -1771,9 +1837,11 @@ void ListEntitiesButtonResponse::calculate_size(uint32_t &total_size) const { | ||||
| } | ||||
| bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| #ifdef USE_DEVICES | ||||
|     case 2: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -1871,14 +1939,18 @@ void MediaPlayerStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint32(2, static_cast<uint32_t>(this->state)); | ||||
|   buffer.encode_float(3, this->volume); | ||||
|   buffer.encode_bool(4, this->muted); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(5, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void MediaPlayerStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state)); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->volume); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->muted); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -2736,21 +2808,27 @@ void ListEntitiesAlarmControlPanelResponse::calculate_size(uint32_t &total_size) | ||||
| void AlarmControlPanelStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_uint32(2, static_cast<uint32_t>(this->state)); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(3, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void AlarmControlPanelStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state)); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
|     case 2: | ||||
|       this->command = static_cast<enums::AlarmControlPanelStateCommand>(value.as_uint32()); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 4: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -2816,19 +2894,25 @@ void TextStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_string(2, this->state); | ||||
|   buffer.encode_bool(3, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void TextStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -2888,7 +2972,9 @@ void DateStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint32(3, this->year); | ||||
|   buffer.encode_uint32(4, this->month); | ||||
|   buffer.encode_uint32(5, this->day); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(6, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void DateStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
| @@ -2896,7 +2982,9 @@ void DateStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->year); | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->month); | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->day); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -2909,9 +2997,11 @@ bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 4: | ||||
|       this->day = value.as_uint32(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 5: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -2961,7 +3051,9 @@ void TimeStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint32(3, this->hour); | ||||
|   buffer.encode_uint32(4, this->minute); | ||||
|   buffer.encode_uint32(5, this->second); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(6, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void TimeStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
| @@ -2969,7 +3061,9 @@ void TimeStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->hour); | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->minute); | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->second); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -2982,9 +3076,11 @@ bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 4: | ||||
|       this->second = value.as_uint32(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 5: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -3041,12 +3137,16 @@ void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const { | ||||
| void EventResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_string(2, this->event_type); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(3, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void EventResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->event_type); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| #endif | ||||
| #ifdef USE_VALVE | ||||
| @@ -3088,13 +3188,17 @@ void ValveStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_float(2, this->position); | ||||
|   buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation)); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void ValveStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->position); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation)); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| @@ -3104,9 +3208,11 @@ bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 4: | ||||
|       this->stop = value.as_bool(); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 5: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -3157,19 +3263,25 @@ void DateTimeStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bool(2, this->missing_state); | ||||
|   buffer.encode_fixed32(3, this->epoch_seconds); | ||||
| #ifdef USE_DEVICES | ||||
|   buffer.encode_uint32(4, this->device_id); | ||||
| #endif | ||||
| } | ||||
| void DateTimeStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->missing_state); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->epoch_seconds); | ||||
| #ifdef USE_DEVICES | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->device_id); | ||||
| #endif | ||||
| } | ||||
| bool DateTimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| @@ -3253,9 +3365,11 @@ bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 2: | ||||
|       this->command = static_cast<enums::UpdateCommand>(value.as_uint32()); | ||||
|       break; | ||||
| #ifdef USE_DEVICES | ||||
|     case 3: | ||||
|       this->device_id = value.as_uint32(); | ||||
|       break; | ||||
| #endif | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
|   | ||||
| @@ -883,10 +883,13 @@ void BinarySensorStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -976,10 +979,13 @@ void CoverStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::CoverOperation>(this->current_operation)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void CoverCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -1192,10 +1198,13 @@ void FanCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->preset_mode).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -1342,10 +1351,13 @@ void LightStateResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->effect).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void LightCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -1471,10 +1483,13 @@ void LightCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->effect).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -1534,10 +1549,13 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void SensorStateResponse::dump_to(std::string &out) const { | ||||
| @@ -1557,10 +1575,13 @@ void SensorStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -1624,10 +1645,13 @@ void SwitchStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void SwitchCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -1642,10 +1666,13 @@ void SwitchCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -1709,10 +1736,13 @@ void TextSensorStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2009,10 +2039,13 @@ void CameraImageResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->done)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void CameraImageRequest::dump_to(std::string &out) const { | ||||
| @@ -2337,10 +2370,13 @@ void ClimateCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2402,10 +2438,13 @@ void ListEntitiesNumberResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->device_class).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void NumberStateResponse::dump_to(std::string &out) const { | ||||
| @@ -2425,10 +2464,13 @@ void NumberStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void NumberCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -2444,10 +2486,13 @@ void NumberCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2513,10 +2558,13 @@ void SelectStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void SelectCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -2531,10 +2579,13 @@ void SelectCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->state).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2604,10 +2655,13 @@ void SirenStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void SirenCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -2730,10 +2784,13 @@ void LockStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::LockState>(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void LockCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -2756,10 +2813,13 @@ void LockCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->code).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2815,10 +2875,13 @@ void ButtonCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -2920,10 +2983,13 @@ void MediaPlayerStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->muted)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void MediaPlayerCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -3779,10 +3845,13 @@ void AlarmControlPanelStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::AlarmControlPanelState>(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void AlarmControlPanelCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -3801,10 +3870,13 @@ void AlarmControlPanelCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->code).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -3882,10 +3954,13 @@ void TextStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->missing_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void TextCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -3900,10 +3975,13 @@ void TextCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->state).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -3974,10 +4052,13 @@ void DateStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void DateCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -4003,10 +4084,13 @@ void DateCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -4077,10 +4161,13 @@ void TimeStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void TimeCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -4106,10 +4193,13 @@ void TimeCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -4175,10 +4265,13 @@ void EventResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->event_type).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -4255,10 +4348,13 @@ void ValveStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::ValveOperation>(this->current_operation)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void ValveCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -4282,10 +4378,13 @@ void ValveCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->stop)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -4346,10 +4445,13 @@ void DateTimeStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| void DateTimeCommandRequest::dump_to(std::string &out) const { | ||||
| @@ -4365,10 +4467,13 @@ void DateTimeCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
| @@ -4482,10 +4587,13 @@ void UpdateCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::UpdateCommand>(this->command)); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_DEVICES | ||||
|   out.append("  device_id: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
|   out.append("}"); | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -176,7 +176,7 @@ void SSD1306::setup() { | ||||
|   // Disable scrolling mode (0x2E) | ||||
|   this->command(SSD1306_COMMAND_DEACTIVATE_SCROLL); | ||||
|  | ||||
|   // Contrast and brighrness | ||||
|   // Contrast and brightness | ||||
|   // SSD1306 does not have brightness setting | ||||
|   set_contrast(this->contrast_); | ||||
|   if (this->is_ssd1305_()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user