Skip to content
Snippets Groups Projects
Unverified Commit 107bd11a authored by epenet's avatar epenet Committed by GitHub
Browse files

Use DeviceInfo in wemo (#58638)

parent 37930aee
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ from homeassistant.components.light import (
from homeassistant.core import callback
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo
import homeassistant.util.color as color_util
from .const import DOMAIN as WEMO_DOMAIN
......@@ -99,15 +100,15 @@ class WemoLight(WemoEntity, LightEntity):
return self.light.uniqueID
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return {
"name": self.name,
"connections": {(CONNECTION_ZIGBEE, self._unique_id)},
"identifiers": {(WEMO_DOMAIN, self._unique_id)},
"model": self._model_name,
"manufacturer": "Belkin",
}
return DeviceInfo(
connections={(CONNECTION_ZIGBEE, self._unique_id)},
identifiers={(WEMO_DOMAIN, self._unique_id)},
manufacturer="Belkin",
model=self._model_name,
name=self.name,
)
@property
def brightness(self):
......
......@@ -17,6 +17,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import async_get as async_get_device_registry
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import DOMAIN, WEMO_SUBSCRIPTION_EVENT
......@@ -120,13 +121,13 @@ class DeviceCoordinator(DataUpdateCoordinator):
raise UpdateFailed("WeMo update failed") from err
def _device_info(wemo: WeMoDevice):
return {
"name": wemo.name,
"identifiers": {(DOMAIN, wemo.serialnumber)},
"model": wemo.model_name,
"manufacturer": "Belkin",
}
def _device_info(wemo: WeMoDevice) -> DeviceInfo:
return DeviceInfo(
identifiers={(DOMAIN, wemo.serialnumber)},
manufacturer="Belkin",
model=wemo.model_name,
name=wemo.name,
)
async def async_register_device(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment