diff --git a/homeassistant/components/esphome/sensor.py b/homeassistant/components/esphome/sensor.py index 68a8c00caed..ad23afd4744 100644 --- a/homeassistant/components/esphome/sensor.py +++ b/homeassistant/components/esphome/sensor.py @@ -52,7 +52,7 @@ class EsphomeSensor(EsphomeEntity): @property def icon(self) -> str: """Return the icon.""" - if self._static_info.icon == "": + if not self._static_info.icon or self._static_info.device_class: return None return self._static_info.icon @@ -73,14 +73,14 @@ class EsphomeSensor(EsphomeEntity): @property def unit_of_measurement(self) -> str: """Return the unit the value is expressed in.""" - if self._static_info.unit_of_measurement == "": + if not self._static_info.unit_of_measurement: return None return self._static_info.unit_of_measurement @property def device_class(self) -> str: """Return the class of this device, from component DEVICE_CLASSES.""" - if self._static_info.device_class == "": + if not self._static_info.device_class: return None return self._static_info.device_class