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

siren: values returns an empty list when there are no mappings

Code was expecting None, then raising an exception when there were
no items in the list to find the minimum of.

Issue #1219
Jason Rumney пре 2 година
родитељ
комит
3275beb2ae
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      custom_components/tuya_local/siren.py

+ 1 - 1
custom_components/tuya_local/siren.py

@@ -99,7 +99,7 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
             # In tuya it is likely an integer or a fixed list of values.
             # For integer, expect scale and step to do the conversion,
             # for fixed values, we need to snap to closest value.
-            if self._volume_dp.values(self._device) is not None:
+            if self._volume_dp.values(self._device):
                 volume = min(
                     self._volume_dp.values(self._device),
                     key=lambda x: abs(x - volume),