瀏覽代碼

light: supported_color_modes shoud return a set not a list.

This is now enforced in HA 2024.2.

Issue #1631 (simplified version of PR #1633)
Jason Rumney 2 年之前
父節點
當前提交
5bafe7665e
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      custom_components/tuya_local/light.py

+ 4 - 4
custom_components/tuya_local/light.py

@@ -68,16 +68,16 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
     def supported_color_modes(self):
         """Return the supported color modes for this light."""
         if self._color_mode_dps:
-            return [
+            return {
                 ColorMode(mode)
                 for mode in self._color_mode_dps.values(self._device)
                 if mode and hasattr(ColorMode, mode.upper())
-            ]
+            }
         else:
             try:
                 mode = ColorMode(self.color_mode)
                 if mode and mode != ColorMode.UNKNOWN:
-                    return [mode]
+                    return {mode}
             except ValueError:
                 _LOGGER.warning(
                     "%s/%s: Unrecognised color mode %s ignored",
@@ -85,7 +85,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                     self.name or "light",
                     self.color_mode,
                 )
-        return []
+        return set()
 
     @property
     def supported_features(self):