diff --git a/homeassistant/components/plaato/entity.py b/homeassistant/components/plaato/entity.py index 755ff8d2ae7..b7650567c2b 100644 --- a/homeassistant/components/plaato/entity.py +++ b/homeassistant/components/plaato/entity.py @@ -30,7 +30,18 @@ class PlaatoEntity(entity.Entity): self._device_id = data[DEVICE][DEVICE_ID] self._device_type = data[DEVICE][DEVICE_TYPE] self._device_name = data[DEVICE][DEVICE_NAME] - self._state = 0 + self._attr_unique_id = f"{self._device_id}_{self._sensor_type}" + self._attr_name = f"{DOMAIN} {self._device_type} {self._device_name} {self._sensor_name}".title() + sw_version = None + if firmware := self._sensor_data.firmware_version: + sw_version = firmware + self._attr_device_info = DeviceInfo( + identifiers={(DOMAIN, self._device_id)}, + manufacturer="Plaato", + model=self._device_type, + name=self._device_name, + sw_version=sw_version, + ) @property def _attributes(self) -> dict: @@ -46,28 +57,6 @@ class PlaatoEntity(entity.Entity): return self._coordinator.data return self._entry_data[SENSOR_DATA] - @property - def name(self): - """Return the name of the sensor.""" - return f"{DOMAIN} {self._device_type} {self._device_name} {self._sensor_name}".title() - - @property - def unique_id(self): - """Return the unique ID of this sensor.""" - return f"{self._device_id}_{self._sensor_type}" - - @property - def device_info(self) -> DeviceInfo: - """Get device info.""" - sw_version = self._sensor_data.firmware_version - return DeviceInfo( - identifiers={(DOMAIN, self._device_id)}, - manufacturer="Plaato", - model=self._device_type, - name=self._device_name, - sw_version=sw_version if sw_version != "" else None, - ) - @property def extra_state_attributes(self): """Return the state attributes of the monitored installation."""