Răsfoiți Sursa

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 ani în urmă
părinte
comite
3275beb2ae
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  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),