mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Entity attributes cleanup in Tuya base entity (#57510)
This commit is contained in:
parent
71a3daa8ce
commit
580b5fb812
@ -14,10 +14,11 @@ from .const import DOMAIN, TUYA_HA_SIGNAL_UPDATE_ENTITY
|
|||||||
class TuyaHaEntity(Entity):
|
class TuyaHaEntity(Entity):
|
||||||
"""Tuya base device."""
|
"""Tuya base device."""
|
||||||
|
|
||||||
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None:
|
def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> None:
|
||||||
"""Init TuyaHaEntity."""
|
"""Init TuyaHaEntity."""
|
||||||
super().__init__()
|
self._attr_unique_id = f"tuya.{device.id}"
|
||||||
|
|
||||||
self.tuya_device = device
|
self.tuya_device = device
|
||||||
self.tuya_device_manager = device_manager
|
self.tuya_device_manager = device_manager
|
||||||
|
|
||||||
@ -28,16 +29,6 @@ class TuyaHaEntity(Entity):
|
|||||||
new_max - new_min
|
new_max - new_min
|
||||||
) + 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
|
@property
|
||||||
def name(self) -> str | None:
|
def name(self) -> str | None:
|
||||||
"""Return Tuya device name."""
|
"""Return Tuya device name."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user