Multi-instance terminal UI dashboard for monitoring all ServeWebHook
processes simultaneously. Uses MQTT heartbeats for live instance tracking
and a slow DB poll for static configuration data.
WebhookTUI subscribes to MQTT topic axion/+/heartbeat/webhook/+ to receive
retained heartbeats from every running ServeWebHook instance. An instance is
shown as stale after TuiConstants.HEARTBEAT_STALE_SECS (45 s).
The def_webhook table is polled separately every TuiConstants.CONFIG_POLL_SECS
(60 s).
__init__(self)Initialises theme, console, layout, and internal state. No port parameter —
all instance data arrives via MQTT.
start(self) / stop(self)start() calls _start_mqtt(), renders the initial layout, and launches the
background update thread. stop() disconnects the MQTT client and tears down
the Live context.
_start_mqtt(self) (internal)Connects a paho MQTT client, subscribes to the heartbeat wildcard, and updates
self.instances[instance_id] on each message.
_poll_config(self) (internal)Runs every CONFIG_POLL_SECS. Queries def_webhook WHERE Package = ? for
count and a (WebhookCode, Package, Description) listing.
| Panel | Content |
|---|---|
| Header | Heartbeat, package, Instances: N/M, clock, uptime |
| Sidebar | Active/total counts, DB status, webhook count, TUI uptime |
| Instances | Table of all known instances — instance ID, package, uptime, PID, status |
| Webhooks | Table of registered webhooks (code, package, description) |
| Log | Scrolling log |
| Footer | Last config poll timestamp |
python ServeWebHook.py tui
Press Ctrl+C to exit.