mirror of
https://github.com/esphome/esphome.git
synced 2025-07-31 07:36:35 +00:00
fixes
This commit is contained in:
parent
c120676d19
commit
d0511e118d
@ -56,10 +56,7 @@ class EntityBase {
|
|||||||
void set_icon(const char *icon);
|
void set_icon(const char *icon);
|
||||||
StringRef get_icon_ref() const {
|
StringRef get_icon_ref() const {
|
||||||
#ifdef USE_ENTITY_ICON
|
#ifdef USE_ENTITY_ICON
|
||||||
if (this->icon_c_str_ == nullptr) {
|
return this->icon_c_str_ == nullptr ? StringRef("") : StringRef(this->icon_c_str_);
|
||||||
return StringRef("");
|
|
||||||
}
|
|
||||||
return StringRef(this->icon_c_str_);
|
|
||||||
#else
|
#else
|
||||||
return StringRef("");
|
return StringRef("");
|
||||||
#endif
|
#endif
|
||||||
@ -117,10 +114,7 @@ class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
|||||||
void set_device_class(const char *device_class);
|
void set_device_class(const char *device_class);
|
||||||
/// Get the device class as StringRef
|
/// Get the device class as StringRef
|
||||||
StringRef get_device_class_ref() const {
|
StringRef get_device_class_ref() const {
|
||||||
if (this->device_class_ == nullptr) {
|
return this->device_class_ == nullptr ? StringRef("") : StringRef(this->device_class_);
|
||||||
return StringRef("");
|
|
||||||
}
|
|
||||||
return StringRef(this->device_class_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -135,10 +129,7 @@ class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
|
|||||||
void set_unit_of_measurement(const char *unit_of_measurement);
|
void set_unit_of_measurement(const char *unit_of_measurement);
|
||||||
/// Get the unit of measurement as StringRef
|
/// Get the unit of measurement as StringRef
|
||||||
StringRef get_unit_of_measurement_ref() const {
|
StringRef get_unit_of_measurement_ref() const {
|
||||||
if (this->unit_of_measurement_ == nullptr) {
|
return this->unit_of_measurement_ == nullptr ? StringRef("") : StringRef(this->unit_of_measurement_);
|
||||||
return StringRef("");
|
|
||||||
}
|
|
||||||
return StringRef(this->unit_of_measurement_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user