mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	Merge branch 'integration' into memory_api
This commit is contained in:
		| @@ -76,10 +76,6 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage | ||||
|   void set_sampling_mode(SamplingMode sampling_mode); | ||||
|   float sample() override; | ||||
|  | ||||
| #ifdef USE_ESP8266 | ||||
|   std::string unique_id() override; | ||||
| #endif  // USE_ESP8266 | ||||
|  | ||||
| #ifdef USE_RP2040 | ||||
|   void set_is_temperature() { this->is_temperature_ = true; } | ||||
| #endif  // USE_RP2040 | ||||
|   | ||||
| @@ -56,8 +56,6 @@ float ADCSensor::sample() { | ||||
|   return aggr.aggregate() / 1024.0f; | ||||
| } | ||||
|  | ||||
| std::string ADCSensor::unique_id() { return get_mac_address() + "-adc"; } | ||||
|  | ||||
| }  // namespace adc | ||||
| }  // namespace esphome | ||||
|  | ||||
|   | ||||
| @@ -290,7 +290,7 @@ message ListEntitiesBinarySensorResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string device_class = 5; | ||||
|   bool is_status_binary_sensor = 6; | ||||
| @@ -324,7 +324,7 @@ message ListEntitiesCoverResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   bool assumed_state = 5; | ||||
|   bool supports_position = 6; | ||||
| @@ -401,7 +401,7 @@ message ListEntitiesFanResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   bool supports_oscillation = 5; | ||||
|   bool supports_speed = 6; | ||||
| @@ -484,7 +484,7 @@ message ListEntitiesLightResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   repeated ColorMode supported_color_modes = 12; | ||||
|   // next four supports_* are for legacy clients, newer clients should use color modes | ||||
| @@ -582,7 +582,7 @@ message ListEntitiesSensorResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   string unit_of_measurement = 6; | ||||
| @@ -621,7 +621,7 @@ message ListEntitiesSwitchResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool assumed_state = 6; | ||||
| @@ -663,7 +663,7 @@ message ListEntitiesTextSensorResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -853,7 +853,7 @@ message ListEntitiesCameraResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|   bool disabled_by_default = 5; | ||||
|   string icon = 6 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   EntityCategory entity_category = 7; | ||||
| @@ -937,7 +937,7 @@ message ListEntitiesClimateResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   bool supports_current_temperature = 5; | ||||
|   bool supports_two_point_target_temperature = 6; | ||||
| @@ -1038,7 +1038,7 @@ message ListEntitiesNumberResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   float min_value = 6; | ||||
| @@ -1087,7 +1087,7 @@ message ListEntitiesSelectResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   repeated string options = 6; | ||||
| @@ -1131,7 +1131,7 @@ message ListEntitiesSirenResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -1194,7 +1194,7 @@ message ListEntitiesLockResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -1243,7 +1243,7 @@ message ListEntitiesButtonResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -1298,7 +1298,7 @@ message ListEntitiesMediaPlayerResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -1845,7 +1845,7 @@ message ListEntitiesAlarmControlPanelResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
|   EntityCategory entity_category = 7; | ||||
| @@ -1892,7 +1892,7 @@ message ListEntitiesTextResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
|   EntityCategory entity_category = 7; | ||||
| @@ -1940,7 +1940,7 @@ message ListEntitiesDateResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -1987,7 +1987,7 @@ message ListEntitiesTimeResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -2034,7 +2034,7 @@ message ListEntitiesEventResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -2065,7 +2065,7 @@ message ListEntitiesValveResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -2120,7 +2120,7 @@ message ListEntitiesDateTimeResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
| @@ -2163,7 +2163,7 @@ message ListEntitiesUpdateResponse { | ||||
|   string object_id = 1; | ||||
|   fixed32 key = 2; | ||||
|   string name = 3; | ||||
|   string unique_id = 4; | ||||
|   reserved 4; // Deprecated: was string unique_id | ||||
|  | ||||
|   string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"]; | ||||
|   bool disabled_by_default = 6; | ||||
|   | ||||
| @@ -240,10 +240,6 @@ void APIConnection::loop() { | ||||
|   } | ||||
| } | ||||
|  | ||||
| std::string get_default_unique_id(const std::string &component_type, EntityBase *entity) { | ||||
|   return App.get_name() + component_type + entity->get_object_id(); | ||||
| } | ||||
|  | ||||
| DisconnectResponse APIConnection::disconnect(const DisconnectRequest &msg) { | ||||
|   // remote initiated disconnect_client | ||||
|   // don't close yet, we still need to send the disconnect response | ||||
| @@ -330,7 +326,6 @@ uint16_t APIConnection::try_send_binary_sensor_info(EntityBase *entity, APIConne | ||||
|   ListEntitiesBinarySensorResponse msg; | ||||
|   msg.device_class = binary_sensor->get_device_class(); | ||||
|   msg.is_status_binary_sensor = binary_sensor->is_status_binary_sensor(); | ||||
|   msg.unique_id = get_default_unique_id("binary_sensor", binary_sensor); | ||||
|   fill_entity_info_base(binary_sensor, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesBinarySensorResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -365,7 +360,6 @@ uint16_t APIConnection::try_send_cover_info(EntityBase *entity, APIConnection *c | ||||
|   msg.supports_tilt = traits.get_supports_tilt(); | ||||
|   msg.supports_stop = traits.get_supports_stop(); | ||||
|   msg.device_class = cover->get_device_class(); | ||||
|   msg.unique_id = get_default_unique_id("cover", cover); | ||||
|   fill_entity_info_base(cover, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesCoverResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -428,7 +422,6 @@ uint16_t APIConnection::try_send_fan_info(EntityBase *entity, APIConnection *con | ||||
|   msg.supported_speed_count = traits.supported_speed_count(); | ||||
|   for (auto const &preset : traits.supported_preset_modes()) | ||||
|     msg.supported_preset_modes.push_back(preset); | ||||
|   msg.unique_id = get_default_unique_id("fan", fan); | ||||
|   fill_entity_info_base(fan, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesFanResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -502,7 +495,6 @@ uint16_t APIConnection::try_send_light_info(EntityBase *entity, APIConnection *c | ||||
|       msg.effects.push_back(effect->get_name()); | ||||
|     } | ||||
|   } | ||||
|   msg.unique_id = get_default_unique_id("light", light); | ||||
|   fill_entity_info_base(light, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesLightResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -564,9 +556,6 @@ uint16_t APIConnection::try_send_sensor_info(EntityBase *entity, APIConnection * | ||||
|   msg.force_update = sensor->get_force_update(); | ||||
|   msg.device_class = sensor->get_device_class(); | ||||
|   msg.state_class = static_cast<enums::SensorStateClass>(sensor->get_state_class()); | ||||
|   msg.unique_id = sensor->unique_id(); | ||||
|   if (msg.unique_id.empty()) | ||||
|     msg.unique_id = get_default_unique_id("sensor", sensor); | ||||
|   fill_entity_info_base(sensor, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesSensorResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -593,7 +582,6 @@ uint16_t APIConnection::try_send_switch_info(EntityBase *entity, APIConnection * | ||||
|   ListEntitiesSwitchResponse msg; | ||||
|   msg.assumed_state = a_switch->assumed_state(); | ||||
|   msg.device_class = a_switch->get_device_class(); | ||||
|   msg.unique_id = get_default_unique_id("switch", a_switch); | ||||
|   fill_entity_info_base(a_switch, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesSwitchResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -628,9 +616,6 @@ uint16_t APIConnection::try_send_text_sensor_info(EntityBase *entity, APIConnect | ||||
|   auto *text_sensor = static_cast<text_sensor::TextSensor *>(entity); | ||||
|   ListEntitiesTextSensorResponse msg; | ||||
|   msg.device_class = text_sensor->get_device_class(); | ||||
|   msg.unique_id = text_sensor->unique_id(); | ||||
|   if (msg.unique_id.empty()) | ||||
|     msg.unique_id = get_default_unique_id("text_sensor", text_sensor); | ||||
|   fill_entity_info_base(text_sensor, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesTextSensorResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -703,7 +688,6 @@ uint16_t APIConnection::try_send_climate_info(EntityBase *entity, APIConnection | ||||
|     msg.supported_custom_presets.push_back(custom_preset); | ||||
|   for (auto swing_mode : traits.get_supported_swing_modes()) | ||||
|     msg.supported_swing_modes.push_back(static_cast<enums::ClimateSwingMode>(swing_mode)); | ||||
|   msg.unique_id = get_default_unique_id("climate", climate); | ||||
|   fill_entity_info_base(climate, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesClimateResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -759,7 +743,6 @@ uint16_t APIConnection::try_send_number_info(EntityBase *entity, APIConnection * | ||||
|   msg.min_value = number->traits.get_min_value(); | ||||
|   msg.max_value = number->traits.get_max_value(); | ||||
|   msg.step = number->traits.get_step(); | ||||
|   msg.unique_id = get_default_unique_id("number", number); | ||||
|   fill_entity_info_base(number, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesNumberResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -790,7 +773,6 @@ uint16_t APIConnection::try_send_date_info(EntityBase *entity, APIConnection *co | ||||
|                                            bool is_single) { | ||||
|   auto *date = static_cast<datetime::DateEntity *>(entity); | ||||
|   ListEntitiesDateResponse msg; | ||||
|   msg.unique_id = get_default_unique_id("date", date); | ||||
|   fill_entity_info_base(date, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesDateResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -821,7 +803,6 @@ uint16_t APIConnection::try_send_time_info(EntityBase *entity, APIConnection *co | ||||
|                                            bool is_single) { | ||||
|   auto *time = static_cast<datetime::TimeEntity *>(entity); | ||||
|   ListEntitiesTimeResponse msg; | ||||
|   msg.unique_id = get_default_unique_id("time", time); | ||||
|   fill_entity_info_base(time, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesTimeResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -853,7 +834,6 @@ uint16_t APIConnection::try_send_datetime_info(EntityBase *entity, APIConnection | ||||
|                                                bool is_single) { | ||||
|   auto *datetime = static_cast<datetime::DateTimeEntity *>(entity); | ||||
|   ListEntitiesDateTimeResponse msg; | ||||
|   msg.unique_id = get_default_unique_id("datetime", datetime); | ||||
|   fill_entity_info_base(datetime, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesDateTimeResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -888,7 +868,6 @@ uint16_t APIConnection::try_send_text_info(EntityBase *entity, APIConnection *co | ||||
|   msg.min_length = text->traits.get_min_length(); | ||||
|   msg.max_length = text->traits.get_max_length(); | ||||
|   msg.pattern = text->traits.get_pattern(); | ||||
|   msg.unique_id = get_default_unique_id("text", text); | ||||
|   fill_entity_info_base(text, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesTextResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -921,7 +900,6 @@ uint16_t APIConnection::try_send_select_info(EntityBase *entity, APIConnection * | ||||
|   ListEntitiesSelectResponse msg; | ||||
|   for (const auto &option : select->traits.get_options()) | ||||
|     msg.options.push_back(option); | ||||
|   msg.unique_id = get_default_unique_id("select", select); | ||||
|   fill_entity_info_base(select, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesSelectResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -938,7 +916,6 @@ uint16_t APIConnection::try_send_button_info(EntityBase *entity, APIConnection * | ||||
|   auto *button = static_cast<button::Button *>(entity); | ||||
|   ListEntitiesButtonResponse msg; | ||||
|   msg.device_class = button->get_device_class(); | ||||
|   msg.unique_id = get_default_unique_id("button", button); | ||||
|   fill_entity_info_base(button, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesButtonResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -970,7 +947,6 @@ uint16_t APIConnection::try_send_lock_info(EntityBase *entity, APIConnection *co | ||||
|   msg.assumed_state = a_lock->traits.get_assumed_state(); | ||||
|   msg.supports_open = a_lock->traits.get_supports_open(); | ||||
|   msg.requires_code = a_lock->traits.get_requires_code(); | ||||
|   msg.unique_id = get_default_unique_id("lock", a_lock); | ||||
|   fill_entity_info_base(a_lock, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesLockResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -1014,7 +990,6 @@ uint16_t APIConnection::try_send_valve_info(EntityBase *entity, APIConnection *c | ||||
|   msg.assumed_state = traits.get_is_assumed_state(); | ||||
|   msg.supports_position = traits.get_supports_position(); | ||||
|   msg.supports_stop = traits.get_supports_stop(); | ||||
|   msg.unique_id = get_default_unique_id("valve", valve); | ||||
|   fill_entity_info_base(valve, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesValveResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -1061,7 +1036,6 @@ uint16_t APIConnection::try_send_media_player_info(EntityBase *entity, APIConnec | ||||
|     media_format.sample_bytes = supported_format.sample_bytes; | ||||
|     msg.supported_formats.push_back(media_format); | ||||
|   } | ||||
|   msg.unique_id = get_default_unique_id("media_player", media_player); | ||||
|   fill_entity_info_base(media_player, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesMediaPlayerResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -1098,7 +1072,6 @@ uint16_t APIConnection::try_send_camera_info(EntityBase *entity, APIConnection * | ||||
|                                              bool is_single) { | ||||
|   auto *camera = static_cast<camera::Camera *>(entity); | ||||
|   ListEntitiesCameraResponse msg; | ||||
|   msg.unique_id = get_default_unique_id("camera", camera); | ||||
|   fill_entity_info_base(camera, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesCameraResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -1288,7 +1261,6 @@ uint16_t APIConnection::try_send_alarm_control_panel_info(EntityBase *entity, AP | ||||
|   msg.supported_features = a_alarm_control_panel->get_supported_features(); | ||||
|   msg.requires_code = a_alarm_control_panel->get_requires_code(); | ||||
|   msg.requires_code_to_arm = a_alarm_control_panel->get_requires_code_to_arm(); | ||||
|   msg.unique_id = get_default_unique_id("alarm_control_panel", a_alarm_control_panel); | ||||
|   fill_entity_info_base(a_alarm_control_panel, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesAlarmControlPanelResponse::MESSAGE_TYPE, conn, remaining_size, | ||||
|                                   is_single); | ||||
| @@ -1343,7 +1315,6 @@ uint16_t APIConnection::try_send_event_info(EntityBase *entity, APIConnection *c | ||||
|   msg.device_class = event->get_device_class(); | ||||
|   for (const auto &event_type : event->get_event_types()) | ||||
|     msg.event_types.push_back(event_type); | ||||
|   msg.unique_id = get_default_unique_id("event", event); | ||||
|   fill_entity_info_base(event, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesEventResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
| @@ -1379,7 +1350,6 @@ uint16_t APIConnection::try_send_update_info(EntityBase *entity, APIConnection * | ||||
|   auto *update = static_cast<update::UpdateEntity *>(entity); | ||||
|   ListEntitiesUpdateResponse msg; | ||||
|   msg.device_class = update->get_device_class(); | ||||
|   msg.unique_id = get_default_unique_id("update", update); | ||||
|   fill_entity_info_base(update, msg); | ||||
|   return encode_message_to_buffer(msg, ListEntitiesUpdateResponse::MESSAGE_TYPE, conn, remaining_size, is_single); | ||||
| } | ||||
|   | ||||
| @@ -230,7 +230,6 @@ void ListEntitiesBinarySensorResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   buffer.encode_string(5, this->device_class); | ||||
|   buffer.encode_bool(6, this->is_status_binary_sensor); | ||||
|   buffer.encode_bool(7, this->disabled_by_default); | ||||
| @@ -246,7 +245,6 @@ void ListEntitiesBinarySensorResponse::calculate_size(uint32_t &total_size) cons | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->device_class); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->is_status_binary_sensor); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default); | ||||
| @@ -276,7 +274,6 @@ void ListEntitiesCoverResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   buffer.encode_bool(5, this->assumed_state); | ||||
|   buffer.encode_bool(6, this->supports_position); | ||||
|   buffer.encode_bool(7, this->supports_tilt); | ||||
| @@ -295,7 +292,6 @@ void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->assumed_state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_position); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_tilt); | ||||
| @@ -375,7 +371,6 @@ void ListEntitiesFanResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   buffer.encode_bool(5, this->supports_oscillation); | ||||
|   buffer.encode_bool(6, this->supports_speed); | ||||
|   buffer.encode_bool(7, this->supports_direction); | ||||
| @@ -396,7 +391,6 @@ void ListEntitiesFanResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_oscillation); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_speed); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_direction); | ||||
| @@ -508,7 +502,6 @@ void ListEntitiesLightResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   for (auto &it : this->supported_color_modes) { | ||||
|     buffer.encode_uint32(12, static_cast<uint32_t>(it), true); | ||||
|   } | ||||
| @@ -534,7 +527,6 @@ void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   if (!this->supported_color_modes.empty()) { | ||||
|     for (const auto &it : this->supported_color_modes) { | ||||
|       ProtoSize::add_enum_field_repeated(total_size, 1, static_cast<uint32_t>(it)); | ||||
| @@ -703,7 +695,6 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -721,7 +712,6 @@ void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -753,7 +743,6 @@ void ListEntitiesSwitchResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -769,7 +758,6 @@ void ListEntitiesSwitchResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -820,7 +808,6 @@ void ListEntitiesTextSensorResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -835,7 +822,6 @@ void ListEntitiesTextSensorResponse::calculate_size(uint32_t &total_size) const | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1139,7 +1125,6 @@ void ListEntitiesCameraResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   buffer.encode_bool(5, this->disabled_by_default); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(6, this->icon); | ||||
| @@ -1153,7 +1138,6 @@ void ListEntitiesCameraResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| @@ -1194,7 +1178,6 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
|   buffer.encode_bool(5, this->supports_current_temperature); | ||||
|   buffer.encode_bool(6, this->supports_two_point_target_temperature); | ||||
|   for (auto &it : this->supported_modes) { | ||||
| @@ -1238,7 +1221,6 @@ void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_current_temperature); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_two_point_target_temperature); | ||||
|   if (!this->supported_modes.empty()) { | ||||
| @@ -1429,7 +1411,6 @@ void ListEntitiesNumberResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1447,7 +1428,6 @@ void ListEntitiesNumberResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1502,7 +1482,6 @@ void ListEntitiesSelectResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1519,7 +1498,6 @@ void ListEntitiesSelectResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1582,7 +1560,6 @@ void ListEntitiesSirenResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1601,7 +1578,6 @@ void ListEntitiesSirenResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1687,7 +1663,6 @@ void ListEntitiesLockResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1705,7 +1680,6 @@ void ListEntitiesLockResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1771,7 +1745,6 @@ void ListEntitiesButtonResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1786,7 +1759,6 @@ void ListEntitiesButtonResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -1866,7 +1838,6 @@ void ListEntitiesMediaPlayerResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -1884,7 +1855,6 @@ void ListEntitiesMediaPlayerResponse::calculate_size(uint32_t &total_size) const | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -2735,7 +2705,6 @@ void ListEntitiesAlarmControlPanelResponse::encode(ProtoWriteBuffer buffer) cons | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -2752,7 +2721,6 @@ void ListEntitiesAlarmControlPanelResponse::calculate_size(uint32_t &total_size) | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -2814,7 +2782,6 @@ void ListEntitiesTextResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -2832,7 +2799,6 @@ void ListEntitiesTextResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -2894,7 +2860,6 @@ void ListEntitiesDateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -2908,7 +2873,6 @@ void ListEntitiesDateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -2969,7 +2933,6 @@ void ListEntitiesTimeResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -2983,7 +2946,6 @@ void ListEntitiesTimeResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -3044,7 +3006,6 @@ void ListEntitiesEventResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -3062,7 +3023,6 @@ void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -3094,7 +3054,6 @@ void ListEntitiesValveResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -3112,7 +3071,6 @@ void ListEntitiesValveResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -3173,7 +3131,6 @@ void ListEntitiesDateTimeResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -3187,7 +3144,6 @@ void ListEntitiesDateTimeResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
| @@ -3238,7 +3194,6 @@ void ListEntitiesUpdateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->object_id); | ||||
|   buffer.encode_fixed32(2, this->key); | ||||
|   buffer.encode_string(3, this->name); | ||||
|   buffer.encode_string(4, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   buffer.encode_string(5, this->icon); | ||||
| #endif | ||||
| @@ -3253,7 +3208,6 @@ void ListEntitiesUpdateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->object_id); | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->unique_id); | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   ProtoSize::add_string_field(total_size, 1, this->icon); | ||||
| #endif | ||||
|   | ||||
| @@ -291,7 +291,6 @@ class InfoResponseProtoMessage : public ProtoMessage { | ||||
|   std::string object_id{}; | ||||
|   uint32_t key{0}; | ||||
|   std::string name{}; | ||||
|   std::string unique_id{}; | ||||
|   bool disabled_by_default{false}; | ||||
|   std::string icon{}; | ||||
|   enums::EntityCategory entity_category{}; | ||||
| @@ -587,7 +586,7 @@ class SubscribeStatesRequest : public ProtoMessage { | ||||
| class ListEntitiesBinarySensorResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 12; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 60; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 51; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_binary_sensor_response"; } | ||||
| #endif | ||||
| @@ -623,7 +622,7 @@ class BinarySensorStateResponse : public StateResponseProtoMessage { | ||||
| class ListEntitiesCoverResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 13; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 66; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 57; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_cover_response"; } | ||||
| #endif | ||||
| @@ -686,7 +685,7 @@ class CoverCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesFanResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 14; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 77; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 68; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_fan_response"; } | ||||
| #endif | ||||
| @@ -757,7 +756,7 @@ class FanCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesLightResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 15; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 90; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 81; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_light_response"; } | ||||
| #endif | ||||
| @@ -851,7 +850,7 @@ class LightCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesSensorResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 16; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 77; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 68; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_sensor_response"; } | ||||
| #endif | ||||
| @@ -891,7 +890,7 @@ class SensorStateResponse : public StateResponseProtoMessage { | ||||
| class ListEntitiesSwitchResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 17; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 60; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 51; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_switch_response"; } | ||||
| #endif | ||||
| @@ -942,7 +941,7 @@ class SwitchCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesTextSensorResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 18; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 58; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_text_sensor_response"; } | ||||
| #endif | ||||
| @@ -1241,7 +1240,7 @@ class ExecuteServiceRequest : public ProtoMessage { | ||||
| class ListEntitiesCameraResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 43; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 40; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_camera_response"; } | ||||
| #endif | ||||
| @@ -1291,7 +1290,7 @@ class CameraImageRequest : public ProtoMessage { | ||||
| class ListEntitiesClimateResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 46; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 156; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 147; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_climate_response"; } | ||||
| #endif | ||||
| @@ -1393,7 +1392,7 @@ class ClimateCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesNumberResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 49; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 84; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 75; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_number_response"; } | ||||
| #endif | ||||
| @@ -1449,7 +1448,7 @@ class NumberCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesSelectResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 52; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 67; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 58; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_select_response"; } | ||||
| #endif | ||||
| @@ -1501,7 +1500,7 @@ class SelectCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesSirenResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 55; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 71; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 62; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_siren_response"; } | ||||
| #endif | ||||
| @@ -1561,7 +1560,7 @@ class SirenCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesLockResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 58; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 64; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 55; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_lock_response"; } | ||||
| #endif | ||||
| @@ -1617,7 +1616,7 @@ class LockCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesButtonResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 61; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 58; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_button_response"; } | ||||
| #endif | ||||
| @@ -1667,7 +1666,7 @@ class MediaPlayerSupportedFormat : public ProtoMessage { | ||||
| class ListEntitiesMediaPlayerResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 63; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 85; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 76; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_media_player_response"; } | ||||
| #endif | ||||
| @@ -2481,7 +2480,7 @@ class VoiceAssistantSetConfiguration : public ProtoMessage { | ||||
| class ListEntitiesAlarmControlPanelResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 94; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 57; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 48; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_alarm_control_panel_response"; } | ||||
| #endif | ||||
| @@ -2535,7 +2534,7 @@ class AlarmControlPanelCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesTextResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 97; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 68; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 59; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_text_response"; } | ||||
| #endif | ||||
| @@ -2590,7 +2589,7 @@ class TextCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesDateResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 100; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 40; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_date_response"; } | ||||
| #endif | ||||
| @@ -2644,7 +2643,7 @@ class DateCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesTimeResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 103; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 40; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_time_response"; } | ||||
| #endif | ||||
| @@ -2698,7 +2697,7 @@ class TimeCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesEventResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 107; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 76; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 67; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_event_response"; } | ||||
| #endif | ||||
| @@ -2733,7 +2732,7 @@ class EventResponse : public StateResponseProtoMessage { | ||||
| class ListEntitiesValveResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 109; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 64; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 55; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_valve_response"; } | ||||
| #endif | ||||
| @@ -2789,7 +2788,7 @@ class ValveCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesDateTimeResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 112; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 40; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_date_time_response"; } | ||||
| #endif | ||||
| @@ -2839,7 +2838,7 @@ class DateTimeCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesUpdateResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 116; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 58; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 49; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_update_response"; } | ||||
| #endif | ||||
|   | ||||
| @@ -836,10 +836,6 @@ void ListEntitiesBinarySensorResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  device_class: "); | ||||
|   out.append("'").append(this->device_class).append("'"); | ||||
|   out.append("\n"); | ||||
| @@ -911,10 +907,6 @@ void ListEntitiesCoverResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  assumed_state: "); | ||||
|   out.append(YESNO(this->assumed_state)); | ||||
|   out.append("\n"); | ||||
| @@ -1055,10 +1047,6 @@ void ListEntitiesFanResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  supports_oscillation: "); | ||||
|   out.append(YESNO(this->supports_oscillation)); | ||||
|   out.append("\n"); | ||||
| @@ -1228,10 +1216,6 @@ void ListEntitiesLightResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   for (const auto &it : this->supported_color_modes) { | ||||
|     out.append("  supported_color_modes: "); | ||||
|     out.append(proto_enum_to_string<enums::ColorMode>(it)); | ||||
| @@ -1511,10 +1495,6 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -1601,10 +1581,6 @@ void ListEntitiesSwitchResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -1690,10 +1666,6 @@ void ListEntitiesTextSensorResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -1998,10 +1970,6 @@ void ListEntitiesCameraResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  disabled_by_default: "); | ||||
|   out.append(YESNO(this->disabled_by_default)); | ||||
|   out.append("\n"); | ||||
| @@ -2077,10 +2045,6 @@ void ListEntitiesClimateResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  supports_current_temperature: "); | ||||
|   out.append(YESNO(this->supports_current_temperature)); | ||||
|   out.append("\n"); | ||||
| @@ -2397,10 +2361,6 @@ void ListEntitiesNumberResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -2508,10 +2468,6 @@ void ListEntitiesSelectResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -2599,10 +2555,6 @@ void ListEntitiesSirenResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -2727,10 +2679,6 @@ void ListEntitiesLockResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -2832,10 +2780,6 @@ void ListEntitiesButtonResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -2922,10 +2866,6 @@ void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -3791,10 +3731,6 @@ void ListEntitiesAlarmControlPanelResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -3889,10 +3825,6 @@ void ListEntitiesTextResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -3992,10 +3924,6 @@ void ListEntitiesDateResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -4099,10 +4027,6 @@ void ListEntitiesTimeResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -4206,10 +4130,6 @@ void ListEntitiesEventResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -4279,10 +4199,6 @@ void ListEntitiesValveResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -4390,10 +4306,6 @@ void ListEntitiesDateTimeResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
| @@ -4477,10 +4389,6 @@ void ListEntitiesUpdateResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unique_id: "); | ||||
|   out.append("'").append(this->unique_id).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_ENTITY_ICON | ||||
|   out.append("  icon: "); | ||||
|   out.append("'").append(this->icon).append("'"); | ||||
|   | ||||
| @@ -29,7 +29,6 @@ class IPAddressEthernetInfo : public PollingComponent, public text_sensor::TextS | ||||
|   } | ||||
|  | ||||
|   float get_setup_priority() const override { return setup_priority::ETHERNET; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-ethernetinfo"; } | ||||
|   void dump_config() override; | ||||
|   void add_ip_sensors(uint8_t index, text_sensor::TextSensor *s) { this->ip_sensors_[index] = s; } | ||||
|  | ||||
| @@ -52,7 +51,6 @@ class DNSAddressEthernetInfo : public PollingComponent, public text_sensor::Text | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::ETHERNET; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-ethernetinfo-dns"; } | ||||
|   void dump_config() override; | ||||
|  | ||||
|  protected: | ||||
| @@ -63,7 +61,6 @@ class MACAddressEthernetInfo : public Component, public text_sensor::TextSensor | ||||
|  public: | ||||
|   void setup() override { this->publish_state(ethernet::global_eth_component->get_eth_mac_address_pretty()); } | ||||
|   float get_setup_priority() const override { return setup_priority::ETHERNET; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-ethernetinfo-mac"; } | ||||
|   void dump_config() override; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -129,21 +129,16 @@ bool MQTTComponent::send_discovery_() { | ||||
|             root[MQTT_PAYLOAD_NOT_AVAILABLE] = this->availability_->payload_not_available; | ||||
|         } | ||||
|  | ||||
|         std::string unique_id = this->unique_id(); | ||||
|         const MQTTDiscoveryInfo &discovery_info = global_mqtt_client->get_discovery_info(); | ||||
|         if (!unique_id.empty()) { | ||||
|           root[MQTT_UNIQUE_ID] = unique_id; | ||||
|         if (discovery_info.unique_id_generator == MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR) { | ||||
|           char friendly_name_hash[9]; | ||||
|           sprintf(friendly_name_hash, "%08" PRIx32, fnv1_hash(this->friendly_name())); | ||||
|           friendly_name_hash[8] = 0;  // ensure the hash-string ends with null | ||||
|           root[MQTT_UNIQUE_ID] = get_mac_address() + "-" + this->component_type() + "-" + friendly_name_hash; | ||||
|         } else { | ||||
|           if (discovery_info.unique_id_generator == MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR) { | ||||
|             char friendly_name_hash[9]; | ||||
|             sprintf(friendly_name_hash, "%08" PRIx32, fnv1_hash(this->friendly_name())); | ||||
|             friendly_name_hash[8] = 0;  // ensure the hash-string ends with null | ||||
|             root[MQTT_UNIQUE_ID] = get_mac_address() + "-" + this->component_type() + "-" + friendly_name_hash; | ||||
|           } else { | ||||
|             // default to almost-unique ID. It's a hack but the only way to get that | ||||
|             // gorgeous device registry view. | ||||
|             root[MQTT_UNIQUE_ID] = "ESP" + this->component_type() + this->get_default_object_id_(); | ||||
|           } | ||||
|           // default to almost-unique ID. It's a hack but the only way to get that | ||||
|           // gorgeous device registry view. | ||||
|           root[MQTT_UNIQUE_ID] = "ESP" + this->component_type() + this->get_default_object_id_(); | ||||
|         } | ||||
|  | ||||
|         const std::string &node_name = App.get_name(); | ||||
| @@ -286,7 +281,6 @@ void MQTTComponent::call_dump_config() { | ||||
|   this->dump_config(); | ||||
| } | ||||
| void MQTTComponent::schedule_resend_state() { this->resend_state_ = true; } | ||||
| std::string MQTTComponent::unique_id() { return ""; } | ||||
| bool MQTTComponent::is_connected_() const { return global_mqtt_client->is_connected(); } | ||||
|  | ||||
| // Pull these properties from EntityBase if not overridden | ||||
|   | ||||
| @@ -164,13 +164,6 @@ class MQTTComponent : public Component { | ||||
|    */ | ||||
|   virtual const EntityBase *get_entity() const = 0; | ||||
|  | ||||
|   /** A unique ID for this MQTT component, empty for no unique id. See unique ID requirements: | ||||
|    * https://developers.home-assistant.io/docs/en/entity_registry_index.html#unique-id-requirements | ||||
|    * | ||||
|    * @return The unique id as a string. | ||||
|    */ | ||||
|   virtual std::string unique_id(); | ||||
|  | ||||
|   /// Get the friendly name of this MQTT component. | ||||
|   virtual std::string friendly_name() const; | ||||
|  | ||||
|   | ||||
| @@ -76,7 +76,6 @@ bool MQTTSensorComponent::publish_state(float value) { | ||||
|   int8_t accuracy = this->sensor_->get_accuracy_decimals(); | ||||
|   return this->publish(this->get_state_topic_(), value_accuracy_to_string(value, accuracy)); | ||||
| } | ||||
| std::string MQTTSensorComponent::unique_id() { return this->sensor_->unique_id(); } | ||||
|  | ||||
| }  // namespace mqtt | ||||
| }  // namespace esphome | ||||
|   | ||||
| @@ -46,7 +46,6 @@ class MQTTSensorComponent : public mqtt::MQTTComponent { | ||||
|   /// Override for MQTTComponent, returns "sensor". | ||||
|   std::string component_type() const override; | ||||
|   const EntityBase *get_entity() const override; | ||||
|   std::string unique_id() override; | ||||
|  | ||||
|   sensor::Sensor *sensor_; | ||||
|   optional<uint32_t> expire_after_;  // Override the expire after advertised to Home Assistant | ||||
|   | ||||
| @@ -40,7 +40,6 @@ bool MQTTTextSensor::send_initial_state() { | ||||
| } | ||||
| std::string MQTTTextSensor::component_type() const { return "sensor"; } | ||||
| const EntityBase *MQTTTextSensor::get_entity() const { return this->sensor_; } | ||||
| std::string MQTTTextSensor::unique_id() { return this->sensor_->unique_id(); } | ||||
|  | ||||
| }  // namespace mqtt | ||||
| }  // namespace esphome | ||||
|   | ||||
| @@ -28,7 +28,6 @@ class MQTTTextSensor : public mqtt::MQTTComponent { | ||||
|  protected: | ||||
|   std::string component_type() const override; | ||||
|   const EntityBase *get_entity() const override; | ||||
|   std::string unique_id() override; | ||||
|  | ||||
|   text_sensor::TextSensor *sensor_; | ||||
| }; | ||||
|   | ||||
| @@ -11,8 +11,6 @@ const std::string &OneWireDevice::get_address_name() { | ||||
|   return this->address_name_; | ||||
| } | ||||
|  | ||||
| std::string OneWireDevice::unique_id() { return "dallas-" + str_lower_case(format_hex(this->address_)); } | ||||
|  | ||||
| bool OneWireDevice::send_command_(uint8_t cmd) { | ||||
|   if (!this->bus_->select(this->address_)) | ||||
|     return false; | ||||
|   | ||||
| @@ -24,8 +24,6 @@ class OneWireDevice { | ||||
|   /// Helper to create (and cache) the name for this sensor. For example "0xfe0000031f1eaf29". | ||||
|   const std::string &get_address_name(); | ||||
|  | ||||
|   std::string unique_id(); | ||||
|  | ||||
|  protected: | ||||
|   uint64_t address_{0}; | ||||
|   OneWireBus *bus_{nullptr};  ///< pointer to OneWireBus instance | ||||
|   | ||||
| @@ -96,7 +96,6 @@ void Sensor::clear_filters() { | ||||
| } | ||||
| float Sensor::get_state() const { return this->state; } | ||||
| float Sensor::get_raw_state() const { return this->raw_state; } | ||||
| std::string Sensor::unique_id() { return ""; } | ||||
|  | ||||
| void Sensor::internal_send_state_to_frontend(float state) { | ||||
|   this->set_has_state(true); | ||||
|   | ||||
| @@ -28,9 +28,6 @@ namespace sensor { | ||||
|     if (!(obj)->get_icon().empty()) { \ | ||||
|       ESP_LOGCONFIG(TAG, "%s  Icon: '%s'", prefix, (obj)->get_icon().c_str()); \ | ||||
|     } \ | ||||
|     if (!(obj)->unique_id().empty()) { \ | ||||
|       ESP_LOGV(TAG, "%s  Unique ID: '%s'", prefix, (obj)->unique_id().c_str()); \ | ||||
|     } \ | ||||
|     if ((obj)->get_force_update()) { \ | ||||
|       ESP_LOGV(TAG, "%s  Force Update: YES", prefix); \ | ||||
|     } \ | ||||
| @@ -141,12 +138,6 @@ class Sensor : public EntityBase, public EntityBase_DeviceClass, public EntityBa | ||||
|    */ | ||||
|   float raw_state; | ||||
|  | ||||
|   /** Override this method to set the unique ID of this sensor. | ||||
|    * | ||||
|    * @deprecated Do not use for new sensors, a suitable unique ID is automatically generated (2023.4). | ||||
|    */ | ||||
|   virtual std::string unique_id(); | ||||
|  | ||||
|   void internal_send_state_to_frontend(float state); | ||||
|  | ||||
|  protected: | ||||
|   | ||||
| @@ -70,7 +70,5 @@ void TextSensor::internal_send_state_to_frontend(const std::string &state) { | ||||
|   this->callback_.call(state); | ||||
| } | ||||
|  | ||||
| std::string TextSensor::unique_id() { return ""; } | ||||
|  | ||||
| }  // namespace text_sensor | ||||
| }  // namespace esphome | ||||
|   | ||||
| @@ -20,9 +20,6 @@ namespace text_sensor { | ||||
|     if (!(obj)->get_icon().empty()) { \ | ||||
|       ESP_LOGCONFIG(TAG, "%s  Icon: '%s'", prefix, (obj)->get_icon().c_str()); \ | ||||
|     } \ | ||||
|     if (!(obj)->unique_id().empty()) { \ | ||||
|       ESP_LOGV(TAG, "%s  Unique ID: '%s'", prefix, (obj)->unique_id().c_str()); \ | ||||
|     } \ | ||||
|   } | ||||
|  | ||||
| #define SUB_TEXT_SENSOR(name) \ | ||||
| @@ -64,11 +61,6 @@ class TextSensor : public EntityBase, public EntityBase_DeviceClass { | ||||
|  | ||||
|   // ========== INTERNAL METHODS ========== | ||||
|   // (In most use cases you won't need these) | ||||
|   /** Override this method to set the unique ID of this sensor. | ||||
|    * | ||||
|    * @deprecated Do not use for new sensors, a suitable unique ID is automatically generated (2023.4). | ||||
|    */ | ||||
|   virtual std::string unique_id(); | ||||
|  | ||||
|   void internal_send_state_to_frontend(const std::string &state); | ||||
|  | ||||
|   | ||||
| @@ -27,7 +27,6 @@ void UptimeSecondsSensor::update() { | ||||
|   const float seconds = float(seconds_int) + (this->uptime_ % 1000ULL) / 1000.0f; | ||||
|   this->publish_state(seconds); | ||||
| } | ||||
| std::string UptimeSecondsSensor::unique_id() { return get_mac_address() + "-uptime"; } | ||||
| float UptimeSecondsSensor::get_setup_priority() const { return setup_priority::HARDWARE; } | ||||
| void UptimeSecondsSensor::dump_config() { | ||||
|   LOG_SENSOR("", "Uptime Sensor", this); | ||||
|   | ||||
| @@ -13,8 +13,6 @@ class UptimeSecondsSensor : public sensor::Sensor, public PollingComponent { | ||||
|  | ||||
|   float get_setup_priority() const override; | ||||
|  | ||||
|   std::string unique_id() override; | ||||
|  | ||||
|  protected: | ||||
|   uint64_t uptime_{0}; | ||||
| }; | ||||
|   | ||||
| @@ -17,7 +17,6 @@ void VersionTextSensor::setup() { | ||||
| } | ||||
| float VersionTextSensor::get_setup_priority() const { return setup_priority::DATA; } | ||||
| void VersionTextSensor::set_hide_timestamp(bool hide_timestamp) { this->hide_timestamp_ = hide_timestamp; } | ||||
| std::string VersionTextSensor::unique_id() { return get_mac_address() + "-version"; } | ||||
| void VersionTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Version Text Sensor", this); } | ||||
|  | ||||
| }  // namespace version | ||||
|   | ||||
| @@ -12,7 +12,6 @@ class VersionTextSensor : public text_sensor::TextSensor, public Component { | ||||
|   void setup() override; | ||||
|   void dump_config() override; | ||||
|   float get_setup_priority() const override; | ||||
|   std::string unique_id() override; | ||||
|  | ||||
|  protected: | ||||
|   bool hide_timestamp_{false}; | ||||
|   | ||||
| @@ -28,7 +28,6 @@ class IPAddressWiFiInfo : public PollingComponent, public text_sensor::TextSenso | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-ip"; } | ||||
|   void dump_config() override; | ||||
|   void add_ip_sensors(uint8_t index, text_sensor::TextSensor *s) { this->ip_sensors_[index] = s; } | ||||
|  | ||||
| @@ -51,7 +50,6 @@ class DNSAddressWifiInfo : public PollingComponent, public text_sensor::TextSens | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-dns"; } | ||||
|   void dump_config() override; | ||||
|  | ||||
|  protected: | ||||
| @@ -80,7 +78,6 @@ class ScanResultsWiFiInfo : public PollingComponent, public text_sensor::TextSen | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-scanresults"; } | ||||
|   void dump_config() override; | ||||
|  | ||||
|  protected: | ||||
| @@ -97,7 +94,6 @@ class SSIDWiFiInfo : public PollingComponent, public text_sensor::TextSensor { | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-ssid"; } | ||||
|   void dump_config() override; | ||||
|  | ||||
|  protected: | ||||
| @@ -116,7 +112,6 @@ class BSSIDWiFiInfo : public PollingComponent, public text_sensor::TextSensor { | ||||
|     } | ||||
|   } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-bssid"; } | ||||
|   void dump_config() override; | ||||
|  | ||||
|  protected: | ||||
| @@ -126,7 +121,6 @@ class BSSIDWiFiInfo : public PollingComponent, public text_sensor::TextSensor { | ||||
| class MacAddressWifiInfo : public Component, public text_sensor::TextSensor { | ||||
|  public: | ||||
|   void setup() override { this->publish_state(get_mac_address_pretty()); } | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifiinfo-macadr"; } | ||||
|   void dump_config() override; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,6 @@ class WiFiSignalSensor : public sensor::Sensor, public PollingComponent { | ||||
|   void update() override { this->publish_state(wifi::global_wifi_component->wifi_rssi()); } | ||||
|   void dump_config() override; | ||||
|  | ||||
|   std::string unique_id() override { return get_mac_address() + "-wifisignal"; } | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user