From 8925f5cc4582787b3db747f5abf06152f5b03596 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 29 Oct 2021 00:19:25 +0200 Subject: [PATCH] Use DeviceInfo in wiffi (#58639) --- homeassistant/components/wiffi/__init__.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/wiffi/__init__.py b/homeassistant/components/wiffi/__init__.py index 5f87141e423..05b86c209a6 100644 --- a/homeassistant/components/wiffi/__init__.py +++ b/homeassistant/components/wiffi/__init__.py @@ -14,7 +14,7 @@ from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, async_dispatcher_send, ) -from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.event import async_track_time_interval from homeassistant.util.dt import utcnow @@ -141,16 +141,14 @@ class WiffiEntity(Entity): def __init__(self, device, metric, options): """Initialize the base elements of a wiffi entity.""" self._id = generate_unique_id(device, metric) - self._device_info = { - "connections": { - (device_registry.CONNECTION_NETWORK_MAC, device.mac_address) - }, - "identifiers": {(DOMAIN, device.mac_address)}, - "manufacturer": "stall.biz", - "name": f"{device.moduletype} {device.mac_address}", - "model": device.moduletype, - "sw_version": device.sw_version, - } + self._device_info = DeviceInfo( + connections={(device_registry.CONNECTION_NETWORK_MAC, device.mac_address)}, + identifiers={(DOMAIN, device.mac_address)}, + manufacturer="stall.biz", + model=device.moduletype, + name=f"{device.moduletype} {device.mac_address}", + sw_version=device.sw_version, + ) self._name = metric.description self._expiration_date = None self._value = None