Allow entity names to be set to None (#4607)

* Allow entity names to be set to None so they take on the device friendly_name automatically

* Use empty
This commit is contained in:
Jesse Hills
2023-03-27 11:49:09 +13:00
committed by GitHub
parent 56504692af
commit c2756d57d8
5 changed files with 67 additions and 24 deletions
+4
View File
@@ -21,6 +21,9 @@ class EntityBase {
const std::string &get_name() const;
void set_name(const std::string &name);
// Get whether this Entity has its own name or it should use the device friendly_name.
bool has_own_name() const { return this->has_own_name_; }
// Get the sanitized name of this Entity as an ID. Caching it internally.
const std::string &get_object_id();
@@ -52,6 +55,7 @@ class EntityBase {
void calc_object_id_();
std::string name_;
bool has_own_name_{false};
std::string object_id_;
const char *icon_c_str_{nullptr};
uint32_t object_id_hash_;