Просмотр исходного кода

fix: wrap filter() with list() in water_heater operation_list (#5216)

* fix: wrap filter() with list() in water_heater operation_list

filter() returns a lazy iterator object, which is not JSON-serializable.
This causes Home Assistant to fail when serializing capability_attributes
for water heater entities with operation modes.

Regression introduced in 2026.6.0.

Fixes #5215

* Reformatting to satisfy lint

---------

Co-authored-by: toller892 <toller892@gmail.com>
Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Tony 1 месяц назад
Родитель
Сommit
7b418f10ad
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      custom_components/tuya_local/water_heater.py

+ 4 - 2
custom_components/tuya_local/water_heater.py

@@ -136,8 +136,10 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         if self._operation_mode_dps is None:
             return []
         else:
-            return filter(
-                lambda x: x != "away", self._operation_mode_dps.values(self._device)
+            return list(
+                filter(
+                    lambda x: x != "away", self._operation_mode_dps.values(self._device)
+                )
             )
 
     @property