mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Tweaks to Tuya base entity (#57526)
This commit is contained in:
parent
d90d804260
commit
c943677675
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user