Forráskód Böngészése

Update device_config.py to take on suggestion of mask.bit_count()

BevDan 8 hónapja
szülő
commit
1b8583eb74
1 módosított fájl, 1 hozzáadás és 1 törlés
  1. 1 1
      custom_components/tuya_local/helpers/device_config.py

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

@@ -485,7 +485,7 @@ class TuyaDpsConfig:
             # Insert signed interpretation here
             if self._config.get("mask_signed", False):
             # Count how many bits are set in the mask
-                bit_count = bin(mask).count("1")
+                bit_count = mask.bit_count()
                 raw_result = to_signed(raw_result, bit_count)
     
             return self._map_from_dps(raw_result, device)