1
mirror of https://github.com/home-assistant/core synced 2024-07-30 21:18:57 +02:00

Entity attributes cleanup in Tuya base entity (#57510)

This commit is contained in:
Franck Nijhof 2021-10-12 05:37:18 +02:00 committed by GitHub
parent 71a3daa8ce
commit 580b5fb812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,11 @@ from .const import DOMAIN, TUYA_HA_SIGNAL_UPDATE_ENTITY
class TuyaHaEntity(Entity):
"""Tuya base device."""
_attr_should_poll = False
def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None:
"""Init TuyaHaEntity."""
super().__init__()
self._attr_unique_id = f"tuya.{device.id}"
self.tuya_device = device
self.tuya_device_manager = device_manager
@ -28,16 +29,6 @@ class TuyaHaEntity(Entity):
new_max - new_min
) + new_min
@property
def should_poll(self) -> bool:
"""Hass should not poll."""
return False
@property
def unique_id(self) -> str | None:
"""Return a unique ID."""
return f"tuya.{self.tuya_device.id}"
@property
def name(self) -> str | None:
"""Return Tuya device name."""