docs, MQTT, GH Actions

This commit is contained in:
jokob-sk
2025-03-01 09:44:11 +11:00
parent 1e714005a5
commit 47d9a9300e
9 changed files with 16 additions and 25 deletions

View File

@@ -1,4 +1,3 @@
---
name: docker name: docker
on: on:
@@ -37,7 +36,7 @@ jobs:
- name: Get release version - name: Get release version
id: get_version id: get_version
run: echo "::set-output name=version::${{ 'Dev' }}" run: echo "version=Dev" >> $GITHUB_OUTPUT
- name: Create .VERSION file - name: Create .VERSION file
run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION
@@ -46,13 +45,13 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
# list of Docker images to use as base name for tags
images: | images: |
ghcr.io/jokob-sk/netalertx-dev
ghcr.io/jokob-sk/pi.alert-dev
jokobsk/netalertx-dev jokobsk/netalertx-dev
# generate Docker tags based on the following events/attributes jokobsk/pi.alert-dev
tags: | tags: |
type=raw,value=latest type=raw,value=latest
type=schedule
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}
@@ -60,24 +59,20 @@ jobs:
type=semver,pattern={{major}} type=semver,pattern={{major}}
type=sha type=sha
- name: Log in to Github Container registry - name: Log in to Github Container Registry (GHCR)
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: jokob-sk username: jokob-sk
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub - name: Log in to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
# # Disable this after use
# - name: Prune Docker Builder
# run: docker builder prune --force
- name: Build and push - name: Build and push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
with: with:
@@ -86,6 +81,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# # ⚠ disable cache if build is failing to download debian packages
# cache-from: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache
# cache-to: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache,mode=max

View File

@@ -48,8 +48,10 @@ jobs:
with: with:
# list of Docker images to use as base name for tags # list of Docker images to use as base name for tags
images: | images: |
jokobsk/pi.alert ghcr.io/jokob-sk/netalertx
ghcr.io/jokob-sk/pi.alert
jokobsk/netalertx jokobsk/netalertx
jokobsk/pi.alert
# generate Docker tags based on the following events/attributes # generate Docker tags based on the following events/attributes
tags: | tags: |
type=semver,pattern={{version}},value=${{ inputs.version }} type=semver,pattern={{version}},value=${{ inputs.version }}

View File

@@ -1,6 +1,6 @@
# NetAlertX Community Helper Scripts Overview # NetAlertX Community Helper Scripts Overview
This page provides an overview of community-contributed scripts for NetAlertX. These scripts are not maintained by the NetAlertX team and are provided as-is. This page provides an overview of community-contributed scripts for NetAlertX. These scripts are not actively maintained and are provided as-is.
## Community Scripts ## Community Scripts
@@ -8,14 +8,14 @@ You can find all scripts in this [scripts GitHub folder](https://github.com/joko
| Script Name | Description | Author | Version | Release Date | | Script Name | Description | Author | Version | Release Date |
|------------|-------------|--------|---------|--------------| |------------|-------------|--------|---------|--------------|
| **NetAlertX-New-Devices-Checkmk-Script** | Checks for new devices in NetAlertX and reports status to Checkmk. | N/A | 1.0 | 08-Jan-2025 | | **New Devices Checkmk Script** | Checks for new devices in NetAlertX and reports status to Checkmk. | N/A | 1.0 | 08-Jan-2025 |
| **DB Cleanup Script** | Queries and removes old device-related entries from the database. | [laxduke](https://github.com/laxduke) | 1.0 | 23-Dec-2024 | | **DB Cleanup Script** | Queries and removes old device-related entries from the database. | [laxduke](https://github.com/laxduke) | 1.0 | 23-Dec-2024 |
| **NetAlertX OPNsense DHCP Lease Converter** | Retrieves DHCP lease data from OPNsense and converts it to `dnsmasq` format. | [im-redactd](https://github.com/im-redactd) | 1.0 | 24-Feb-2025 | | **OPNsense DHCP Lease Converter** | Retrieves DHCP lease data from OPNsense and converts it to `dnsmasq` format. | [im-redactd](https://github.com/im-redactd) | 1.0 | 24-Feb-2025 |
## Important Notes ## Important Notes
> [!NOTE] > [!NOTE]
> These scripts are community-supplied and not actively maintained. Use at your own discretion. > These scripts are community-supplied and not actively maintained. Use at your own discretion.
For detailed usage instructions, refer to each script's documentation. For detailed usage instructions, refer to each script's documentation in each [scripts GitHub folder](https://github.com/jokob-sk/NetAlertX/tree/main/scripts).

View File

@@ -40,7 +40,7 @@ Copying the HTML code from [Font Awesome](https://fontawesome.com/search?o=r&m=f
- The dropdown contains all icons already used in the app for device icons. You might need to navigate away or refresh the page once you add a new icon. - The dropdown contains all icons already used in the app for device icons. You might need to navigate away or refresh the page once you add a new icon.
## 🌟 Pro Font Awesome icons ## Font Awesome Pro icons
If you own the premium package of Font Awesome icons you can mount it in your Docker container the following way: If you own the premium package of Font Awesome icons you can mount it in your Docker container the following way:

View File

@@ -8,7 +8,6 @@ If you are running a DNS server, such as **AdGuard**, set up **Private reverse D
> ``` > ```
> jokob@Synology-NAS:/$ nslookup 192.168.1.58 > jokob@Synology-NAS:/$ nslookup 192.168.1.58
> ** server can't find 58.1.168.192.in-addr.arpa: NXDOMAIN > ** server can't find 58.1.168.192.in-addr.arpa: NXDOMAIN
>
> ``` > ```
> Example 2: Reverse DNS `enabled` > Example 2: Reverse DNS `enabled`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -332,7 +332,7 @@
} }
] ]
}, },
"default_value": "python3 /app/front/plugins/_publisher_mqtt/mqtt.py devices={devices}", "default_value": "python3 /app/front/plugins/_publisher_mqtt/mqtt.py",
"options": [], "options": [],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [

View File

@@ -464,6 +464,7 @@ def mqtt_start(db):
sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'sensor', 'first_connection', 'calendar-start', device["devMac"]) sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'sensor', 'first_connection', 'calendar-start', device["devMac"])
sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'sensor', 'last_connection', 'calendar-end', device["devMac"]) sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'sensor', 'last_connection', 'calendar-end', device["devMac"])
# handle device_tracker
# device_tracker attributes # device_tracker attributes
devJson = { devJson = {
"last_ip": device["devLastIP"], "last_ip": device["devLastIP"],
@@ -480,9 +481,6 @@ def mqtt_start(db):
"network_parent_name": next((dev["devName"] for dev in devices if dev["devMAC"] == device["devParentMAC"]), "") "network_parent_name": next((dev["devName"] for dev in devices if dev["devMAC"] == device["devParentMAC"]), "")
} }
# bulk update device sensors in home assistant
publish_mqtt(mqtt_client, sensorConfig.state_topic, devJson)
# create and update is_present sensor # create and update is_present sensor
sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'binary_sensor', 'is_present', 'wifi', device["devMac"]) sensorConfig = create_sensor(mqtt_client, deviceId, devDisplayName, 'binary_sensor', 'is_present', 'wifi', device["devMac"])
publish_mqtt(mqtt_client, sensorConfig.state_topic, publish_mqtt(mqtt_client, sensorConfig.state_topic,