Fix wrong type bug.

This commit is contained in:
yohan 2024-06-06 13:12:33 +02:00
parent c43bf42666
commit 7c1c0a7377

View File

@ -161,7 +161,7 @@ def get_forced_mode(cursor):
if row is None:
return None
data = dict(zip(['value', 'timestamp'], row))
timestamp = data['timestamp'].replace(tzinfo=timezone.utc).timestamp()
timestamp = datetime.fromisoformat(data['timestamp']).replace(tzinfo=timezone.utc).timestamp()
# We ignore old targets but never ignore absence modes
if data['value'] in targets and time.time() - timestamp > forced_mode_duration:
logging.debug("Ignoring old set mode.")