From 286467c7f8a9184d02ec05f4f9ae10dded5a811f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:05:16 +0000 Subject: [PATCH] Adjust humidifier --- homeassistant/components/tuya/humidifier.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/homeassistant/components/tuya/humidifier.py b/homeassistant/components/tuya/humidifier.py index adf22bb4b63..f8f3a70c412 100644 --- a/homeassistant/components/tuya/humidifier.py +++ b/homeassistant/components/tuya/humidifier.py @@ -170,10 +170,20 @@ class TuyaHumidifierEntity(TuyaEntity, HumidifierEntity): def turn_on(self, **kwargs: Any) -> None: """Turn the device on.""" + if self._switch_dpcode is None: + raise ServiceValidationError( + translation_domain=DOMAIN, + translation_key="action_dpcode_not_found", + ) self._send_command([{"code": self._switch_dpcode, "value": True}]) def turn_off(self, **kwargs: Any) -> None: """Turn the device off.""" + if self._switch_dpcode is None: + raise ServiceValidationError( + translation_domain=DOMAIN, + translation_key="action_dpcode_not_found", + ) self._send_command([{"code": self._switch_dpcode, "value": False}]) def set_humidity(self, humidity: int) -> None: