1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 06:12:20 +01:00

Clean-up string sanitation helpers (#2660)

This commit is contained in:
Oxan van Leeuwen
2021-11-10 19:42:41 +01:00
committed by GitHub
parent 92321e219a
commit 4d43396835
4 changed files with 37 additions and 44 deletions

View File

@@ -35,7 +35,7 @@ const std::string &EntityBase::get_object_id() { return this->object_id_; }
// Calculate Object ID Hash from Entity Name
void EntityBase::calc_object_id_() {
this->object_id_ = sanitize_string_allowlist(to_lowercase_underscore(this->name_), HOSTNAME_CHARACTER_ALLOWLIST);
this->object_id_ = str_sanitize(str_snake_case(this->name_));
// FNV-1 hash
this->object_id_hash_ = fnv1_hash(this->object_id_);
}