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

Avoid error when decoding hex for a value that is not available.

Jason Rumney 3 лет назад
Родитель
Сommit
66861b7285
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/helpers/device_config.py

+ 1 - 1
custom_components/tuya_local/helpers/device_config.py

@@ -326,7 +326,7 @@ class TuyaDpsConfig:
 
     def decoded_value(self, device):
         v = self.get_value(device)
-        if self.rawtype == "hex":
+        if self.rawtype == "hex" and isinstance(v, str):
             return bytes.fromhex(v)
         elif self.rawtype == "base64":
             return b64decode(v)