🔌 Omada work #708
This commit is contained in:
@@ -473,6 +473,7 @@ class DB():
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# indicates, if CurrentScan table is available
|
# indicates, if CurrentScan table is available
|
||||||
|
# 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes
|
||||||
self.sql.execute("DROP TABLE IF EXISTS CurrentScan;")
|
self.sql.execute("DROP TABLE IF EXISTS CurrentScan;")
|
||||||
self.sql.execute(""" CREATE TABLE IF NOT EXISTS CurrentScan (
|
self.sql.execute(""" CREATE TABLE IF NOT EXISTS CurrentScan (
|
||||||
cur_MAC STRING(50) NOT NULL COLLATE NOCASE,
|
cur_MAC STRING(50) NOT NULL COLLATE NOCASE,
|
||||||
|
|||||||
@@ -283,14 +283,14 @@ def update_devices_data_from_scan (db):
|
|||||||
SET dev_Vendor = (
|
SET dev_Vendor = (
|
||||||
SELECT cur_Vendor
|
SELECT cur_Vendor
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
(dev_Vendor IS NULL OR dev_Vendor IN ("", "null"))
|
(dev_Vendor IS NULL OR dev_Vendor IN ("", "null"))
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)""")
|
)""")
|
||||||
|
|
||||||
# Update only devices with empty or NULL dev_Network_Node_port
|
# Update only devices with empty or NULL dev_Network_Node_port
|
||||||
@@ -299,6 +299,7 @@ def update_devices_data_from_scan (db):
|
|||||||
SET dev_Network_Node_port = (
|
SET dev_Network_Node_port = (
|
||||||
SELECT cur_Port
|
SELECT cur_Port
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)
|
)
|
||||||
WHERE EXISTS (
|
WHERE EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
@@ -328,14 +329,14 @@ def update_devices_data_from_scan (db):
|
|||||||
SET dev_NetworkSite = (
|
SET dev_NetworkSite = (
|
||||||
SELECT cur_NetworkSite
|
SELECT cur_NetworkSite
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
(dev_NetworkSite IS NULL OR dev_NetworkSite IN ("", "null"))
|
(dev_NetworkSite IS NULL OR dev_NetworkSite IN ("", "null"))
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
AND CurrentScan.cur_NetworkSite IS NOT NULL AND CurrentScan.cur_NetworkSite NOT IN ("", "null")
|
AND CurrentScan.cur_NetworkSite IS NOT NULL AND CurrentScan.cur_NetworkSite NOT IN ("", "null")
|
||||||
)""")
|
)""")
|
||||||
|
|
||||||
@@ -345,14 +346,14 @@ def update_devices_data_from_scan (db):
|
|||||||
SET dev_SSID = (
|
SET dev_SSID = (
|
||||||
SELECT cur_SSID
|
SELECT cur_SSID
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
(dev_SSID IS NULL OR dev_SSID IN ("", "null"))
|
(dev_SSID IS NULL OR dev_SSID IN ("", "null"))
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
AND CurrentScan.cur_SSID IS NOT NULL AND CurrentScan.cur_SSID NOT IN ("", "null")
|
AND CurrentScan.cur_SSID IS NOT NULL AND CurrentScan.cur_SSID NOT IN ("", "null")
|
||||||
)""")
|
)""")
|
||||||
|
|
||||||
@@ -362,14 +363,14 @@ def update_devices_data_from_scan (db):
|
|||||||
SET dev_DeviceType = (
|
SET dev_DeviceType = (
|
||||||
SELECT cur_Type
|
SELECT cur_Type
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
(dev_DeviceType IS NULL OR dev_DeviceType IN ("", "null"))
|
(dev_DeviceType IS NULL OR dev_DeviceType IN ("", "null"))
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM CurrentScan
|
FROM CurrentScan
|
||||||
WHERE dev_MAC = cur_MAC
|
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||||
AND CurrentScan.cur_Type IS NOT NULL AND CurrentScan.cur_Type NOT IN ("", "null")
|
AND CurrentScan.cur_Type IS NOT NULL AND CurrentScan.cur_Type NOT IN ("", "null")
|
||||||
)""")
|
)""")
|
||||||
|
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ def setting_value_to_python_type(set_type, set_value):
|
|||||||
elif set_type in ['integer.select', 'integer']:
|
elif set_type in ['integer.select', 'integer']:
|
||||||
value = int(set_value)
|
value = int(set_value)
|
||||||
# belwo covers 'text.multiselect', 'list', 'subnets', 'list.select', 'list'
|
# belwo covers 'text.multiselect', 'list', 'subnets', 'list.select', 'list'
|
||||||
elif set_type in ['subnets' ] or 'list' in set_type:
|
elif set_type in ['subnets', 'text.multiselect' ] or 'list' in set_type:
|
||||||
|
|
||||||
mylog('debug', [f'[SETTINGS] Handling set_type: "{set_type}", set_value: "{set_value}"'])
|
mylog('debug', [f'[SETTINGS] Handling set_type: "{set_type}", set_value: "{set_value}"'])
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ def process_scan (db):
|
|||||||
skip_repeated_notifications (db)
|
skip_repeated_notifications (db)
|
||||||
|
|
||||||
# Clear current scan as processed
|
# Clear current scan as processed
|
||||||
# TODO comment below for CurrentScan debugging
|
# 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes
|
||||||
db.sql.execute ("DELETE FROM CurrentScan")
|
db.sql.execute ("DELETE FROM CurrentScan")
|
||||||
|
|
||||||
# Commit changes
|
# Commit changes
|
||||||
|
|||||||
Reference in New Issue
Block a user