diff --git a/docs/DEVICE_MANAGEMENT.md b/docs/DEVICE_MANAGEMENT.md index 73f5655c..3ee89cc3 100755 --- a/docs/DEVICE_MANAGEMENT.md +++ b/docs/DEVICE_MANAGEMENT.md @@ -11,7 +11,7 @@ To edit device information: > [!NOTE] > -> [Bulk-edit devices](/docs/DEVICES_BULK_EDITING.md) by using the `CSV Export` functionality in the `Maintenance` section. +> [Bulk-edit devices](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/DEVICES_BULK_EDITING.md) by using the `CSV Export` functionality in the `Maintenance` section. ![Device Details][screen1] diff --git a/front/css/pialert.css b/front/css/pialert.css index 4db3080d..a9d952f1 100755 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -823,7 +823,7 @@ input[readonly] { display: block; position: absolute; margin-left: 170px; - top: -3px; + top: 5px; font-size: large; left: -15px; } diff --git a/front/deviceDetails.php b/front/deviceDetails.php index b3cf5aa2..d32a1f5c 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -325,7 +325,7 @@
schedule the scheduling settings from below are applied. If you select once the scan is run only once on start of the application (container) for the time specified in INTRSPD_RUN_TIMEOUT setting."
+ }]
+ },
+ {
+ "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 schedule in the INTRSPD_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering 0 4 * * * will run the scan after 4 am in the TIMEZONE you set above. Will be run NEXT time the time passes."
+ },
+ {
+ "language_code": "es_es",
+ "string": "Solo habilitado si selecciona schedule en la configuración INTRSPD_RUN. Asegúrese de ingresar el schedule en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingrese 0 4 * * * ejecutará el escaneo después de las 4 am en el TIMEZONE que configuró arriba . 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 CTRL + Click to select/deselect. Watched_Value1 is Download speed (not recommended)Watched_Value2 is Upload speed (not recommended)Watched_Value3 unused Watched_Value4 unused new means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. watched-changed means that selected Watched_ValueN columns changed."
+ },
+ {
+ "language_code": "es_es",
+ "string" : "Envíe una notificación solo en estos estados. new significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). watched-changed significa que seleccionó Watched_ValueN Las columnas cambiaron."
+ }]
+ }
+ ]
+}
diff --git a/front/plugins/_publisher_apprise/ignore_plugin b/front/plugins/_publisher_apprise/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_apprise/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/_publisher_apprise/script.py b/front/plugins/_publisher_apprise/script.py
new file mode 100755
index 00000000..019d34dc
--- /dev/null
+++ b/front/plugins/_publisher_apprise/script.py
@@ -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', ['[APPRISE] 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:
+ mylog('verbose', [f"Error running speedtest: {str(e)}"])
+ return {
+ 'download_speed': -1,
+ 'upload_speed': -1,
+ }
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/front/plugins/_publisher_email/ignore_plugin b/front/plugins/_publisher_email/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_email/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/_publisher_mqtt/ignore_plugin b/front/plugins/_publisher_mqtt/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_mqtt/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/_publisher_ntfy/ignore_plugin b/front/plugins/_publisher_ntfy/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_ntfy/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/_publisher_pushsafer/ignore_plugin b/front/plugins/_publisher_pushsafer/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_pushsafer/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/_publisher_webhook/ignore_plugin b/front/plugins/_publisher_webhook/ignore_plugin
new file mode 100755
index 00000000..77ffa1c1
--- /dev/null
+++ b/front/plugins/_publisher_webhook/ignore_plugin
@@ -0,0 +1 @@
+This plugin will not be loaded
\ No newline at end of file
diff --git a/front/plugins/internet_speedtest/config.json b/front/plugins/internet_speedtest/config.json
index 67c5d1d6..aaa42858 100755
--- a/front/plugins/internet_speedtest/config.json
+++ b/front/plugins/internet_speedtest/config.json
@@ -295,12 +295,8 @@
}],
"description": [{
"language_code": "en_us",
- "string" : "Enable a regular scan of your services. If you select schedule the scheduling settings from below are applied. If you select once the scan is run only once on start of the application (container) for the time specified in INTRSPD_RUN_TIMEOUT setting."
- },
- {
- "language_code": "es_es",
- "string" : "Habilite un escaneo regular de sus servicios. Si selecciona schedule, se aplican las configuraciones de programación de abajo. Si selecciona once, el escaneo se ejecuta solo una vez al iniciar la aplicación (contenedor) durante el tiempo especificado en INTRSPD_RUN_TIMEOUT configuración."
- }]
+ "string" : "Enable a regular internet speedtest. If you select schedule the scheduling settings from below are applied. If you select once the scan is run only once on start of the application (container) for the time specified in INTRSPD_RUN_TIMEOUT setting."
+ }]
},
{
"function": "CMD",
diff --git a/front/plugins/internet_speedtest/script.py b/front/plugins/internet_speedtest/script.py
index 9df63aa2..10b65cc0 100755
--- a/front/plugins/internet_speedtest/script.py
+++ b/front/plugins/internet_speedtest/script.py
@@ -51,7 +51,7 @@ def run_speedtest():
'upload_speed': upload_speed,
}
except Exception as e:
- print(f"Error running speedtest: {str(e)}")
+ mylog('verbose', [f"Error running speedtest: {str(e)}"])
return {
'download_speed': -1,
'upload_speed': -1,