Преглед изворни кода

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

BevDan пре 11 месеци
родитељ
комит
1b8583eb74
1 измењених фајлова са 1 додато и 1 уклоњено
  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)