ソースを参照

fix(time): return None if all time components are None

Some devices do not return data for an unset timer, so we need to handle
the None case since timedelta does not handle it.

Discussion #3565
Jason Rumney 9 ヶ月 前
コミット
9cc07cab3e
1 ファイル変更2 行追加0 行削除
  1. 2 0
      custom_components/tuya_local/time.py

+ 2 - 0
custom_components/tuya_local/time.py

@@ -65,6 +65,8 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
             minutes = self._minute_dps.get_value(self._device)
         if self._second_dps:
             seconds = self._second_dps.get_value(self._device)
+        if hours is None and minutes is None and seconds is None:
+            return None
         delta = timedelta(hours=hours, minutes=minutes, seconds=seconds)
         return (MIDNIGHT + delta).time()