From 6dd7251c84a8ff2b4e8a94a987b4a1da4f6df73a Mon Sep 17 00:00:00 2001 From: "Jokob @NetAlertX" <96159884+jokob-sk@users.noreply.github.com> Date: Tue, 4 Nov 2025 07:06:19 +0000 Subject: [PATCH] BE/PLG: TZ timestamp work #1251 --- server/scan/device_handling.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/scan/device_handling.py b/server/scan/device_handling.py index 08686885..c213698e 100755 --- a/server/scan/device_handling.py +++ b/server/scan/device_handling.py @@ -532,6 +532,16 @@ def update_devices_names(pm): # Retrieve last time name resolution was checked last_checked = pm.name_plugins_checked + # Normalize last_checked to datetime if it's a string + if isinstance(last_checked, str): + try: + last_checked = parser.parse(last_checked) + except Exception as e: + mylog('none', f'[Update Device Name] Could not parse last_checked timestamp: {last_checked!r} ({e})') + last_checked = None + elif not isinstance(last_checked, datetime.datetime): + last_checked = None + # Collect and normalize valid state update timestamps for name-related plugins state_times = [] latest_state = None