From 3b7f620aad4f335d1c7d63e8747686acadf6a884 Mon Sep 17 00:00:00 2001
From: epenet <6771947+epenet@users.noreply.github.com>
Date: Wed, 27 Oct 2021 13:19:07 +0200
Subject: [PATCH] Use DeviceInfo in sma (#58521)

Co-authored-by: epenet <epenet@users.noreply.github.com>
---
 homeassistant/components/sma/sensor.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/homeassistant/components/sma/sensor.py b/homeassistant/components/sma/sensor.py
index 922ec9f9212..853edee823c 100644
--- a/homeassistant/components/sma/sensor.py
+++ b/homeassistant/components/sma/sensor.py
@@ -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:
-- 
GitLab