Open
Conversation
Real-time Polar Alignment Assistant status from Ekos/KStars logs. Watches KStars log files and streams updates via WebSocket. Features: - DMS display format (degrees, arcminutes, arcseconds) matching Ekos - Parses total error from log; uses computed value as fallback - Direction arrows for azimuth and altitude adjustments - Age counter and heartbeat for live connection status - Tail-only parsing when clients connect (avoids replaying old data) - Error messages for files not found, or no update matches - Compative with native and flatpak installs - Auto-detect last session log file - Accuracy target with color coding (green/yellow/red)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PAA (Polar Alignment Assistant) Live Monitor
Summary
This PR adds an optional PAA Live Monitor: when enabled, INDI Web Manager tails the KStars/Ekos log file, parses Ekos "PAA Refresh" lines, and exposes a live view (web page plus REST/WebSocket API) of polar alignment error—total, altitude, and azimuth in DMS and arcseconds, with correction directions. The feature is opt-in: the server must be started with
--with-paa; otherwise behavior is unchanged.What it does
PAA Refresh,Corrected az:,alt:, andtotal:in DMS (e.g.01° 06' 24").GET /api/paa/statusreturns current status and latest PAA values (or "waiting" / "disabled" when applicable)./ws/paastreams updates (new data, heartbeat, or status messages such as "waiting" / "stale")./paashows Total, Altitude, and Azimuth error with direction arrows, optional accuracy target (arcsec), and a "Back to INDI Web Manager" link. Layout is responsive and usable on mobile (including bottom padding so content isn’t hidden by Safari’s toolbar).Ekos configuration required
For the monitor to see data, users must:
If Log to file is off or PAA hasn’t been run, the UI and API report that no PAA data was found and direct users to enable Log to file and run PAA.
Configuration
--with-paaEnables the PAA monitor. Without it, the app behaves as before (no
/paa, no PAA API, no log tailing).--kstars-logs DIR [DIR ...](optional)One or more log base directories (each expected to contain
YYYY-MM-DDsubdirs with*.txtlogs). If omitted, the app searches:~/.local/share/kstars/logs(native KStars)~/.var/app/org.kde.kstars/data/kstars/logs(Flatpak)Example:
indi-web --with-paaor
indi-web --with-paa --kstars-logs /path/to/kstars/logsAPI
GET /paaHTML page for the PAA Live Monitor.
GET /api/paa/statusJSON:
state(active|waiting|disabled), optionalmessage, and whenstate === 'active':timestamp,az,alt,total(DMS strings),total_arcsec,az_direction,alt_direction. Does not mutate tail state.WebSocket /ws/paaJSON messages:
typeupdate(live PAA payload),status(waiting/stale + message), orheartbeat. Payload fields match the REST shape (az,alt,total,total_arcsec, directions).UI integration
/paa(seeindiweb/views/form.tpl).localStorage), and back link. Uses WebSocket for live updates and handles waiting/stale/active states.env(safe-area-inset-bottom)and extra space so the accuracy target and back link remain visible above Safari’s bottom bar on iPhone.Files changed
indiweb/paa_monitor.py(new): Regex, log discovery, tailing,PaaMonitor,_match_to_dict, REST and WebSocket endpoints.indiweb/views/paa.tpl(new): PAA Live Monitor page (HTML/CSS/JS).indiweb/main.py:--with-paa,--kstars-logs, lifespan shutdown of PAA monitor, conditional creation ofPaaMonitorand inclusion of PAA router.indiweb/state.py:paa_monitoron app state (optional).indiweb/views/form.tpl: PAA button linking to/paawhen PAA is enabled.README.md: New "PAA Live Monitor" section (description, how to enable, Ekos "Log to file" requirement,/paaand API, mobile screenshot).img/paa-monitor-mobile.jpeg(new): Screenshot of the PAA page on mobile for the README.tests/test_paa_monitor.py(new): Tests for regex, log discovery, tail behavior,_parse_latest,get_status, REST, WebSocket (including heartbeat), and page render.Testing
tests/test_paa_monitor.pyCovers: PAA regex (real Ekos format, negative azimuth, rejection of non-PAA lines), date-dir pattern, discovery of latest log (single and multiple dirs),
_parse_latest(dict shape, DMS strings, negative zero DMS), tail-only when client connected, no log / empty dir, wrong format; RESTGET /api/paa/status(active with data, waiting when no logs);GET /paaHTML; WebSocket connection, diagnostic when log dir missing, and receipt of heartbeat/status. All tests use--with-paaand, where needed,--kstars-logswith temporary directories.Run with:
pytest tests/test_paa_monitor.py -v