From 12e33d812f084b1e45244f869c37cdaf00ef0396 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Sat, 9 Mar 2024 00:48:12 +0900 Subject: [PATCH] switch: use specific exception to catch and log warnings --- custom_components/tuya_local/switch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/tuya_local/switch.py b/custom_components/tuya_local/switch.py index 8750f5dc2a..667625e075 100644 --- a/custom_components/tuya_local/switch.py +++ b/custom_components/tuya_local/switch.py @@ -45,7 +45,7 @@ def device_class(self): dclass = self._config.device_class try: return SwitchDeviceClass(dclass) - except: + except ValueError: if dclass: _LOGGER.warning( "%s/%s: Unrecognised switch device class of %s ignored",