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 @property
def device_info(self) -> DeviceInfo: def device_info(self) -> DeviceInfo | None:
"""Return the device information.""" """Return the device information."""
if not self._device_info: if not self._device_info:
return None return None
return { return DeviceInfo(
"identifiers": {(DOMAIN, self._config_entry_unique_id)}, identifiers={(DOMAIN, self._config_entry_unique_id)},
"name": self._device_info["name"], manufacturer=self._device_info["manufacturer"],
"manufacturer": self._device_info["manufacturer"], model=self._device_info["type"],
"model": self._device_info["type"], name=self._device_info["name"],
"sw_version": self._device_info["sw_version"], sw_version=self._device_info["sw_version"],
} )
@property @property
def entity_registry_enabled_default(self) -> bool: def entity_registry_enabled_default(self) -> bool: