Просмотр исходного кода

switch: use specific exception to catch and log warnings

Jason Rumney 2 лет назад
Родитель
Сommit
12e33d812f
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/switch.py

+ 1 - 1
custom_components/tuya_local/switch.py

@@ -45,7 +45,7 @@ class TuyaLocalSwitch(TuyaLocalEntity, SwitchEntity):
         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",