SYNC required + docs

This commit is contained in:
jokob-sk
2024-10-10 07:55:37 +11:00
parent 48effdbbad
commit 222a439212
8 changed files with 24 additions and 14 deletions

View File

@@ -62,6 +62,8 @@ Head to [https://netalertx.com/](https://netalertx.com/) for more gifs and scree
## Installation & Documentation
<!--- --------------------------------------------------------------------- --->
Supported browsers: Chrome, Firefox
| Docs | Link |
|-------------|-------------|
| 📥🐳 | [Docker instructions](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md)

View File

@@ -83,7 +83,7 @@ The `config.json` file is the manifest of the plugin. It contains mainly setting
## Execution order
The execution order is used to specify wwhen a plugin is executed. This is useful if a plugin has access and surfaces more information than others. If a device is detected by 2 plugins and inserted into the `CurrentScan` table, the plugin with the higher priority (e.g.: `Level_0` is a higher priority than `Level_1`) will insert it's values first. These values (devices) will be then prioritized over any values inserted later.
The execution order is used to specify when a plugin is executed. This is useful if a plugin has access and surfaces more information than others. If a device is detected by 2 plugins and inserted into the `CurrentScan` table, the plugin with the higher priority (e.g.: `Level_0` is a higher priority than `Level_1`) will insert it's values first. These values (devices) will be then prioritized over any values inserted later.
```json
{
@@ -361,7 +361,7 @@ Plugin results are always inserted into the standard `Plugin_Objects` database t
>3. That's it. The app takes care of the rest. It loops thru the objects discovered by the plugin, takes the results line-by-line, and inserts them into the database table specified in `"mapped_to_table"`. The columns are translated from the generic plugin columns to the target table columns via the `"mapped_to_column"` property in the column definitions.
> [!NOTE]
> You can create a column mapping with a default value via the `mapped_to_column_data` property. This means that the value of the given column will always be this value. That also menas that the `"column": "NameDoesntMatter"` is not important as there is no database source column.
> You can create a column mapping with a default value via the `mapped_to_column_data` property. This means that the value of the given column will always be this value. That also means that the `"column": "NameDoesntMatter"` is not important as there is no database source column.
>🔍 Example:

0
front/php/templates/language/de_de.json Normal file → Executable file
View File

View File

@@ -28,6 +28,7 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
|---------------|---------|--------------------------------------------|----------|----------|--------------------|---------------------------------------------------------------|
| `APPRISE` | ▶️ | Apprise notification proxy | | | Script | [_publisher_apprise](/front/plugins/_publisher_apprise/) |
| `ARPSCAN` | 🔍 | ARP-scan on current network | | | Script | [arp_scan](/front/plugins/arp_scan/) |
| `AVAHISCAN` | ♻ | Avahi (mDNS-based) name resolution | | | Script | [avahi_scan](/front/plugins/avahi_scan/) |
| `CSVBCKP` | ⚙ | CSV devices backup | | | Script | [csv_backup](/front/plugins/csv_backup/) |
| `DBCLNP` | ⚙ | Database cleanup | | Yes* | Script | [db_cleanup](/front/plugins/db_cleanup/) |
| `DDNS` | ⚙ | DDNS update | | | Script | [ddns_update](/front/plugins/ddns_update/) |
@@ -71,9 +72,9 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
| Plugin type | Icon | Description | When to run | Required | Data source [?](/docs/PLUGINS_DEV.md) |
|---------------|------|---------------------------------------------------------------|--------------------------|----|---------|
|---------------|------|----------------------------------------------------------------|--------------------------|----|---------|
| publisher | ▶️ | Sending notifications to services. | `on_notification` | ✖ | Script |
| dev scanner | 🔍 | Create devices in the app, usually scanning the current network. | `schedule` | ✖ | Script / SQLite DB |
| dev scanner | 🔍 | Create devices in the app, manages online/offline device status. | `schedule` | ✖ | Script / SQLite DB |
| importer | 📥 | Importing devices from another service. | `schedule` | ✖ | Script / SQLite DB |
| system | ⚙ | Providing core system functionality. | `schedule` / always on | ✖/✔ | Script / Template |
| other | ♻ | Other scanners, e.g. for name resolution | misc | ✖ | Script / Template |

View File

@@ -23,11 +23,15 @@ Filters will be ignored, and this will delete all objects associated with the pl
![image](./Deleting_MQTT_Plugin_Objects.png)
This is not the case for the online/offline state of the device, which is always updated absed on the scan result and if it changed from the previous value.
Please note the online/offline state of the device is always updated based on the scan result and if it changed from the previous value.
# Sample Payloads
>[!WARNING]
> Please check your Home Assistant MQTT broker debug info for the most up-to-date data and format as the below might be outdated.
## Overview device
The below payloads apply to the device showing overall online/down/archived stats. You can toggle them on/off with the `SEND_STATS` setting.
@@ -197,8 +201,6 @@ Payload:
}
```
>[!WARNING]
> Please check your Home Assistant MQTT broker debug info for the most up-to-date data nad format as the above might be outdated.
## Implementation Notes

View File

@@ -8,3 +8,5 @@ You need Telegram bot to send notifications
### Usage
- Go to settings and fill in relevant details.
Made by [@doctorixx](https://github.com/doctorixx) 🙏

View File

@@ -46,9 +46,10 @@
]
},
"default_value": "disabled",
"default_value": "unused",
"options": [
"disabled",
"unused",
"once",
"schedule",
"always_after_scan",

View File

@@ -25,6 +25,8 @@ CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
LOG_FILE = os.path.join(CUR_PATH, 'script.log')
RESULT_FILE = os.path.join(CUR_PATH, 'last_result.log')
pluginName = 'UNDIS'
def main():
# the script expects a parameter in the format of devices=device1,device2,...
@@ -32,7 +34,7 @@ def main():
parser.add_argument('devices', action="store", help="list of device names separated by ','")
values = parser.parse_args()
mylog('verbose', ['[UNDIS] In script'])
mylog('verbose', [f'[{pluginName}] In script'])
plugin_objects = Plugin_Objects( RESULT_FILE )