Sfoglia il codice sorgente

switch: use specific exception to catch and log warnings

Jason Rumney 1 anno fa
parent
commit
12e33d812f
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  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",