From c943677675b21fd2b79312592246d6f3c35c1edc Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 12 Oct 2021 12:25:03 +0200 Subject: [PATCH] Tweaks to Tuya base entity (#57526) --- homeassistant/components/tuya/base.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/tuya/base.py b/homeassistant/components/tuya/base.py index a8bb492f17b..0b2ca643e12 100644 --- a/homeassistant/components/tuya/base.py +++ b/homeassistant/components/tuya/base.py @@ -6,7 +6,7 @@ from typing import Any from tuya_iot import TuyaDevice, TuyaDeviceManager from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity import DeviceInfo, Entity from .const import DOMAIN, TUYA_HA_SIGNAL_UPDATE_ENTITY @@ -28,21 +28,21 @@ class TuyaHaEntity(Entity): return self.tuya_device.name @property - def device_info(self): + def device_info(self) -> DeviceInfo: """Return a device description for device registry.""" - return { - "identifiers": {(DOMAIN, f"{self.tuya_device.id}")}, - "manufacturer": "Tuya", - "name": self.tuya_device.name, - "model": self.tuya_device.product_name, - } + return DeviceInfo( + identifiers={(DOMAIN, self.tuya_device.id)}, + manufacturer="Tuya", + name=self.tuya_device.name, + model=self.tuya_device.product_name, + ) @property def available(self) -> bool: """Return if the device is available.""" return self.tuya_device.online - async def async_added_to_hass(self): + async def async_added_to_hass(self) -> None: """Call when entity is added to hass.""" self.async_on_remove( async_dispatcher_connect(