This commit is contained in:
J. Nick Koston
2025-12-07 12:43:02 -06:00
parent d881e6055e
commit 475ce1f3fa
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -866,7 +866,7 @@ uint16_t APIConnection::try_send_text_info(EntityBase *entity, APIConnection *co
msg.mode = static_cast<enums::TextMode>(text->traits.get_mode());
msg.min_length = text->traits.get_min_length();
msg.max_length = text->traits.get_max_length();
msg.set_pattern(text->traits.get_pattern_c_str());
msg.set_pattern(text->traits.get_pattern_ref());
return fill_and_encode_entity_info(text, msg, ListEntitiesTextResponse::MESSAGE_TYPE, conn, remaining_size,
is_single);
}
+3
View File
@@ -2,6 +2,8 @@
#include <string>
#include "esphome/core/string_ref.h"
namespace esphome {
namespace text {
@@ -22,6 +24,7 @@ class TextTraits {
void set_pattern(const char *pattern) { this->pattern_ = pattern; }
std::string get_pattern() const { return std::string(this->pattern_); }
const char *get_pattern_c_str() const { return this->pattern_; }
StringRef get_pattern_ref() const { return StringRef(this->pattern_); }
// Set/get the frontend mode.
void set_mode(TextMode mode) { this->mode_ = mode; }