Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
3275beb2ae
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  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),