diff options
| author | Matthias Fechner <mfechner@FreeBSD.org> | 2026-07-22 14:58:08 +0000 |
|---|---|---|
| committer | Matthias Fechner <mfechner@FreeBSD.org> | 2026-07-25 06:05:38 +0000 |
| commit | 0a7ef2828ee090d38c0f44bdd2fba36b134f2649 (patch) | |
| tree | 5436a62c1e4eda6056ada05e80938a2e280080de | |
| parent | 703f5a47c30b7de3c5cc5a7baa98b0372d1c7449 (diff) | |
www/SpectrumKNX: added new port version 1.16.0
a nice KNX monitor with a searchable history.
asyncpg must be downgraded due to a regresion in version 0.31.0:
https://github.com/MagicStack/asyncpg/issues/1334
Check for more details:
https://github.com/martinhoefling/SpectrumKNX
| -rw-r--r-- | GIDs | 2 | ||||
| -rw-r--r-- | UIDs | 2 | ||||
| -rw-r--r-- | www/Makefile | 1 | ||||
| -rw-r--r-- | www/SpectrumKNX/Makefile | 95 | ||||
| -rw-r--r-- | www/SpectrumKNX/distinfo | 5 | ||||
| -rw-r--r-- | www/SpectrumKNX/files/patch-backend_requirements.txt | 11 | ||||
| -rw-r--r-- | www/SpectrumKNX/files/pkg-message.in | 49 | ||||
| -rw-r--r-- | www/SpectrumKNX/files/spectrumknx.conf.sample | 47 | ||||
| -rw-r--r-- | www/SpectrumKNX/files/spectrumknx.in | 62 | ||||
| -rw-r--r-- | www/SpectrumKNX/pkg-descr | 6 |
10 files changed, 278 insertions, 2 deletions
@@ -342,7 +342,7 @@ rtorrent:*:397: tiarra:*:398: # free: 399 evcc:*:400: -# free: 401 +spectrumknx:*:401: # free: 402 # free: 403 # free: 404 @@ -347,7 +347,7 @@ rtorrent:*:397:397::0:0:rtorrent Daemon User:/nonexistent:/usr/sbin/nologin tiarra:*:398:398::0:0:Tiarra IRC Proxy:/nonexistent:/usr/sbin/nologin # free: 399 evcc:*:400:400::0:0:evcc Daemon:/nonexistent:/usr/sbin/nologin -# free: 401 +spectrumknx:*:401:401::0:0:SpectrumKNX Daemon:/var/db/spectrumknx:/usr/sbin/nologin # free: 402 # free: 403 # free: 404 diff --git a/www/Makefile b/www/Makefile index c1e53f96fe85..3054b5cc34cf 100644 --- a/www/Makefile +++ b/www/Makefile @@ -25,6 +25,7 @@ SUBDIR += R-cran-webshot SUBDIR += R-cran-webutils SUBDIR += SNIP + SUBDIR += SpectrumKNX SUBDIR += UniversalFeedCreator SUBDIR += access-log-exporter SUBDIR += adguardhome diff --git a/www/SpectrumKNX/Makefile b/www/SpectrumKNX/Makefile new file mode 100644 index 000000000000..fce5797394b8 --- /dev/null +++ b/www/SpectrumKNX/Makefile @@ -0,0 +1,95 @@ +PORTNAME= SpectrumKNX +PORTVERSION= 1.16.0 +DISTVERSIONPREFIX= v +CATEGORIES= www +MASTER_SITES= LOCAL/mfechner/${PORTNAME}/:npmcache +DISTFILES= ${PORTNAME}-npm-cache-${DISTVERSION}${EXTRACT_SUFX}:npmcache + +MAINTAINER= mfechner@FreeBSD.org +COMMENT= KNX bus and telegram monitor with storage +WWW= https://github.com/martinhoefling/SpectrumKNX + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +ONLY_FOR_ARCHS= amd64 +ONLY_FOR_ARCHS_REASON= Npm cache only for amd64 generated + +BUILD_DEPENDS= npm>=0:www/npm \ + git>=0:devel/git +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pip>=22.2.2:devel/py-pip@${PY_FLAVOR} \ + cargo-cbuild:devel/cargo-c \ + rust>0:lang/rust + +USES= compiler:c++17-lang gmake nodejs python shebangfix + +USE_GITHUB= yes +GH_ACCOUNT= martinhoefling +USE_RC_SUBR= spectrumknx + +# Required for node-gyp to work +MAKE_ENV+= npm_config_build_from_source=true +MAKE_ENV+= npm_config_nodedir=${PREFIX} +MAKE_ENV+= npm_config_node_gyp=${LOCALBASE}/bin/node-gyp +MAKE_ENV+= PYTHON=${PYTHON_CMD} +MAKE_ENV+= COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +MAKE_ENV+= npm_config_offline=true +MAKE_ENV+= VITE_APP_VERSION=${PORTVERSION} +CPPFLAGS+= -I${LOCALBASE}/include +CXXFLAGS+= -I${LOCALBASE}/include + +WWWDIR= ${PREFIX}/www/${PORTNAME} +SUB_FILES= pkg-message +SUB_LIST= SPECTRUMKNX_USER=${USERS} \ + SPECTRUMKNX_GROUP=${GROUPS} \ + PYTHON_CMD="${PYTHON_CMD}" \ + APP_VERSION="${PORTVERSION}" +USERS= spectrumknx +GROUPS= spectrumknx + +pre-build: + cd ${WRKSRC}/frontend && ${SETENV} ${MAKE_ENV} npm ci --legacy-peer-deps + +do-build: + @cd ${WRKSRC}/frontend && ${SETENV} ${MAKE_ENV} npm run build + +do-install: + ${FIND} ${WRKSRC} -name '*.orig' -delete + + # Install backend + (cd ${WRKSRC}/backend && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}) + # Install frontend + (cd ${WRKSRC}/frontend/dist && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}/static) + + # Configuration + ${INSTALL_DATA} ${FILESDIR}/spectrumknx.conf.sample ${STAGEDIR}${PREFIX}/etc/spectrumknx.conf.sample + + # User Home directory + @${MKDIR} ${STAGEDIR}/var/db/spectrumknx + +post-install: + ${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \ + ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' | \ + ${SED} -E -e '/sample$$/ s#^#@sample #; \ + /spectrumknx.conf.sample$$/ s#^@sample #@sample(spectrumknx,wheel,0600) #;' >> ${TMPPLIST} + @${ECHO_CMD} "@sample(spectrumknx,wheel,0600) etc/spectrumknx.conf.sample" >> ${TMPPLIST} + @${ECHO_CMD} "@owner spectrumknx" >> ${TMPPLIST} + @${ECHO_CMD} "@group spectrumknx" >> ${TMPPLIST} + @${ECHO_CMD} "@dir /var/db/spectrumknx" >> ${TMPPLIST} + +# To update +# 1. comment DISTFILES +# 2. Run 'make makesum' +# 3. Run 'make make-npm-cache' +# 4. Upload npm cache +# 5. Uncomment DITSFILES +# 6. Run 'make makesum' +make-npm-cache: patch + ${RM} -r ${WRKDIR}/npm-offline-cache + #cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn --frozen-lockfile --ignore-scripts + cd ${WRKSRC}/frontend && ${SETENV} HOME=${WRKDIR} npm ci --legacy-peer-deps + cd ${WRKDIR} && ${TAR} -c --zstd -f ${PORTNAME}-npm-cache-${DISTVERSION}${EXTRACT_SUFX} .npm + @${ECHO_CMD} upload ${PORTNAME}-npm-cache-${DISTVERSION}${EXTRACT_SUFX} + @${ECHO_CMD} "Please upload the file: scp ${WRKDIR}/${PORTNAME}-npm-cache-${DISTVERSION}${EXTRACT_SUFX} mfechner@freefall.freebsd.org:public_distfiles/${PORTNAME}/" + +.include <bsd.port.mk> diff --git a/www/SpectrumKNX/distinfo b/www/SpectrumKNX/distinfo new file mode 100644 index 000000000000..450c1f7635db --- /dev/null +++ b/www/SpectrumKNX/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1784613243 +SHA256 (SpectrumKNX-npm-cache-1.16.0.tar.gz) = cd57d52fd69670845760225caa1c4a97221a73666dfe72fb9878d88b72ec0903 +SIZE (SpectrumKNX-npm-cache-1.16.0.tar.gz) = 41298804 +SHA256 (martinhoefling-SpectrumKNX-v1.16.0_GH0.tar.gz) = 7252f11d7b18c5449cb720c0dde05192191989a6288f75664b3fb580d5aa3070 +SIZE (martinhoefling-SpectrumKNX-v1.16.0_GH0.tar.gz) = 10853737 diff --git a/www/SpectrumKNX/files/patch-backend_requirements.txt b/www/SpectrumKNX/files/patch-backend_requirements.txt new file mode 100644 index 000000000000..c029b72a3708 --- /dev/null +++ b/www/SpectrumKNX/files/patch-backend_requirements.txt @@ -0,0 +1,11 @@ +--- backend/requirements.txt.orig 2026-07-22 06:06:04 UTC ++++ backend/requirements.txt +@@ -3,7 +3,7 @@ anyio==4.14.2 + annotated-doc==0.0.4 + annotated-types==0.7.0 + anyio==4.14.2 +-asyncpg==0.31.0 ++asyncpg<0.31 + cffi==2.1.0 + click==8.4.2 + cryptography==49.0.0 diff --git a/www/SpectrumKNX/files/pkg-message.in b/www/SpectrumKNX/files/pkg-message.in new file mode 100644 index 000000000000..0c50c10a3b77 --- /dev/null +++ b/www/SpectrumKNX/files/pkg-message.in @@ -0,0 +1,49 @@ +[ +{ + message: <<EOM +SpectrumKNX installed successfully. + +Please configure SpectrumKNX using export commands in: +%%PREFIX%%/etc/spectrumknx.conf + +for more details check the configuration options (some useful ones are already define or must be changed): +https://github.com/martinhoefling/SpectrumKNX/blob/main/DEPLOYMENT.md + +Create postgres DB, user and enable timescaledb (make sure you have postgresql18-server and timescaledb installed and configured): +psql -U postgres +CREATE ROLE knxuser LOGIN PASSWORD 'knxpassword'; +CREATE DATABASE knx_analyzer OWNER knxuser; +\c knx_analyzer +CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; +\q + +To enable SpectrumKNX on startup: +sysrc spectrumknx_enable="YES" + +You should put a reverse proxy like nginx in front of it. +In the default configuration SpectrumKNX listens on http://localhost:8095/ + +You can modify this with: +sysrc spectrumknx_listen_ip="localhost" +sysrc spectrumknx_listen_port="8095" + +To start SpectrumKNX: +service spectrumknx start + +Logfile are on: +/var/log/spectrumknx/spectrumknx.log + +EOM + type: install +} +{ + message: <<EOM +To apply required python lib upgrade, restart SpectrumKNX: + +service spectrumknx restart + +EOM + type: upgrade +} +] + diff --git a/www/SpectrumKNX/files/spectrumknx.conf.sample b/www/SpectrumKNX/files/spectrumknx.conf.sample new file mode 100644 index 000000000000..da44a844dea1 --- /dev/null +++ b/www/SpectrumKNX/files/spectrumknx.conf.sample @@ -0,0 +1,47 @@ +# Please check this site for more details: +# https://github.com/martinhoefling/SpectrumKNX/blob/main/DEPLOYMENT.md + +# Logging verbosity (DEBUG, INFO, WARNING, ERROR, CRITICAL). +export LOG_LEVEL="INFO" + +# DB Connection +#export POSTGRES_USER="knxuser" +export POSTGRES_PASSWORD="" +#export POSTGRES_DB="knx_analyser" +#export POSTGRES_HOST="localhost" +#export POSTGRES_PORT="5432" + +# KNX Settings (normally no change required) +# IP address of your KNX IP Gateway/Router. Use AUTO to scan the network automatically +export KNX_GATEWAY_IP="AUTO" +#Port of your KNX IP Gateway +export KNX_GATEWAY_PORT="3671" +# Password for the ETS project file +export KNX_PASSWORD="" +# Local IP or interface name to bind to +export KNX_LOCAL_IP="" +# Individual address (e.g. 1.1.100) +export KNX_INDIVIDUAL_ADDRESS="" +# Multicast group for routing +export KNX_MULTICAST_GROUP="224.0.23.12" +# Multicast port for routing +export KNX_MULTICAST_PORT="3671" +# Path to the .knxkeys file (auto-detected at /project/knx_keys.knxkeys if not set) or upload via UI +export KNX_KNXKEYS_FILE="" +# Password for the .knxkeys file or upload via UI +export KNX_KNXKEYS_PASSWORD="" +# User ID for Secure Tunneling +export KNX_SECURE_USER_ID="" +# User Password for Secure Tunneling +export KNX_SECURE_USER_PASSWORD="" +# Device Password for Secure Tunneling +export KNX_SECURE_DEVICE_PASSWORD="" +# Backbone Key (hex) for Secure Routing +export KNX_SECURE_BACKBONE_KEY="" +# Latency in ms for Secure Routing +export KNX_SECURE_LATENCY_MS="" + +# Do not change +export KNX_PROJECT_PATH=/var/db/spectrumknx/knx_project.knxproj + + diff --git a/www/SpectrumKNX/files/spectrumknx.in b/www/SpectrumKNX/files/spectrumknx.in new file mode 100644 index 000000000000..96a24b8d2672 --- /dev/null +++ b/www/SpectrumKNX/files/spectrumknx.in @@ -0,0 +1,62 @@ +#!/bin/sh +# PROVIDE: spectrumknx +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +export PATH=$PATH:/usr/local/bin +export HOME=${workingdir} + +name="spectrumknx" +rcvar="${name}_enable" + +load_rc_config $name +: ${spectrumknx_enable:=no} +: ${spectrumknx_user:="%%SPECTRUMKNX_USER%%"} +: ${spectrumknx_group:="%%SPECTRUMKNX_GROUP%%"} +: ${spectrumknx_listen_ip:="localhost"} +: ${spectrumknx_listen_port:="8765"} + +logfile="/var/log/${name}/${name}.log" +pidfile="/var/run/${name}/${name}.pid" +workingdir="%%WWWDIR%%" +venvdir="${workingdir}/venv" + +command="/usr/sbin/daemon" +command_args="-H -o ${logfile} -t ${name} -P ${pidfile} \ + bash -c 'cd $workingdir && source venv/bin/activate && source /usr/local/etc/spectrumknx.conf && APP_VERSION="%%APP_VERSION%%" uvicorn main:app --host ${spectrumknx_listen_ip} --port ${spectrumknx_listen_port}'" + +start_precmd="${name}_precmd" +start_cmd="${name}_start" + +spectrumknx_precmd() +{ + # Ensure pid directory exists + install -d -g "${spectrumknx_group}" -o "${spectrumknx_user}" "$(dirname "${pidfile}")" + + # Ensure log directory exists + install -d -g "${spectrumknx_group}" -o "${spectrumknx_user}" "$(dirname "${logfile}")" + + # Ensure DB directory exists + install -d -g "${spectrumknx_group}" -o "${spectrumknx_user}" -m 0750 "/var/db/spectrumknx" + + # Ensure virtualenv exists + if [ ! -d "${venvdir}/bin" ]; then + echo "Creating Python virtual environment..." + mkdir -p "${venvdir}" + chown ${spectrumknx_user}:${spectrumknx_group} "${venvdir}" + su -m "${spectrumknx_user}" -c "%%PYTHON_CMD%% -m venv ${venvdir}" || return 1 + fi + + echo "Installing Python requirements..." + su -m "${spectrumknx_user}" -c "cd ${workingdir} && ${venvdir}/bin/python -m pip install -r ${workingdir}/requirements.txt" || return 1 +} + +spectrumknx_start() +{ + su -m ${spectrumknx_user} -c "${command} ${command_args}" +} + +run_rc_command "$1" + diff --git a/www/SpectrumKNX/pkg-descr b/www/SpectrumKNX/pkg-descr new file mode 100644 index 000000000000..382b79a3b9da --- /dev/null +++ b/www/SpectrumKNX/pkg-descr @@ -0,0 +1,6 @@ +An elegant, high-performance bus traffic monitor and visualizer for KNX Home +Automation. + +Spectrum KNX is a dedicated tool to record, store, search, and visualize KNX bus +telegrams indefinitely. Built for speed and reliability, it merges a robust +TimescaleDB backend with a premium, real-time React web interface. |
