FIX SNMDSCV, NMAPSRV, UNFIDSCR bugs

This commit is contained in:
Jokob-sk
2023-05-05 21:21:01 +10:00
parent c74ef127d1
commit b4b15af887
5 changed files with 31 additions and 8 deletions

View File

@@ -47,6 +47,11 @@
"name" : "port",
"type" : "setting",
"value" : "UNFIMP_port"
},
{
"name" : "version",
"type" : "setting",
"value" : "UNFIMP_version"
}
],
"database_column_definitions":
@@ -257,7 +262,7 @@
{
"function": "CMD",
"type": "text",
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port}",
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port} version={version}",
"options": [],
"localized": ["name", "description"],
"name" : [{
@@ -344,6 +349,21 @@
"string" : "The port number where the UNIFI controller is runnig. Usually it is <code>8443</code>."
}]
},
{
"function": "version",
"type": "text",
"default_value":"",
"options": [],
"localized": ["name", "description"],
"name" : [{
"language_code":"en_us",
"string" : "API version"
}],
"description": [{
"language_code":"en_us",
"string" : "The base version of the Unify controller API. Supported values as of time of writing are <code>v4|v5|unifiOS|UDMP-unifiOS</code>."
}]
},
{
"function": "sites",
"type": "list",

View File

@@ -32,7 +32,7 @@ def main():
# init global variables
global UNIFI_USERNAME, UNIFI_PASSWORD, UNIFI_HOST
global UNIFI_SITES, PORT, PROTOCOL
global UNIFI_SITES, PORT, PROTOCOL, VERSION
last_run_logfile = open(last_run, 'a')
@@ -47,6 +47,7 @@ def main():
parser.add_argument('sites', action="store", help="Name of the sites (usually 'default', check the URL in your UniFi controller UI). Separated by comma (,) if passing multiple sites")
parser.add_argument('protocol', action="store", help="https:// or http://")
parser.add_argument('port', action="store", help="Usually 8443")
parser.add_argument('version', action="store", help="The base version of the controller API [v4|v5|unifiOS|UDMP-unifiOS]")
values = parser.parse_args()
@@ -61,6 +62,7 @@ def main():
UNIFI_SITES = values.sites.split('=')[1]
PROTOCOL = values.protocol.split('=')[1]
PORT = values.port.split('=')[1]
VERSION = values.version.split('=')[1]
newEntries = get_entries(newEntries)
@@ -85,7 +87,7 @@ def get_entries(newEntries):
for site in sites:
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, ssl_verify=False, site_id=site )
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, version=VERSION, ssl_verify=False, site_id=site )
for ap in c.get_aps():