فهرست منبع

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),