mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-07-25 23:18:06 -04:00
PLG: OMDSDNOPENAPI fix #1717
This commit is contained in:
@@ -20,6 +20,7 @@ __version__ = 0.1 # Initial version
|
||||
__version__ = 0.2 # Rephrased error messages, improved logging and code logic
|
||||
__version__ = 0.3 # Refactored data collection into a class, improved code clarity with comments
|
||||
__version__ = 0.4 # Fix for https://github.com/netalertx/NetAlertX/issues/1595 - Omada Controller versions >= 6.2.0.0 removed the v1 clients endpoint
|
||||
__version__ = 0.5 # Fix for https://github.com/netalertx/NetAlertX/issues/1717 - preventing None as IP
|
||||
|
||||
import os
|
||||
import sys
|
||||
@@ -168,6 +169,10 @@ class OmadaHelper:
|
||||
entry["ip_address"] = data.get("ip")
|
||||
entry["name"] = data.get("name")
|
||||
|
||||
# Preventing None as IP
|
||||
if entry["ip_address"] is None or entry["ip_address"] == "None":
|
||||
entry["ip_address"] = "null"
|
||||
|
||||
# Assign the last datetime the device/client was seen on the network
|
||||
last_seen = OmadaHelper.timestamp_to_datetime(data.get("lastSeen", 0), timezone)
|
||||
entry["last_seen"] = last_seen.get("response_result") if isinstance(last_seen, dict) and last_seen.get("response_type") == "success" else ""
|
||||
|
||||
Reference in New Issue
Block a user