فهرست منبع

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 3 ماه پیش
والد
کامیت
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
     @property
     def current_operation(self):
     def current_operation(self):
         """Return current operation ie. eco, electric, performance, ..."""
         """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)
         return self._operation_mode_dps.get_value(self._device)
 
 
     @property
     @property