From f9a070e9b36b552abbd118d5e4ce01155ad546df Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:33:53 +0100 Subject: [PATCH] Use common options attribute in Tuya event wrapper (#159119) --- homeassistant/components/tuya/event.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/tuya/event.py b/homeassistant/components/tuya/event.py index e9710953863..701ee1c7840 100644 --- a/homeassistant/components/tuya/event.py +++ b/homeassistant/components/tuya/event.py @@ -31,10 +31,12 @@ from .models import ( class _DPCodeEventWrapper(DPCodeTypeInformationWrapper): """Base class for Tuya event wrappers.""" - @property - def event_types(self) -> list[str]: - """Return the event types for the DP code.""" - return ["triggered"] + options: list[str] + + def __init__(self, dpcode: str, type_information: Any) -> None: + """Init _DPCodeEventWrapper.""" + super().__init__(dpcode, type_information) + self.options = ["triggered"] def get_event_type( self, device: CustomerDevice, updated_status_properties: list[str] | None @@ -55,11 +57,6 @@ class _DPCodeEventWrapper(DPCodeTypeInformationWrapper): class _EventEnumWrapper(DPCodeEnumWrapper, _DPCodeEventWrapper): """Wrapper for event enum DP codes.""" - @property - def event_types(self) -> list[str]: - """Return the event types for the enum.""" - return self.options - def get_event_type( self, device: CustomerDevice, updated_status_properties: list[str] | None ) -> str | None: @@ -232,7 +229,7 @@ class TuyaEventEntity(TuyaEntity, EventEntity): self.entity_description = description self._attr_unique_id = f"{super().unique_id}{description.key}" self._dpcode_wrapper = dpcode_wrapper - self._attr_event_types = dpcode_wrapper.event_types + self._attr_event_types = dpcode_wrapper.options async def _handle_state_update( self,