mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 17:18:40 +00:00
[api] Fix comment source references and add missing max_data_length
- Fix comment: NAME_MAX_LENGTH is in config_validation.py, not core/config.py - Add missing max_data_length=63 to unit_of_measurement in ListEntitiesNumberResponse
This commit is contained in:
@@ -308,11 +308,11 @@ enum EntityCategory {
|
||||
ENTITY_CATEGORY_DIAGNOSTIC = 2;
|
||||
}
|
||||
|
||||
// Entity field max_data_length values match constants in esphome/core/config.py:
|
||||
// name/object_id = 120 (NAME_MAX_LENGTH)
|
||||
// icon = 63 (ICON_MAX_LENGTH)
|
||||
// device_class = 47 (DEVICE_CLASS_MAX_LENGTH)
|
||||
// unit_of_measurement = 63 (UNIT_OF_MEASUREMENT_MAX_LENGTH)
|
||||
// Entity field max_data_length values match Python validation constants:
|
||||
// name/object_id = 120 (config_validation.NAME_MAX_LENGTH)
|
||||
// icon = 63 (core/config.ICON_MAX_LENGTH)
|
||||
// device_class = 47 (core/config.DEVICE_CLASS_MAX_LENGTH)
|
||||
// unit_of_measurement = 63 (core/config.UNIT_OF_MEASUREMENT_MAX_LENGTH)
|
||||
|
||||
// ==================== BINARY SENSOR ====================
|
||||
message ListEntitiesBinarySensorResponse {
|
||||
@@ -1260,7 +1260,7 @@ message ListEntitiesNumberResponse {
|
||||
float step = 8;
|
||||
bool disabled_by_default = 9;
|
||||
EntityCategory entity_category = 10;
|
||||
string unit_of_measurement = 11;
|
||||
string unit_of_measurement = 11 [(max_data_length) = 63];
|
||||
NumberMode mode = 12;
|
||||
string device_class = 13 [(max_data_length) = 47];
|
||||
uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"];
|
||||
|
||||
@@ -1705,7 +1705,7 @@ uint32_t ListEntitiesNumberResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_float(1, this->step);
|
||||
size += ProtoSize::calc_bool(1, this->disabled_by_default);
|
||||
size += ProtoSize::calc_uint32(1, static_cast<uint32_t>(this->entity_category));
|
||||
size += ProtoSize::calc_length(1, this->unit_of_measurement.size());
|
||||
size += !this->unit_of_measurement.empty() ? 2 + this->unit_of_measurement.size() : 0;
|
||||
size += ProtoSize::calc_uint32(1, static_cast<uint32_t>(this->mode));
|
||||
size += !this->device_class.empty() ? 2 + this->device_class.size() : 0;
|
||||
#ifdef USE_DEVICES
|
||||
|
||||
Reference in New Issue
Block a user