Fix parsing of HOLD_TIME attribute which can be larger than 24h.

This commit is contained in:
Andrius Štikonas 2021-01-02 17:14:10 +00:00
parent bea16520f5
commit 65b9667d99
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2020 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-License-Identifier: LGPL-3.0-or-later
@ -39,8 +37,9 @@ class NeoStat(SimpleNamespace):
self.hold_off = self._data_.HOLD_OFF
self.hold_on = self._data_.HOLD_ON
self.hold_temp = self._data_.HOLD_TEMP
_hold_time = datetime.strptime(self._data_.HOLD_TIME, "%H:%M")
self.hold_time = timedelta(hours=_hold_time.hour, minutes=_hold_time.minute)
_hold_time = list(map(int, self._data_.HOLD_TIME.split(':'))) # HOLD_TIME can be up to 99:99
_hold_time_minutes = _hold_time[0] * 60 + _hold_time[1]
self.hold_time = timedelta(minutes=_hold_time_minutes)
self.holiday = self._data_.HOLIDAY
self.lock = self._data_.LOCK
self.low_battery = self._data_.LOW_BATTERY