Plugin:Speedtest v0.1
This commit is contained in:
@@ -9,7 +9,7 @@ ENV USER=pi USER_ID=1000 USER_GID=1000 PORT=20211
|
|||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute -y \
|
&& apt-get install --no-install-recommends tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip systemctl usbutils traceroute -y \
|
||||||
&& pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi \
|
&& pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli \
|
||||||
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
|
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
|
||||||
&& apt-get clean autoclean \
|
&& apt-get clean autoclean \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ _PiAlert combines several network and other scanning tools 🔍 with notificatio
|
|||||||
|
|
||||||
Setup a _kill switch ☠_ for your network via a smart plug with the available [Home Assistant](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/HOME_ASSISTANT.md) integration. Implement custom automations with the [CSV device Exports 📤](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/csv_backup), [Webhooks](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md), or [API endpoints](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md) features.
|
Setup a _kill switch ☠_ for your network via a smart plug with the available [Home Assistant](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/HOME_ASSISTANT.md) integration. Implement custom automations with the [CSV device Exports 📤](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/csv_backup), [Webhooks](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md), or [API endpoints](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md) features.
|
||||||
|
|
||||||
Extend the app if you want to create your own scanner and handle the results and notifications in PiAlert. Check available [Plugins & Instructions](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins). Looking forward to your contributions if you decide to share your work with the community ❤.
|
Extend the app if you want to create your own scanner and handle the results and notifications in PiAlert. Check available [Plugins & Instructions](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins).
|
||||||
|
|
||||||
|
Looking forward to your contributions if you decide to share your work with the community ❤.
|
||||||
|
|
||||||
| ![Main screen][main] | ![Screen 1][screen1] | ![Screen 5][screen5] |
|
| ![Main screen][main] | ![Screen 1][screen1] | ![Screen 5][screen5] |
|
||||||
|----------------------|----------------------| ----------------------|
|
|----------------------|----------------------| ----------------------|
|
||||||
|
|||||||
@@ -24,19 +24,20 @@
|
|||||||
| | | DHCPSRVS | Script | 📚[dhcp_servers](/front/plugins/dhcp_servers/) |
|
| | | DHCPSRVS | Script | 📚[dhcp_servers](/front/plugins/dhcp_servers/) |
|
||||||
| | Yes | INTRNT | Script | 📚[internet_ip](/front/plugins/internet_ip/) |
|
| | Yes | INTRNT | Script | 📚[internet_ip](/front/plugins/internet_ip/) |
|
||||||
| Yes | | NEWDEV | Template | 📚[newdev_template](/front/plugins/newdev_template/) |
|
| Yes | | NEWDEV | Template | 📚[newdev_template](/front/plugins/newdev_template/) |
|
||||||
|
| | | PHOLUS | Script | 📚[pholus_scan](/front/plugins/pholus_scan/) |
|
||||||
| | | NMAP | Script | 📚[nmap_scan](/front/plugins/nmap_scan/) |
|
| | | NMAP | Script | 📚[nmap_scan](/front/plugins/nmap_scan/) |
|
||||||
| | Yes | PIHOLE | External SQLite DB | 📚[pihole_scan](/front/plugins/pihole_scan/) |
|
| | Yes | PIHOLE | External SQLite DB | 📚[pihole_scan](/front/plugins/pihole_scan/) |
|
||||||
| | | SETPWD | Script | 📚[set_password](/front/plugins/set_password/) |
|
| | | SETPWD | Script | 📚[set_password](/front/plugins/set_password/) |
|
||||||
| | | SNMPDSC | Script | 📚[snmp_discovery](/front/plugins/snmp_discovery/) |
|
| | | SNMPDSC | Script | 📚[snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||||
| | Yes* | UNDIS | Script | 📚[undiscoverables](/front/plugins/undiscoverables/) |
|
| | Yes** | UNDIS | Script | 📚[undiscoverables](/front/plugins/undiscoverables/) |
|
||||||
| | Yes | UNFIMP | Script | 📚[unifi_import](/front/plugins/unifi_import/) |
|
| | Yes | UNFIMP | Script | 📚[unifi_import](/front/plugins/unifi_import/) |
|
||||||
| | | VNDRPDT | Script | 📚[vendor_update](/front/plugins/vendor_update/) |
|
| | | VNDRPDT | Script | 📚[vendor_update](/front/plugins/vendor_update/) |
|
||||||
| | | WEBMON | Script | 📚[website_monitor](/front/plugins/website_monitor/) |
|
| | | WEBMON | Script | 📚[website_monitor](/front/plugins/website_monitor/) |
|
||||||
| N/A | | N/A | SQL query | N/A, but the External SQLite DB plugins work similar |
|
| N/A | | N/A | SQL query | N/A, but the External SQLite DB plugins work similar |
|
||||||
|
|
||||||
> \* The Undiscoverables plugin (`UNDIS`) inserts only user-specified dummy devices.
|
|
||||||
>
|
|
||||||
> \* The database cleanup plugin (`DBCLNP`) is not _required_ but the app will become unusable after a while if not executed.
|
> \* The database cleanup plugin (`DBCLNP`) is not _required_ but the app will become unusable after a while if not executed.
|
||||||
|
> \** The Undiscoverables plugin (`UNDIS`) inserts only user-specified dummy devices.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> You soft-disable plugins via Settings or completely ignore plugins by placing a `ignore_plugin` file into the plugin directory. The difference is that ignored plugins don't show up anywhere in the UI (Settings, Device details, Plugins pages). The app skips ignored plugins completely. Device-detecting plugins insert values into the `CurrentScan` database table. The plugins that are not required are safe to ignore, however it makes sense to have a least some device-detecting plugins (that insert entries into the `CurrentScan` table) enabled, such as ARPSCAN or PIHOLE.
|
> You soft-disable plugins via Settings or completely ignore plugins by placing a `ignore_plugin` file into the plugin directory. The difference is that ignored plugins don't show up anywhere in the UI (Settings, Device details, Plugins pages). The app skips ignored plugins completely. Device-detecting plugins insert values into the `CurrentScan` database table. The plugins that are not required are safe to ignore, however it makes sense to have a least some device-detecting plugins (that insert entries into the `CurrentScan` table) enabled, such as ARPSCAN or PIHOLE.
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
{
|
{
|
||||||
"function": "RUN_SCHD",
|
"function": "RUN_SCHD",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"default_value":"*/3 * * * *",
|
"default_value":"*/5 * * * *",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": ["name", "description"],
|
||||||
"name" : [{
|
"name" : [{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
"function": "RUN",
|
"function": "RUN",
|
||||||
"events": ["run"],
|
"events": ["run"],
|
||||||
"type": "text.select",
|
"type": "text.select",
|
||||||
"default_value": "schedule",
|
"default_value": "disabled",
|
||||||
"options": [
|
"options": [
|
||||||
"disabled",
|
"disabled",
|
||||||
"once",
|
"once",
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
"description": [
|
"description": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#INTRNT_RUN\"><code>INTRNT_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#INTRNT_RUN\"><code>INTRNT_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes. It's recommended to use the same schedule interval for all plugins responsible for discovering new devices."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
|
|||||||
11
front/plugins/internet_speedtest/README.md
Executable file
11
front/plugins/internet_speedtest/README.md
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
## Overview
|
||||||
|
|
||||||
|
A simple plugin allowing for executing regular internet speed tests.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
- N/A
|
||||||
421
front/plugins/internet_speedtest/config.json
Executable file
421
front/plugins/internet_speedtest/config.json
Executable file
@@ -0,0 +1,421 @@
|
|||||||
|
{
|
||||||
|
"code_name": "internet_speedtest",
|
||||||
|
"unique_prefix": "INTRSPD",
|
||||||
|
"enabled": true,
|
||||||
|
"data_source": "script",
|
||||||
|
"show_ui": true,
|
||||||
|
"localized": ["display_name", "description", "icon"],
|
||||||
|
"display_name" : [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Internet speedtest"
|
||||||
|
}],
|
||||||
|
"icon":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "<i class=\"fa-solid fa-gauge-high\"></i>"
|
||||||
|
}],
|
||||||
|
"description": [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "A plugin to perform a scheduled internet speedtest."
|
||||||
|
}],
|
||||||
|
"params" : [],
|
||||||
|
"database_column_definitions":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"column": "Index",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Plugin",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Object_PrimaryID",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "url",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Object_SecondaryID",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "DateTimeCreated",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": true,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Test run on"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "DateTimeChanged",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Changed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Cambiado"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Watched_Value1",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": true,
|
||||||
|
"type": "threshold",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"maximum": 1,
|
||||||
|
"hexColor": "#D33115"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 5,
|
||||||
|
"hexColor": "#792D86"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10,
|
||||||
|
"hexColor": "#7D862D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 100,
|
||||||
|
"hexColor": "#05483C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Download"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Watched_Value2",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": true,
|
||||||
|
"type": "threshold",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"maximum": 1,
|
||||||
|
"hexColor": "#D33115"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 5,
|
||||||
|
"hexColor": "#792D86"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 10,
|
||||||
|
"hexColor": "#7D862D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximum": 100,
|
||||||
|
"hexColor": "#05483C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Upload"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Watched_Value3",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Watched_Value4",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "N/A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "N/A"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "UserData",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "textbox_save",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Comentarios"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Status",
|
||||||
|
"css_classes": "col-sm-1",
|
||||||
|
"show": false,
|
||||||
|
"type": "replace",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"equals": "watched-not-changed",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "watched-changed",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "new",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "missing-in-last-scan",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Estado"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Extra",
|
||||||
|
"css_classes": "col-sm-3",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value":"",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name"],
|
||||||
|
"name":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Extra"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Extra"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings":[
|
||||||
|
{
|
||||||
|
"function": "RUN",
|
||||||
|
"events": ["run"],
|
||||||
|
"type": "text.select",
|
||||||
|
"default_value":"disabled",
|
||||||
|
"options": ["disabled", "once", "schedule", "always_after_scan" ],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" :[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "When to run"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Cuando ejecuta"
|
||||||
|
}],
|
||||||
|
"description": [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Enable a regular scan of your services. If you select <code>schedule</code> the scheduling settings from below are applied. If you select <code>once</code> the scan is run only once on start of the application (container) for the time specified in <a href=\"#INTRSPD_RUN_TIMEOUT\"><code>INTRSPD_RUN_TIMEOUT</code> setting</a>."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Habilite un escaneo regular de sus servicios. Si selecciona <code>schedule</code>, se aplican las configuraciones de programación de abajo. Si selecciona <code>once</code>, el escaneo se ejecuta solo una vez al iniciar la aplicación (contenedor) durante el tiempo especificado en <a href=\"#INTRSPD_RUN_TIMEOUT\"><code>INTRSPD_RUN_TIMEOUT</code> configuración</a>."
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "CMD",
|
||||||
|
"type": "readonly",
|
||||||
|
"default_value":"python3 /home/pi/pialert/front/plugins/internet_speedtest/script.py",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" : [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Command"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Comando"
|
||||||
|
}],
|
||||||
|
"description": [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Command to run"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Comando a ejecutar"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "RUN_SCHD",
|
||||||
|
"type": "text",
|
||||||
|
"default_value":"*/30 * * * *",
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" : [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Schedule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Schedule"
|
||||||
|
}],
|
||||||
|
"description": [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#INTRSPD_RUN\"><code>INTRSPD_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Solo habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#INTRSPD_RUN\"><code>INTRSPD_RUN</code></a>. Asegúrese de ingresar el schedule en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingrese <code >0 4 * * *</code> ejecutará el escaneo después de las 4 am en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> que configuró arriba </a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "RUN_TIMEOUT",
|
||||||
|
"type": "integer",
|
||||||
|
"default_value":60,
|
||||||
|
"options": [],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" : [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Run timeout"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Tiempo de espera de ejecución"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "de_de",
|
||||||
|
"string" : "Wartezeit"
|
||||||
|
}],
|
||||||
|
"description": [{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "WATCH",
|
||||||
|
"type": "text.multiselect",
|
||||||
|
"default_value":[],
|
||||||
|
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" :[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Watched"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Visto"
|
||||||
|
}],
|
||||||
|
"description":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Download speed (not recommended)</li><li><code>Watched_Value2</code> is Upload speed (not recommended)</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "REPORT_ON",
|
||||||
|
"type": "text.multiselect",
|
||||||
|
"default_value":[],
|
||||||
|
"options": ["new","watched-changed","watched-not-changed", "missing-in-last-scan"],
|
||||||
|
"localized": ["name", "description"],
|
||||||
|
"name" :[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Report on"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Informar sobre"
|
||||||
|
}] ,
|
||||||
|
"description":[{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string" : "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string" : "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron."
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
61
front/plugins/internet_speedtest/script.py
Executable file
61
front/plugins/internet_speedtest/script.py
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Based on the work of https://github.com/leiweibau/Pi.Alert
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
import speedtest
|
||||||
|
|
||||||
|
# Replace these paths with the actual paths to your Pi.Alert directories
|
||||||
|
sys.path.extend(["/home/pi/pialert/front/plugins", "/home/pi/pialert/pialert"])
|
||||||
|
|
||||||
|
from plugin_helper import Plugin_Objects
|
||||||
|
from logger import mylog, append_line_to_file
|
||||||
|
from helper import timeNowTZ
|
||||||
|
|
||||||
|
CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
|
||||||
|
RESULT_FILE = os.path.join(CUR_PATH, 'last_result.log')
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
mylog('verbose', ['[INTRSPD] In script'])
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Speedtest Plugin for Pi.Alert')
|
||||||
|
values = parser.parse_args()
|
||||||
|
|
||||||
|
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||||
|
speedtest_result = run_speedtest()
|
||||||
|
plugin_objects.add_object(
|
||||||
|
primaryId = 'Speedtest',
|
||||||
|
secondaryId = timeNowTZ(),
|
||||||
|
watched1 = speedtest_result['download_speed'],
|
||||||
|
watched2 = speedtest_result['upload_speed'],
|
||||||
|
watched3 = 'null',
|
||||||
|
watched4 = 'null',
|
||||||
|
extra = 'null',
|
||||||
|
foreignKey = 'null'
|
||||||
|
)
|
||||||
|
plugin_objects.write_result_file()
|
||||||
|
|
||||||
|
def run_speedtest():
|
||||||
|
try:
|
||||||
|
st = speedtest.Speedtest()
|
||||||
|
st.get_best_server()
|
||||||
|
download_speed = round(st.download() / 10**6, 2) # Convert to Mbps
|
||||||
|
upload_speed = round(st.upload() / 10**6, 2) # Convert to Mbps
|
||||||
|
|
||||||
|
return {
|
||||||
|
'download_speed': download_speed,
|
||||||
|
'upload_speed': upload_speed,
|
||||||
|
}
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error running speedtest: {str(e)}")
|
||||||
|
return {
|
||||||
|
'download_speed': -1,
|
||||||
|
'upload_speed': -1,
|
||||||
|
}
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
||||||
@@ -14,8 +14,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"show_ui": true,
|
"show_ui": true,
|
||||||
"localized": ["display_name", "description", "icon"],
|
"localized": [
|
||||||
|
"display_name",
|
||||||
|
"description",
|
||||||
|
"icon"
|
||||||
|
],
|
||||||
"display_name": [
|
"display_name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -59,15 +62,25 @@
|
|||||||
"value": "PHOLUS_RUN_TIMEOUT"
|
"value": "PHOLUS_RUN_TIMEOUT"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"function": "RUN",
|
"function": "RUN",
|
||||||
"type": "text.select",
|
"type": "text.select",
|
||||||
"default_value":"schedule",
|
"default_value": "on_new_device",
|
||||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
"options": [
|
||||||
"localized": ["name", "description"],
|
"disabled",
|
||||||
"events": ["run"],
|
"once",
|
||||||
|
"schedule",
|
||||||
|
"always_after_scan",
|
||||||
|
"on_new_device"
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"events": [
|
||||||
|
"run"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -76,7 +89,8 @@
|
|||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Cuando ejecutar"
|
"string": "Cuando ejecutar"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"description": [
|
"description": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -93,7 +107,10 @@
|
|||||||
"type": "readonly",
|
"type": "readonly",
|
||||||
"default_value": "python3 /home/pi/pialert/front/plugins/pholus_scan/script.py userSubnets={subnets} timeoutSec={timeout}",
|
"default_value": "python3 /home/pi/pialert/front/plugins/pholus_scan/script.py userSubnets={subnets} timeoutSec={timeout}",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -115,13 +132,15 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"function": "RUN_TIMEOUT",
|
"function": "RUN_TIMEOUT",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default_value": 300,
|
"default_value": 300,
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -148,38 +167,50 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"default_value": "30 3 * * *",
|
"default_value": "30 3 * * *",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
"name" : [{
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Schedule"
|
"string": "Schedule"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Schedule"
|
"string": "Schedule"
|
||||||
}],
|
}
|
||||||
"description": [{
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>30 3 * * *</code> will run the scan at 3:30 am. Will be run NEXT time the time passes. <br/>"
|
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>30 3 * * *</code> will run the scan at 3:30 am. Will be run NEXT time the time passes. <br/>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code></a>. Asegúrese de ingresar la programación en el formato cron correcto (por ejemplo, validar en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, al ingresar <code>30 3 * * *</code> se ejecutará el escaneo a las 3:30 am. Se ejecutará la PRÓXIMA vez que pase el tiempo. <br/>"
|
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#PHOLUS_RUN\"><code>PHOLUS_RUN</code></a>. Asegúrese de ingresar la programación en el formato cron correcto (por ejemplo, validar en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, al ingresar <code>30 3 * * *</code> se ejecutará el escaneo a las 3:30 am. Se ejecutará la PRÓXIMA vez que pase el tiempo. <br/>"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"function": "DAYS_DATA",
|
"function": "DAYS_DATA",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default_value": 30,
|
"default_value": 30,
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
"name" : [{
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Schedule"
|
"string": "Schedule"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Retención de datos"
|
"string": "Retención de datos"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"description": [
|
"description": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -194,32 +225,57 @@
|
|||||||
{
|
{
|
||||||
"function": "WATCH",
|
"function": "WATCH",
|
||||||
"type": "text.multiselect",
|
"type": "text.multiselect",
|
||||||
"default_value":["Watched_Value1", "Watched_Value2"],
|
"default_value": [
|
||||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
"Watched_Value1",
|
||||||
"localized": ["name", "description"],
|
"Watched_Value2"
|
||||||
"name" :[{
|
],
|
||||||
|
"options": [
|
||||||
|
"Watched_Value1",
|
||||||
|
"Watched_Value2",
|
||||||
|
"Watched_Value3",
|
||||||
|
"Watched_Value4"
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Watched"
|
"string": "Watched"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Watched"
|
"string": "Watched"
|
||||||
}] ,
|
}
|
||||||
"description":[{
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Info</li><li><code>Watched_Value2</code> is Record type</li><li><code>Watched_Value3</code> is Info </li><li><code>Watched_Value4</code> is N/A </li></ul>"
|
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Info</li><li><code>Watched_Value2</code> is Record type</li><li><code>Watched_Value3</code> is Info </li><li><code>Watched_Value4</code> is N/A </li></ul>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Enviar una notificación si los valores seleccionados cambian. Utilice <code>CTRL + Clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es Información</li><li><code>Watched_Value2</code> es Tipo de registro</li><li><code>Watched_Value3</code> es La información </li><li><code>Watched_Value4</code> es N/A </li></ul>"
|
"string": "Enviar una notificación si los valores seleccionados cambian. Utilice <code>CTRL + Clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es Información</li><li><code>Watched_Value2</code> es Tipo de registro</li><li><code>Watched_Value3</code> es La información </li><li><code>Watched_Value4</code> es N/A </li></ul>"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"function": "REPORT_ON",
|
"function": "REPORT_ON",
|
||||||
"type": "text.multiselect",
|
"type": "text.multiselect",
|
||||||
"default_value": ["new"],
|
"default_value": [
|
||||||
"options": ["new", "watched-changed", "watched-not-changed", "missing-in-last-scan"],
|
"new"
|
||||||
"localized": ["name", "description"],
|
],
|
||||||
|
"options": [
|
||||||
|
"new",
|
||||||
|
"watched-changed",
|
||||||
|
"watched-not-changed",
|
||||||
|
"missing-in-last-scan"
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -242,9 +298,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"database_column_definitions": [
|
||||||
"database_column_definitions":
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"column": "Object_PrimaryID",
|
"column": "Object_PrimaryID",
|
||||||
"mapped_to_column": "MAC",
|
"mapped_to_column": "MAC",
|
||||||
@@ -253,15 +307,19 @@
|
|||||||
"type": "device_name_mac",
|
"type": "device_name_mac",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "MAC"
|
"string": "MAC"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "MAC"
|
"string": "MAC"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Object_SecondaryID",
|
"column": "Object_SecondaryID",
|
||||||
@@ -271,15 +329,19 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "IP"
|
"string": "IP"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "IP"
|
"string": "IP"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Watched_Value1",
|
"column": "Watched_Value1",
|
||||||
@@ -289,15 +351,19 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Info"
|
"string": "Info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Info"
|
"string": "Info"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Watched_Value2",
|
"column": "Watched_Value2",
|
||||||
@@ -307,15 +373,19 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Type"
|
"string": "Type"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Tipo"
|
"string": "Tipo"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Watched_Value3",
|
"column": "Watched_Value3",
|
||||||
@@ -325,15 +395,19 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Info"
|
"string": "Info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Info"
|
"string": "Info"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "DateTimeCreated",
|
"column": "DateTimeCreated",
|
||||||
@@ -343,15 +417,19 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Created"
|
"string": "Created"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Creado"
|
"string": "Creado"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "DateTimeChanged",
|
"column": "DateTimeChanged",
|
||||||
@@ -360,7 +438,9 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -396,15 +476,19 @@
|
|||||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Status"
|
"string": "Status"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code": "es_es",
|
"language_code": "es_es",
|
||||||
"string": "Estado"
|
"string": "Estado"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ function processColumnValue(dbColumnDef, value, index, type) {
|
|||||||
valueTmp = ''
|
valueTmp = ''
|
||||||
|
|
||||||
$.each(dbColumnDef.options, function(index, obj) {
|
$.each(dbColumnDef.options, function(index, obj) {
|
||||||
if(Number(value) < obj.maximum && valueTmp == '')
|
if(Number(value) < Number(obj.maximum) && valueTmp == '')
|
||||||
{
|
{
|
||||||
valueTmp = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
valueTmp = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
||||||
// return;
|
// return;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ curl -sSL https://bootstrap.pypa.io/get-pip.py | python3
|
|||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# Install Python packages
|
# Install Python packages
|
||||||
pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi
|
pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli
|
||||||
|
|
||||||
# Update alternatives for Python
|
# Update alternatives for Python
|
||||||
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
|
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
import conf
|
||||||
from logger import mylog
|
from logger import mylog
|
||||||
from const import pluginsPath, logPath
|
from const import pluginsPath, logPath
|
||||||
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
||||||
@@ -217,8 +218,6 @@ def check_and_run_user_event(db, pluginsState):
|
|||||||
# commit to DB
|
# commit to DB
|
||||||
db.commitDB()
|
db.commitDB()
|
||||||
|
|
||||||
mylog('debug', [f'[MAIN] processScan3: {pluginsState.processScan}'])
|
|
||||||
|
|
||||||
return pluginsState
|
return pluginsState
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user