diff --git a/homeassistant/components/soma/__init__.py b/homeassistant/components/soma/__init__.py index 09576f07e6b..a929bd24b25 100644 --- a/homeassistant/components/soma/__init__.py +++ b/homeassistant/components/soma/__init__.py @@ -108,6 +108,8 @@ def soma_api_call(api_call): class SomaEntity(Entity): """Representation of a generic Soma device.""" + _attr_has_entity_name = True + def __init__(self, device, api): """Initialize the Soma device.""" self.device = device @@ -127,11 +129,6 @@ class SomaEntity(Entity): """Return the unique id base on the id returned by pysoma API.""" return self.device["mac"] - @property - def name(self): - """Return the name of the device.""" - return self.device["name"] - @property def device_info(self) -> DeviceInfo: """Return device specific attributes. @@ -141,7 +138,7 @@ class SomaEntity(Entity): return DeviceInfo( identifiers={(DOMAIN, self.unique_id)}, manufacturer="Wazombi Labs", - name=self.name, + name=self.device["name"], ) def set_position(self, position: int) -> None: diff --git a/homeassistant/components/soma/cover.py b/homeassistant/components/soma/cover.py index 144c793ac57..26487756a44 100644 --- a/homeassistant/components/soma/cover.py +++ b/homeassistant/components/soma/cover.py @@ -43,6 +43,7 @@ async def async_setup_entry( class SomaTilt(SomaEntity, CoverEntity): """Representation of a Soma Tilt device.""" + _attr_name = None _attr_device_class = CoverDeviceClass.BLIND _attr_supported_features = ( CoverEntityFeature.OPEN_TILT @@ -118,6 +119,7 @@ class SomaTilt(SomaEntity, CoverEntity): class SomaShade(SomaEntity, CoverEntity): """Representation of a Soma Shade device.""" + _attr_name = None _attr_device_class = CoverDeviceClass.SHADE _attr_supported_features = ( CoverEntityFeature.OPEN diff --git a/homeassistant/components/soma/sensor.py b/homeassistant/components/soma/sensor.py index a53bcd26e83..6472f6934e0 100644 --- a/homeassistant/components/soma/sensor.py +++ b/homeassistant/components/soma/sensor.py @@ -34,11 +34,6 @@ class SomaSensor(SomaEntity, SensorEntity): _attr_device_class = SensorDeviceClass.BATTERY _attr_native_unit_of_measurement = PERCENTAGE - @property - def name(self): - """Return the name of the device.""" - return self.device["name"] + " battery level" - @property def native_value(self): """Return the state of the entity."""