@@ -211,16 +211,17 @@ def giex_string_to_td(v: str) -> int:
211
211
return timedelta (hours = dt .hour , minutes = dt .minute , seconds = dt .second ).seconds
212
212
213
213
214
- def giex_string_to_ts (v : str ) -> int | None :
214
+ def giex_string_to_dt (v : str ) -> datetime | None :
215
215
"""Convert Giex String Duration datetime."""
216
216
dev_tz = timezone (timedelta (hours = 4 ))
217
217
dev_dt = datetime .now (dev_tz )
218
+
218
219
try :
219
220
dt = datetime .strptime (v , "%H:%M:%S" ).replace (tzinfo = dev_tz )
220
- dev_dt .replace (hour = dt .hour , minute = dt .minute , second = dt .second )
221
221
except ValueError :
222
222
return None # on initial start the device will return '--:--:--'
223
- return int (dev_dt .timestamp () + UNIX_EPOCH_TO_ZCL_EPOCH )
223
+ else :
224
+ return dev_dt .replace (hour = dt .hour , minute = dt .minute , second = dt .second )
224
225
225
226
226
227
gx02_base_quirk = (
@@ -273,7 +274,7 @@ def giex_string_to_ts(v: str) -> int | None:
273
274
dp_id = 101 ,
274
275
attribute_name = "irrigation_start_time" ,
275
276
type = t .CharacterString ,
276
- converter = lambda x : giex_string_to_ts (x ),
277
+ converter = lambda x : giex_string_to_dt (x ),
277
278
device_class = SensorDeviceClass .TIMESTAMP ,
278
279
translation_key = "irrigation_start_time" ,
279
280
fallback_name = "Irrigation start time" ,
@@ -282,7 +283,7 @@ def giex_string_to_ts(v: str) -> int | None:
282
283
dp_id = 102 ,
283
284
attribute_name = "irrigation_end_time" ,
284
285
type = t .CharacterString ,
285
- converter = lambda x : giex_string_to_ts (x ),
286
+ converter = lambda x : giex_string_to_dt (x ),
286
287
device_class = SensorDeviceClass .TIMESTAMP ,
287
288
translation_key = "irrigation_end_time" ,
288
289
fallback_name = "Irrigation end time" ,
0 commit comments