Use DeviceInfo in sma (#58521)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-10-27 13:19:07 +02:00 committed by GitHub
parent 6db7f73032
commit 3b7f620aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,18 +200,18 @@ class SMAsensor(CoordinatorEntity, SensorEntity):
)
@property
def device_info(self) -> DeviceInfo:
def device_info(self) -> DeviceInfo | None:
"""Return the device information."""
if not self._device_info:
return None
return {
"identifiers": {(DOMAIN, self._config_entry_unique_id)},
"name": self._device_info["name"],
"manufacturer": self._device_info["manufacturer"],
"model": self._device_info["type"],
"sw_version": self._device_info["sw_version"],
}
return DeviceInfo(
identifiers={(DOMAIN, self._config_entry_unique_id)},
manufacturer=self._device_info["manufacturer"],
model=self._device_info["type"],
name=self._device_info["name"],
sw_version=self._device_info["sw_version"],
)
@property
def entity_registry_enabled_default(self) -> bool: