Minimal starter for a KiWi SDR scanning/monitoring utility.
Start from the published Docker image:
docker run -d --name kiwiscan --pull always --restart unless-stopped --platform linux/amd64 \
-p 4010:4010/tcp \
-p 4010:4010/udp \
-p 4020:4020 \
-v kiwiscan-config:/opt/kiwiscan/config \
-v kiwiscan-outputs:/opt/kiwiscan/outputs \
n4ldr/kiwiscan:0.1.18Then open:
http://localhost:4020
Full Docker steps and verification are below in the Docker section. Install guide: https://github.com/ristola/KiwiScan/blob/main/INSTALL.md
- Install guide (share this URL): https://github.com/ristola/KiwiScan/blob/main/INSTALL.md
- Maintainer release guide (signed/notarized
.pkg):RELEASE.md - One-line installer:
curl -fsSL https://raw.githubusercontent.com/ristola/KiwiScan/main/tools/install_latest.sh | bashcd /opt/ShackMate/kiwi_scan
python3 -m venv .venv-py3
source .venv-py3/bin/activate
python -m pip install -U pip
python -m pip install -e .
kiwi-scan --help
kiwi-scan scan --helpUse the browser-friendly install page:
INSTALL.md
Direct one-line installer:
curl -fsSL https://raw.githubusercontent.com/ristola/KiwiScan/main/tools/install_latest.sh | bashOperator shell/env reference:
- See
.env.examplefor preferred.venv-py3activation and common run/test commands.
./run_server.shDocker Hub image:
https://hub.docker.com/r/n4ldr/kiwiscan
New user Docker quick start:
-
Install Docker Desktop or Docker Engine and confirm Docker is running.
docker version
-
Start KiwiScan with the published image.
docker run -d --name kiwiscan --pull always --restart unless-stopped --platform linux/amd64 \ -p 4010:4010/tcp \ -p 4010:4010/udp \ -p 4020:4020 \ -v kiwiscan-config:/opt/kiwiscan/config \ -v kiwiscan-outputs:/opt/kiwiscan/outputs \ n4ldr/kiwiscan:0.1.18
-
Open the web UI.
http://localhost:4020 -
Check startup logs.
docker logs --tail 50 kiwiscan
-
Inspect the saved config after first startup.
docker run --rm -v kiwiscan-outputs:/data alpine cat /data/config.json
-
If your Kiwi requires authentication, save the Kiwi User Password and Kiwi Admin Password in KiwiSDR Settings after the UI comes up.
Notes: The user password is used for normal receiver connections when only limited no-password slots are available. The admin password is used for admin kick / slot recovery. These secrets are stored in
config/kiwi_secrets.json, so theconfigvolume or bind mount must persist.
If you started the container from an empty folder and nothing appeared there, that is expected: the command above uses Docker named volumes, not files in the current directory.
Use this version instead when you want KiwiScan to save config and outputs directly in the folder you run it from:
mkdir -p config outputs
docker run -d --name kiwiscan --pull always --restart unless-stopped --platform linux/amd64 \
-p 4010:4010/tcp \
-p 4010:4010/udp \
-p 4020:4020 \
-v "$PWD/config:/opt/kiwiscan/config" \
-v "$PWD/outputs:/opt/kiwiscan/outputs" \
n4ldr/kiwiscan:0.1.18With that folder-backed version, your saved config will be written to ./outputs/config.json.
Saved Kiwi passwords are written to ./config/kiwi_secrets.json.
Ports exposed by that command:
4020/tcp: main web UI and HTTP API4010/tcp: legacy WebSocket decode stream4010/udp: UDP decode publisher
Docker pulls the image automatically on first run, so a separate docker pull is not required.
On first container startup, docker run does not read this repo's docker-compose.yml. If the persisted Kiwi host is still unset (0.0.0.0) or still on the legacy baked-in default (192.168.1.93), the container auto-discovers a Kiwi on the LAN, saves it to outputs/config.json, and then starts the headless auto-set loop with that discovered host.
Useful container commands:
docker ps
docker stop kiwiscan
docker start kiwiscan
docker rm -f kiwiscanBuild and run the web app container locally:
docker build -t kiwiscan-local:latest .
docker run --rm -p 4020:4020 kiwiscan-local:latestOr with Compose:
docker compose up -dPublish the local image to Docker Hub using the version in pyproject.toml:
./tools/publish_docker.shBuild first, then publish:
./tools/publish_docker.sh --buildBefore pushing to Docker Hub, authenticate once on the machine doing the publish:
docker loginPublish rolling and date-stamped test images for external testers without moving the release tags:
./tools/publish_docker.sh --build --no-version --no-latest \
--tag test-latest \
--tag test-20260418Smoke-test a published test image directly from Docker Hub:
docker run --rm -p 4020:4020 n4ldr/kiwiscan:test-latestIf you build manually instead of using Compose, keep the default local release tag:
docker build -t kiwiscan-local:latest .Docker tag note:
- Use
n4ldr/kiwiscan:<version>when you want an immutable released image. - Use
n4ldr/kiwiscan:latestwhen you want the newest published main-branch image; it may move past the most recent numbered release. - Use
n4ldr/kiwiscan:test-latestfor the current rolling tester build. - Use
n4ldr/kiwiscan:test-YYYYMMDDwhen you want a reproducible test snapshot.
Container smoke test:
python3 tools/container_healthcheck.py --show-decode-detailsShell wrapper with defaults suitable for cron/launchd:
./tools/run_container_healthcheck.shRequire at least 3 fresh decode slots in the last 10 minutes and enforce specific slots when needed:
python3 tools/container_healthcheck.py \
--fresh-within-s 600 \
--min-fresh-decodes 3 \
--require-slots udp-3100,udp-3102 \
--show-decode-detailsInstall a user LaunchAgent that runs the wrapper every 5 minutes:
chmod +x tools/run_container_healthcheck.sh tools/install_healthcheck_launch_agent.sh
./tools/install_healthcheck_launch_agent.shCommon LaunchAgent overrides:
INTERVAL=600 REQUIRE_SLOTS=udp-3105,udp-3106 ./tools/install_healthcheck_launch_agent.shNotes:
- The container is now self-contained for the FastAPI web app on port
4020; it does not create a virtualenv or install Python packages at container startup. kiwirecorder.pyis bundled fromvendor/kiwiclient-jksand available inside the image.ft8modemandaf2udpare built inside the image from the tracked vendored source atvendor/ft8modem-smand installed into/usr/local/bin.jt9is installed from Debian'swsjtxpackage soft8modemcan perform FT8/FT4 decoding inside the container.- The container publishes the main web app on port
4020and legacy decoded-data export on port4010. - The main decode websocket is available from the main app on
ws://<host>:4020/ws/decodes. - Legacy TCP
4010continues to export the WebSocket decode feed for older clients. - Legacy UDP
4010continues to export each decode as one JSON datagram to registered clients.
Check runtime dependencies used by receiver automation (kiwirecorder/ft8modem/af2udp/sox):
./tools/check_runtime_deps.shOptionally attempt a local build of missing ft8modem/af2udp from ../ft8modem:
./tools/check_runtime_deps.sh --build-missingrun_server.sh can now auto-bootstrap by default:
- Creates
.venv-py3if missing (falls back to.venvif present). - Installs required Python packages if
fastapi/uvicornare missing. - Then starts the server.
Disable auto-bootstrap (manual mode):
AUTO_SETUP=0 ./run_server.shNotes:
run_server.shnow exits on a clean shutdown (e.g. Ctrl+C) instead of restarting forever.- To force the old behavior, set
ALWAYS_RESTART=1. - To run once with no restart loop, set
NO_RESTART=1. - Auto-reload on code changes is enabled by default; set
AUTO_RELOAD=0to disable. - Headless auto-set loop is enabled by default (
KIWISCAN_AUTOSET_LOOP=1): it re-applies/auto_set_receiversserver-side without any browser clients when Automation hasAuto-Run each blockand/orApply on startupenabled. - Adjust the headless loop interval (seconds) with
KIWISCAN_AUTOSET_LOOP_S(default:30, min:5, max:600).
Automation note:
- SSB scan now supports Adaptive threshold (Automation tab) which smooths per-band thresholding from live SNR conditions to reduce jumpy squelch behavior.
Observability note:
- A lightweight metrics endpoint is available at
/metrics(Prometheus text format), including decode rate, receiver restart counters, and API latency gauges. /metricsalso exports health gauges (health_active_receivers,health_unstable_receivers,health_overall{state=...})./metricsexportshealth_stale_secondsfor freshness-based alerting.
Receiver watchdog note:
- RX workers now use per-receiver restart cooldown/backoff to avoid tight crash loops; watchdog backoff/failure counts are exported in
/metrics. - A human-readable health summary is available at
/health/rx. - The web UI header shows a live RX Health badge sourced from
/health/rx. - Click the RX Health badge to show/hide unstable receiver details.
- The details panel includes a "Last refresh" timestamp for health data freshness.
- The details panel also shows relative age (e.g.,
3s ago) and updates it live while open. - Health freshness warning thresholds: delayed at 15s, stale at 30s.
- Header includes a unified status strip (Server, RX Health, Decode Stream, Last Update).
- UI polish pass adds consistent controls, card-like panel surfaces, sticky header, and decode empty/loading state.
- Config tab includes a
Themecontrol (Light/Auto/Dark) with local persistence. - In
Autotheme mode,Night starts (hour)controls when the UI switches to dark mode (local time). - Config tab includes a
Densitycontrol (Normal/Dense) with local persistence for compact operator layouts. - Config tab includes a
Reset UIbutton that clears UI-only preferences (e.g., theme, density mode, map filters/hints). - Schedule tab now includes an
Info Metricscard sourced from/metrics(decode rate, totals, restart count, API p95, RX health counts, stale seconds). - Info Metrics card uses visual thresholds for quick triage: API p95 (
warn>= 400 ms,error>= 1000 ms), health stale (warn>= 15 s,error>= 30 s), and RX instability (warn/errorwhen unstable receivers are present). - Info Metrics labels include hover tooltips describing each metric and are keyboard-focusable for accessibility.
- Info Metrics header includes a compact
?help button that toggles an at-a-glance definitions panel. - Info Metrics help panel open/closed state is persisted in browser local storage and is cleared by
Reset UI. - When switching away from the Schedule tab, the help panel closes temporarily; returning to Schedule restores your saved help-panel preference.
- Clicking outside the help panel closes it.
- Lightweight toast notifications confirm key UI actions (save/reset/restart/start/stop/clear) for operator feedback.
- GridSquare display now prefers live Kiwi GPS/grid from
/statusvia/config(kiwi_gridorkiwi_latitude/kiwi_longitude) and falls back to configured latitude/longitude. - GridSquare now re-checks
/configshortly after startup and then periodically, so transient startup fetch failures no longer leave it blank. - Map tab includes an
Agefilter (All,15 min,1 hour,6 hours,24 hours) to limit visible spots to recent activity. - Map tab includes an
Auto-fitbutton that zooms/pans to the currently visible filtered spots. - Opening the Map tab auto-fits the viewport to currently visible filtered spots (when available).
- Map metadata shows an
Auto-fittimestamp after each successful fit operation. - Changing map filters clears the
Auto-fittimestamp until the next successful fit. - Map legend items (
WSPR,FT8,FT4,SSB) act as mode selectors for display filtering. - Map legend includes a small hint line to indicate legend items are clickable mode filters.
- The legend hint auto-hides after the first legend click and stays hidden across reloads;
Reset UIshows it again. - Map tab remembers
Band, legend-selectedModes, andAgefilter selections across reloads;Reset UIrestores them to defaults. - If the Map tab is active,
Reset UIalso performs a silent auto-fit using the reset/default filters. - Map mode selection always keeps at least one legend mode active to avoid an empty/none mode state.
- Added an
SSB Waterfalltab (MVP) to visualize liveSCAN SSBdetections while band scanning. SSB Waterfallsupports band selection, continuous full-bandPHONEscan start/stop, a live scan-cursor line from/band_scan/status, and click-to-tune (startsrx_monitorat clicked frequency).- Sideband guardrails are enforced: below
10 MHzusesLSB, above10 MHzusesUSB,60mis forced toUSB, and30mPHONE operation is blocked. SSB Waterfallnow uses rolling percentile auto-contrast and displays live floor/median/p95/SNR stats to keep weak activity visible across changing band noise levels.SSB Waterfallincludes aContrastselector (Auto/Fixed) for quick visual A/B between adaptive and baseline intensity mapping.SSB WaterfallincludesQuick Scoutfor a rapid strong-signal first pass (PHONE probe anchors, short frame window) before starting continuous full-band scan.Quick ScoutsupportsFast,Balanced, andDeeppresets to trade scan speed for confidence before full monitoring.- The selected
Quick Scoutpreset is persisted in browser storage and restored on reload (Reset UIreturns it to defaultBalanced). - Hovering over SSB waterfall dots shows a tooltip with frequency, relative level, and how recently the hit was seen.
- SSB Waterfall meta now shows
Active RX(fixed receiver or auto/fallback) from live/band_scan/statusprogress, making scan receiver behavior easy to verify without relying only on Kiwi admin page frequency lines. - SSB Waterfall includes
Copy Status JSONto copy the latest/band_scan/statussnapshot for troubleshooting and sharing. /band_scan/statusnow includeslast_progress, so even after a scan ends (running=false) you can still verify the most recent center frequency and RX selection/fallback behavior.- Band Scan now also writes a grouped results artifact
outputs/band_scans/band_scan_results_<band>_<timestamp>.jsonalongside the raw per-run scan report. GET /band_scan/resultsreturns the latest grouped Band Scan results payload, including the persisted report path and selection-friendly discovered frequencies for follow-up tuning or automation.- Pro Console
Receiver Scannow includes aBand Scan Results JSONcard withRefresh JSON,Copy JSON, andOpen JSONactions backed by/band_scan/results. - SSB Waterfall meta includes
Last Scan(time, last center frequency, and RX mode/fallback) for quick at-a-glance verification without opening JSON. - SSB Waterfall controls include an
RXselector (Autoor fixedRX0..RX7) used by bothQuick Scoutand fullStart PHONE Scanrequests. - Default SSB Waterfall RX mode is
RX0(notAuto) so scan activity remains pinned to a visible receiver unless you explicitly change toAuto. - With fixed
RXnselected, scanner auto-fallback is disabled for that run; fallback toautoonly occurs whenRXmode is explicitly set toAuto. - Before starting a fixed-RX scan, UI now checks
/health/rx; if the selected RX appears busy, it first prompts to switch to the first free RX. - Busy preflight is advisory for stale/unstable entries, but an actively busy fixed RX now requires explicit force-override confirmation to start on that same RX.
- SSB scan sensitivity is tuned to reduce missed audible voice activity (lower voice-score threshold and fewer required hit frames in phone/SSB detector mode).
- When a fixed RX is selected, scans now briefly hold that RX between window hops so the Kiwi admin receiver list is less likely to appear idle during hop transitions.
Example:
NO_RESTART=1 PORT=4020 ./run_server.shThe project generates logs/results under outputs/ and may create detections*.jsonl.
Dry run:
python3 tools/cleanup.py --dry-run --outputs --detectionsDelete outputs (optionally keep thresholds config):
python3 tools/cleanup.py --outputs --keep-thresholdsDelete the local virtualenv (recreate it via Quick start):
python3 tools/cleanup.py --venvCreate a kiwi_scan-only ZIP in /opt/ShackMate/backup (excludes .venv-py3, .venv, and outputs by default):
python3 tools/make_kiwi_scan_backup.pyUnit tests (fast, offline):
cd /opt/ShackMate/kiwi_scan
source .venv-py3/bin/activate
# Install test extras (preferred)
python -m pip install -e ".[test]"
PYTHONPATH=src python -m pytest -q- There is a PyPI name collision: a package named
kiwiclientexists that is NOT the KiwiSDR client. - This repo vendors a known-good KiwiSDR client under
kiwi_scan/vendor/kiwiclient-jks(provides thekiwipackage). kiwi_scanwill prefer the vendoredkiwipackage automatically.
PYTHONPATH=src python3 -m kiwi_scan scan \
--host 192.168.1.93 \
--rx 0 \
--center-hz 7100000 \
--span-hz 12000 \
--threshold-db 10 \
--required-hits 3 \
--jsonl detections.jsonlShow per-frame top peaks and an ASCII sparkline while parked on 7.154 MHz:
PYTHONPATH=src python3 -m kiwi_scan scan \
--host 192.168.1.93 \
--rx 0 \
--center-hz 7154000 \
--span-hz 12000 \
--show --show-top 5 \
--sparkline --spark-width 100 \
--max-frames 200
To let the server choose any available receiver (disable explicit RX tuning), add:
PYTHONPATH=src python3 -m kiwi_scan scan --host 192.168.1.93 --no-rx --center-hz 7154000 --span-hz 12000Probe each band’s FT8 dial frequency and report a simple activity score:
PYTHONPATH=src python3 -m kiwi_scan ft8 \
--host 192.168.1.93 \
--rx 0 \
--dwell-s 20 \
--span-hz 3000 \
--threshold-db 6Limit to specific bands:
PYTHONPATH=src python3 -m kiwi_scan ft8 --host 192.168.1.93 --bands 40m,20m,10mContinuous monitoring to JSONL (one line per band measurement):
PYTHONPATH=src python3 -m kiwi_scan ft8 \
--host 192.168.1.93 \
--rx 0 \
--dwell-s 20 \
--repeat 0 \
--cycle-sleep-s 2 \
--jsonl-out outputs/ft8_activity.jsonl \
--quiet
tail -f outputs/ft8_activity.jsonl
## Optional recording
If `kiwirecorder.py` is on your `PATH`, you can record a short WAV when a persistent peak is detected:
```zsh
kiwi-scan scan \
--host YOUR_KIWI_HOST \
--center-hz 7100000 \
--span-hz 12000 \
--record \
--record-seconds 30 \
--record-mode usb \
--record-out recordings
Current limitation: the first minimal build records at the scan center frequency (not the detected peak center) — next iteration will map bin_center to Hz within the span.
Sweep 7.000–7.300 MHz in ~12 kHz chunks with overlap:
PYTHONPATH=src python3 -m kiwi_scan sweep \
--host 192.168.1.93 \
--start-hz 7000000 \
--end-hz 7300000 \
--span-hz 12000 \
--overlap 0.25 \
--dwell-frames 40 \
--threshold-db 10 \
--required-hits 3 \
--cache-ttl-s 120 \
--cache-quantize-hz 25To enable recording and use the vendored kiwirecorder.py:
PYTHONPATH=src PATH="/opt/ShackMate/kiwi_scan/vendor/kiwiclient-jks:$PATH" python3 -m kiwi_scan sweep \
--host 192.168.1.93 \
--start-hz 7000000 \
--end-hz 7300000 \
--record \
--record-seconds 30