Use DeviceInfo in wiffi (#58639)

pull/58655/head
epenet 2021-10-29 00:19:25 +02:00 committed by GitHub
parent 95f7b0c026
commit 8925f5cc45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -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