소스 검색

fix (time): ensure time components are integers

Some devices may represent values as enum type, which comes through as a string
Ensure proper conversion of values.

Discussion #3565
Jason Rumney 4 달 전
부모
커밋
2b8aaa6396
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      custom_components/tuya_local/time.py

+ 1 - 1
custom_components/tuya_local/time.py

@@ -70,7 +70,7 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
         hours = hours or 0
         hours = hours or 0
         minutes = minutes or 0
         minutes = minutes or 0
         seconds = seconds or 0
         seconds = seconds or 0
-        delta = timedelta(hours=hours, minutes=minutes, seconds=seconds)
+        delta = timedelta(hours=int(hours), minutes=int(minutes), seconds=int(seconds))
         return (MIDNIGHT + delta).time()
         return (MIDNIGHT + delta).time()
 
 
     async def async_set_value(self, value: time):
     async def async_set_value(self, value: time):