Преглед на файлове

fix (water_heater): handle missing dp in current_operation

When operation_mode is not supported, current_operation should return None,
but previous code was causing an exception by dereferencing the missing
dp.

Issue #4231
Jason Rumney преди 1 месец
родител
ревизия
21e3e9ae1f
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      custom_components/tuya_local/water_heater.py

+ 2 - 0
custom_components/tuya_local/water_heater.py

@@ -123,6 +123,8 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
     @property
     def current_operation(self):
         """Return current operation ie. eco, electric, performance, ..."""
+        if self._operation_mode_dps is None:
+            return None
         return self._operation_mode_dps.get_value(self._device)
 
     @property