1037 Commits
Author SHA1 Message Date
agessaman 034962a3dc fix(web-viewer): keep the Windows parent check type-clean on Linux
CI type-checks on Linux, where the ctypes stubs have no get_last_error, so mypy failed on the parent watcher's access-denied check. The check now sits behind sys.platform == "win32", which mypy understands and which is always true where the function runs.
2026-11-14 09:30:41 -08:00
agessaman 0809618d3a feat(templates): add {path_names} placeholder for short repeater names
{path_names} renders a message's route as compact repeater names, BlackHls▸KalamaSum▸KelsoG3 instead of a1b2,c3d4,e5f6 (3 hops), for [Test_Command] response_format and [Keywords] replies. A hop gets a name only on a 2- or 3-byte path, and only when its prefix has a single recent repeater or a collision resolves with at least path_names_min_confidence (default 0.9). Every other hop keeps its hex prefix, so no hop shows a guessed name. A direct message renders Direct, like {path}.

Names come from the same candidate query and selection as the web viewer's path decode; the candidate query is now candidate_repeaters() in path_inference so both share it. modules/name_shortener.py compacts each name (ASCII fold, emoji and filler dropped, callsigns dropped when another word names the node, CamelCase, place-word abbreviations, then vowels and letters) and packs the route into path_names_max_bytes, eliding hops after the first when names alone can't shrink enough. The lookup only runs when the template contains {path_names}.
2026-11-14 08:45:08 -08:00
agessaman 8845a3f316 feat(docker): report event-loop liveness in the container healthcheck
The healthcheck only proved PID 1 existed, so a wedged event loop stayed healthy. The bot now touches <db_path>.heartbeat every 30 seconds from its event loop, starting before the radio wait, and python3 -m modules.healthcheck fails once the file is more than two minutes old. An offline radio does not make the container unhealthy, since the bot reconnects on its own. The check reads the config path from MESHCORE_BOT_CONFIG, which the add-on image sets to /config/config.ini.
2026-11-14 08:45:02 -08:00
agessaman 07ab4e34d5 fix(web-viewer): exit when the bot that launched the viewer is gone
A bot killed with kill -9 on a manual run left its web viewer holding the port, and the next start could not bind it. The bot now passes its PID as --exit-with-parent and the viewer exits once that process is gone. A viewer started on its own is unchanged. A bot-launched viewer skips the Werkzeug reloader in debug mode, since the reloader would make the server a grandchild of the bot and the parent check would watch the wrong process.
2026-11-14 08:45:02 -08:00
agessaman 317b1a2a56 fix(core): refuse to start a second instance on the same database
Two bots on one radio evict each other from single-client companion servers such as openhop, which closes the older connection when a new one arrives. Each instance then reconnects and evicts the other in an endless loop.

Startup now takes an advisory lock on <db_path>.lock beside the bot database and exits 1 with the holder's PID when it is already held. The OS releases the lock on any exit, so a killed bot leaves nothing stale. The lock is taken before a pending restore is applied, so a second launch cannot replace the database under a running bot. A lock file that cannot be created is only a warning.
2026-11-13 05:58:47 -08:00
Adam Gessaman 863100ef37 Merge pull request #260 from agessaman/feat/flexible-scheduling
feat(scheduler): add positional day-of-month and date bounds
2026-11-11 21:28:30 -08:00
agessaman 615d9c77f2 Merge remote-tracking branch 'origin/dev' into feat/flexible-scheduling
# Conflicts:
#	CHANGELOG.md
2026-11-11 21:17:00 -08:00
agessaman 0c070bb281 Merge remote-tracking branch 'origin/dev' into feat/repeater-offline-reporting
# Conflicts:
#	modules/web_viewer/templates/base.html
2026-11-11 21:16:14 -08:00
Adam Gessaman adfbe20e85 Merge pull request #367 from agessaman/feat/home-assistant-addon
feat: Home Assistant add-on
2026-11-11 21:15:11 -08:00
agessaman 1c75249695 fix(bridges): match hashtag channels and log unmapped ones at info
Discord compared mapping names to the channel name exactly, ignoring case, so bridge.test never matched the #test channel. Telegram already ignored a leading #. Both bridges now share one matcher: an exact match ignoring case wins, otherwise a leading # is ignored on both sides.

A message from a channel with no mapping was dropped with only a debug log, so a mapping that never matched went unnoticed. The first message from each unmapped channel is now logged at info with the configured mappings; repeats stay at debug.
2026-11-10 19:19:36 +00:00
agessaman 3dc43ec6ef fix(web_viewer): accept hashtag channels in bridge mappings
The Plugins page rejected a Discord or Telegram bridge mapping for a channel such as #test with "cannot start with # or ;". The check ran on the key as typed, before the bridge. prefix was added, though the option actually written (bridge.#test) is valid. Typing the prefix by hand to get around it wrote bridge.bridge.#test, which never matched.

The leading # / ; check now runs on the full option name, in the page and on the server, so it still applies to sections with no prefix. A prefix typed by hand is dropped before saving.
2026-11-10 19:19:36 +00:00
agessaman c31679980e fix(web_viewer): don't queue a radio connect while startup is retrying
While startup waits for the radio, the Radio page shows Connect, but nothing processes the queued operation until the scheduler starts, and it then tore down the link startup had just opened. The connect endpoint now answers 409 while bot.initializing is set, and start() marks any radio connect or disconnect still pending at that point as interrupted.

Also drops the DOCS.md note about /addon_configs on older Supervisors (they don't accept app_config at all) and updates the README's reconnect_max_retries comment to cover startup.
2026-11-10 00:32:38 -08:00
agessaman 7f1d9ad946 fix(core): keep retrying the radio at startup instead of exiting
A test under a real Home Assistant Supervisor showed the watchdog allows 10 restarts per 30 minutes. The bot exited about a second after a refused connection, so a radio that wasn't ready after a reboot used all 10 in about 11 seconds and left the add-on down for half an hour. A failed first connect now falls back to the existing reconnect loop and its [Connection] settings; the bot exits 1 only when reconnect_max_retries runs out, and a shutdown while waiting exits 0.

Also from that test:
- The manifest maps app_config, the name Supervisor 2026.11 uses; addon_config logged a legacy warning. The CI linter accepts both.
- The docs say to turn on Show in sidebar, which the Supervisor leaves off.
- The second start_viewer() call logs at debug instead of warning on every start.
2026-11-09 23:48:38 -08:00
agessaman fc8a7a3751 refactor(ha_addon): simplify the add-on and managed-key code
- managed_keys owns the env var and file name, so the shared module no longer imports the add-on entrypoint; is_managed takes the loaded set instead of re-reading the file.
- One write_text_atomic() in ini_writer, used by update_ini_values and the add-on.
- as_bool uses configparser's BOOLEAN_STATES.
- Drop the app-level ManagedKeyError handler (every writer already handles it) and fold require_auth's early returns.
- Tests read config.yaml with PyYAML (added to the test extra) instead of a hand-written parser, and share setup helpers.
2026-11-09 21:39:26 -08:00
agessaman 01f45732a8 fix(managed_keys): match sections case-insensitively like the INI writer
update_ini_values matches sections ignoring case, but the guard compared them exactly, so a write to [web_viewer] port slipped past a managed [Web_Viewer] port and still rewrote the real key. Both now share one section normalization.
2026-11-09 21:21:47 -08:00
agessaman 0719e20073 fix(web_viewer): refuse direct access in ingress mode without a password
With ha_ingress on and no web_viewer_password, the viewer used to fall back to open mode for anything that wasn't the Supervisor, so other add-ons on the internal network, or the LAN once the port was published, got full admin access. One _auth_enforced() decision now drives both the HTTP hook and Socket.IO connect: ingress requests stay signed in, and other requests need a password login or get a 403 that says to set one. With ha_ingress off, nothing changes.
2026-11-09 20:46:56 -08:00
agessaman 2575e86a03 fix(ha_addon): close review gaps in ingress, backups, and exit status
- mypy is clean again (the CI typecheck job was red on new lines).
- The overlay's config backup goes to /data/backups/local, so it no longer overwrites the base config backup taken in the same second.
- One ha_ingress_enabled() helper; a malformed ha_ingress value counts as off instead of disabling the whole web viewer.
- An exception that escapes the bot (e.g. a BLE adapter error) now exits 1 too.
- The web manifest's icon paths are relative, so they resolve with or without a path prefix.
- The root-relative URL scan also catches .href/.src/.action assignments, EventSource, Worker, Audio, Image and io().
2026-11-09 20:38:11 -08:00
agessaman 966fa1726a feat(web_viewer): keep Home Assistant managed settings read-only
The add-on rewrites the keys it owns on every start, so editing them in the viewer would be silently undone. modules/managed_keys.py loads the list the add-on exports (MESHCORE_HA_MANAGED_KEYS) and guards writes in one place: ConfigIniStore.write_sections refuses to change or delete a managed key, and the viewer's other config.ini writers now go through that store instead of calling update_ini_values directly. The plugins page shows managed fields as disabled with "Managed by Home Assistant". With the variable unset, nothing changes.
2026-11-09 20:12:30 -08:00
agessaman 3177134cf8 fix(core): exit 1 when the radio is unreachable at startup
A failed startup connection used to end the process with status 0, which launchd (KeepAlive SuccessfulExit=false) and the Home Assistant watchdog both read as an intentional stop, so neither restarted the bot. start() now returns whether the bot ran, and the entrypoint exits 1 when it didn't. Shutdown by signal still exits 0.
2026-11-09 20:04:40 -08:00
agessaman c017337a44 fix(ha_addon): seed, escape, and win over the local overlay
- Ship config.ini.example in the image so a fresh install can seed config.ini.
- Double % in written values; the bot reads config.ini with interpolation, so a password like abc%xyz used to break every read.
- Delete add-on-managed keys from <local_dir_path>/config.ini, which the bot merges over the base file and would otherwise override them.
- Move local_dir_path to /config/local so custom plugins and translations are reachable from File Editor or Samba.
- Rename the ble_address option to ble_device_name to match the config key.
2026-11-09 19:56:20 -08:00
agessaman 9ff8dcc7f2 feat: add a Home Assistant add-on
Adds repository.yaml and homeassistant/meshcore_bot/ so the repo can be added to the Home Assistant add-on store. The add-on runs a 64-bit image built FROM the release image (Dockerfile.ha). On start, modules/ha_addon.py seeds config.ini, applies add-on options and fixed paths from one mapping table, records which keys Home Assistant owns, and execs the bot. Unset options leave config.ini alone.

CI builds and pushes the add-on image for amd64 and arm64 after the base image and lints the manifest. update_ini_values gains backup_dir so add-on backups land under /data.

Refs #366
2026-11-09 19:26:13 -08:00
agessaman 8fdcbe916f feat(web_viewer): serve the viewer behind Home Assistant ingress
New [Web_Viewer] ha_ingress flag. When it's on, requests from the Supervisor (172.30.32.2) carrying X-Ingress-Path get SCRIPT_NAME set from that header, count as authenticated (Home Assistant already logged the user in), and Socket.IO accepts the public Home Assistant origin. Templates use url_for, and browser code goes through window.appUrl and the existing fetch wrapper, so every link, redirect, API call and socket honors the prefix. With the flag off, nothing changes.

A regression test fails on new root-relative URL literals that bypass those helpers.
2026-11-09 19:26:13 -08:00
agessaman 8ce1e06580 fix(radio_link): handle each channel command once after reconnect
Overlapping reconnects subscribed to the same radio twice, so every channel command was handled twice until restart. Relinks now take one lock, a connection finishes setup only on the instance it opened, and handler setup is idempotent per instance. A channel or direct message repeated within 5 seconds is dropped.

Fixes #364.
2026-11-08 11:10:43 -08:00
agessaman b36c18d1fc style(repeater_watch): polish the page for phones and dark mode
Watched repeaters and recent outages stack into one block per row below 576px, so the quiet meter and Remove stay on screen instead of behind a sideways scroll. Watched rows sort worst first (offline, quiet, never heard, heard), the picker's Watching state carries a check and doesn't wrap, the recovery checkbox sits on its own row, and places read "Issaquah, WA" as in the picker.

Input-group addons (hours, min, search icons) now take the dark theme everywhere; only Contacts styled them, so Region Warnings, Greeter and Plugins showed light boxes in dark mode.
2026-11-05 18:11:06 -08:00
agessaman e71c1a71b3 feat(repeater_watch): report watched repeaters that go offline
Adds [Repeater_Watch] and a Settings → Repeater Watch page (#353). A watched repeater counts as offline once it has gone offline_after_hours with no advert and no relayed traffic; relaying is matched by public key, or by a 2- or 3-byte prefix no other known repeater shares, and never by one byte. One notice goes out when it goes offline and one when it is heard again, to channels, DMs, Discord and Telegram.

The bot only judges silence it was listening for: the clock starts at startup, reconnect or radio recovery (a quick restart keeps it), and checks are skipped while the radio is down or the bot has heard no node for two hours. State and recent outages persist in bot_metadata so a restart doesn't repeat a notice. Settings are read on every tick, so saving the page applies without a restart.
2026-11-05 18:11:06 -08:00
agessaman 9773107084 fix(web_viewer): tidy the schedule editor's new controls
The date range and Weeks fields now sit behind a "Date range and weeks" toggle right under the timing controls, with a summary of any limits beside it, so the common path is shorter on a phone and a limited schedule still shows its limits when collapsed. The section opens for entries that have limits, and once when Weeks is combined with one day a month so the warning is seen.

The "no 5th one" hint only shows for a 5th weekday and names it. In the table, cron fields and dates no longer break at a hyphen, an open-ended range reads "from" or "until", the message column keeps a readable width on phones, and the page header wraps instead of squeezing the button. The monthly warning is only in the Weeks description while it shows, and the toggle reads out the summary.
2026-11-04 21:18:34 -08:00
agessaman 7af1f46fdd fix(scheduler): close the gaps the second review round found
- An end date closes at the last second before the next local day begins, worked out in UTC. "23:59:59" did not exist on a day whose DST change skips the last hour (America/Nuuk, 2027-03-27), and APScheduler moved it past midnight, letting the schedule fire on the following date.
- APScheduler reads "last" and the ordinals as prefixes, so "last--fri", "lastfri" or "last-" quietly meant the last day of the month. Anything starting with an ordinal must now be "last" or a full positional day. A positional day combined with a day-of-week ("1st-tue * mon") never matches and is rejected.
- A schedule with no future run is invalid in the editor and skipped with a reason at startup, not only when it has date bounds.
- An option with nothing after it ("start=2027-01-01") gets its own error, and a channel that would read as week= is refused like start= and end=.
- The editor resets every builder control on each open, so a new entry no longer inherits the last edited entry's days or monthly choice, and it recognizes the several-times-a-day and every-N modes when reopening an entry. The preview runs the save-time entry checks once channel and message are filled in. With one day a month, a note explains that Weeks skips most months.
- The every-other-week docs example no longer repeats an INI key, a weather-service link follows the moved section, and the changelog says plainly that a key written as last-fri changes meaning: it used to run on the month's last day.
2026-11-04 19:41:50 -08:00
agessaman a0a77a7ed2 feat(scheduler): add week=, a monthly builder mode and stricter parsing
Every-other-week schedules: week= on the value takes an APScheduler ISO week-number expression (week=*/2, week=2-53/2), for a strict fortnight that 1st-tue,3rd-tue cannot give. The schedule editor gains a Weeks setting, a "One day a month" mode (Nth or last weekday, or the Nth or last day) and opens an existing entry in whichever mode reproduces it exactly, falling back to Advanced. Invalid schedules now say why, in the editor and in the startup log. Scheduled messages move to their own docs page.

Review fixes:
- A positional day-of-month item must stand alone between commas. APScheduler silently dropped anything after one, so 1st-tue-3rd-tue and last-fri/2 saved and then fired only on the first match.
- A bound is a whole token ended by whitespace with no ":" in it, so a channel such as start=ops stays a channel, and a keyword with no usable value (start= Public:Hi, start =2027-01-01) is an error rather than a channel name.
- Dates must be exactly YYYY-MM-DD. date.fromisoformat also takes 20270101 and 2027-W01-1 on newer Pythons, which APScheduler then failed on with an error that blamed the cron key.
- The preview applies the same window check as saving, so an end before the start is invalid in both.
- An entry must read back as written: the editor refuses a channel that would parse as a bound and an unscoped message starting "#name:", which was read back as a scope.
- Legacy HHMM with a bad bound reports invalid instead of raising; the scheduler logs why a value was rejected; the create/update response includes start, end and week.
2026-11-04 19:41:49 -08:00
agessaman 081ec7c0a5 Merge branch 'dev' into feat/flexible-scheduling
Brings the branch up to date with dev. Conflicts in CHANGELOG.md and the schedule preview route in modules/web_viewer/app.py, resolved by keeping dev's version and adding the start/end arguments.
2026-11-04 19:41:49 -08:00
agessaman 2be738c604 feat(web_viewer): make the Multibyte page public
Multibyte rollout shows per-node hash sizes and traffic counts taken from adverts and paths, the same mesh-visible data the public Mesh Graph serves. With web_viewer_password set it was admin-only and missing from anonymous navigation. The page, /api/multibyte-rollout and the nav link are now public whenever the multibyte monitor is on.

From #350.
2026-11-04 18:05:55 -08:00
Adam Gessaman 716531a558 Merge pull request #359 from Treehouse-00/feat/status-packet-counters
feat(packet_capture): include the radio's packet counters in status stats
2026-11-04 17:58:48 -08:00
agessaman 3ecdf1fb8d fix(mqtt_weather): don't render 0°C as -0.0
Rounding a reading just below freezing (31.95°F) gives -0.0, which printed as "-0.0°C".
2026-11-04 16:46:27 -08:00
agessaman 4b871089b9 fix(weather): let the Blitzortung loop own reconnects and cleanup
paho's network thread reconnected on its own (reconnect_on_failure defaults to true), racing the new backoff and dropping the queued SUBSCRIBE, so a fast reconnect could leave a live session with no subscription. The client is now created with reconnect_on_failure=False and subscribes from on_connect once the broker accepts.

A cancel during the blocking connect() left the worker thread to open a socket nobody closed. The connect future is shielded and the client is closed in a finally block, or once connect() returns if it is still running. Strikes that arrive while an alert is being geocoded and sent are kept for the next pass instead of being cleared with the batch.
2026-11-04 16:46:27 -08:00
agessaman 5bc4a77214 fix(web_viewer): read allow_local_smtp case-insensitively
The backend treats any casing of "true" as on, but the checkbox only matched lowercase, so a stored "True" loaded unchecked and the next save turned the local relay off.
2026-11-04 16:46:27 -08:00
agessaman 3ff267f327 fix(mqtt_weather): round {temperature_c} to one decimal
The default json_template rendered the unrounded conversion on air, e.g. "61.3°F (16.27777777777778°C)". temperature_c now matches the precision of the °F reading. It stays a number, so explicit format specs keep working, and a missing reading still renders empty.

From #351.
2026-11-04 16:19:45 -08:00
agessaman d7533af0ac fix(greeter): keep timedelta importable from greeter_command
5c191e4 dropped the now-unused timedelta import, which the public-API characterization test counts as a removed name, so dev's suite was red. It is back with a noqa, as the other modules keep theirs.
2026-11-04 16:18:36 -08:00
agessaman 4e687c2245 fix(weather): back off Blitzortung reconnects and deliver strikes
A broker that drops the session within a second had the service reconnecting every second indefinitely. Reconnects now back off from 5 seconds, doubling to a 5-minute cap, and reset after a session that stays up for a minute. "Connected" is logged only once the broker's CONNACK arrives rather than when the socket opens, the reconnect warning gives the reason and the paho disconnect code, and the client ID gets a random suffix so two bots started in the same second don't knock each other off.

on_message runs on paho's network thread, where asyncio.create_task has no running loop, so every in-area strike raised and was swallowed at debug level. It now hands the strike to the bot's loop with run_coroutine_threadsafe.

Fixes #362
2026-11-04 16:17:28 -08:00
agessaman aa335b7938 fix(web_viewer): add a control for allow_local_smtp
allow_local_smtp lives in the bot database with the other SMTP settings, not config.ini, and the Email & Notifications panel never sent it, so there was no way to turn it on short of calling the API by hand. The panel now has a checkbox for it, and the upgrade notes say where the setting lives.

Fixes #361
2026-11-04 16:14:23 -08:00
agessaman a7486b757c fix(prefix-collision): record a repeater before announcing it
A second NEW_CONTACT could pass the dedupe check while the first Discord
and Telegram post was still in flight, because the key was stored only
after the send returned.
2026-11-02 22:03:51 -08:00
Treehouse-00 f45124b6a6 feat(packet_capture): include the radio's packet counters in status stats
refresh_stats() asks the radio for core and radio stats only, so status
messages carry no packet counters, and dashboards that show an
observer's received and sent counts have none for the bot. The service
was ported from meshcore-packet-capture in December 2025;
packet-capture added packet stats in June 2026 (3699420), after the
port.

Fetch them with get_stats_packets() the same way as the other two, and
publish them as meshcore-packet-capture does: the library's own keys
(recv, sent, flood_tx, direct_tx, flood_rx, direct_rx, recv_errors)
plus packets_received and packets_sent, the names
meshcore-packet-capture and openhop_repeater publish. The status
example in docs/packet-capture.md showed rx_packets and tx_packets,
names the bot never published; it now shows the real ones.

get_stats_packets() is in every meshcore release the bot allows: it
arrived in 2.2.8 with the core and radio commands. Companion firmware
answers all three from 1.11.0. Older firmware rejects the request with
an immediate error, as it already rejects the other two.
2026-11-01 16:18:10 -08:00
agessaman 5c191e4638 fix(greeter): send delayed welcomes and stop re-arming rollout
The dead-air path marked a new user greeted before the wait, then
skipped the send because that mark looked like a greeting already
delivered. A failed send and a paused channel left the same stuck
mark. Rollout also started again on a later boot, so people who
spoke during it were recorded and never welcomed.
2026-11-01 08:53:31 -08:00
agessaman 8082aa7b47 fix(web_viewer): narrow template preview types so mypy passes 2026-10-24 19:08:38 -07:00
agessaman 332a61eb35 feat(web_viewer): fetch a message row's packet by hash when it's opened on Real-time
The replay on load is the newest 50 messages and the newest 50 packets, and packets reach back far less, so older message and command rows had a hash and no packet. Opening such a row now asks GET /api/packets/by-hash/<hash>?near=<epoch> for that packet's stored receptions and fills in route, path, receptions and Inspect bytes. The near time bounds the scan to the timestamp index, since the hash is only inside the row's JSON (about 6 ms against a full scan's 250 ms on 90k rows).

The fetched receptions fill the row only: they stay out of the spark and the replay's coverage, since they aren't new hearings. The detail says Loading while it waits, that the packet isn't in the bot's log when nothing comes back, or that it couldn't load and reopening retries.
2026-10-24 16:11:16 -07:00
agessaman b057ad9622 fix(web_viewer): explain a message row's missing packet in its detail instead of on the row
"packet not on the tape" didn't say why. On load the page replays the newest 50 messages and the newest 50 packets, and packets reach back far less, so older messages have no packet to join. The row no longer carries the fact; the expanded detail says the packet is older than the ones loaded, wasn't seen on the page (live rows), or was never recorded by the bot.
2026-10-24 16:01:21 -07:00
agessaman bcebeadcab style(web_viewer): polish the dashboard and Real-time after the critique
- Real-time rows put SNR before the hop count. On a phone the end of the line is cut off, and SNR is the reading a quick check wants; it used to show as "SNR …".
- A repeat heard again only lights its "heard ×N" count instead of re-running the whole row's 1.6 s flash, so a busy tape no longer shimmers. In 20 s of live traffic: 26 count bumps, 8 flashes for genuinely new rows. Reduced motion turns both off.
- The health strip says "1 client", not "1 clients".
- American spelling throughout the user-visible text: "One-hop neighbors" and its tooltip and empty message.
- "Multibyte share of packets" in sentence case like the other card titles.
- The hops chart's y-axis reads "% of nodes or packets" instead of chart-library "% of series".
- The route bar's label rounds to one decimal like its legend, so it no longer shows 98% beside 98.4%.
- The note that bot statistics need collect_stats is configuration guidance, not a degraded state, so it drops the warning color.

The full suite passes (5878), and axe-core still finds nothing on any page in either theme.
2026-10-24 14:59:35 -07:00
agessaman 3657bea8ec style(web_viewer): one color per packet type and role, and 20 channel colors that aren't status lamps
The dashboard's payload mix colored its bars by rank, so a packet type's color changed whenever the traffic order did, and disagreed with the multibyte chart further down, which colors the same types by a fixed slot. The sixth rank was also #198754, the status green. Payload types now take their fixed slot from the chart's SERIES_PALETTE, per theme, so each type has one color everywhere on the page. The role mix gives each role a fixed color matching the Mesh page's node fills: repeaters Signal Blue, room servers Route Teal, then companion orange, sensor violet, bot pink, gateway cyan. Unknown and Other stay neutral, any other role takes a spare, and none of these colors is a lamp.

Real-time hashed channel names onto the whole hue wheel, so a channel could come out status green or alarm red; Public was green. Channel dots now draw from 20 colors per theme, ten hues kept clear of the lamp red, amber and green at two lightness steps, each holding 3:1 on the card (4.2:1 light, 5.2:1 dark). A channel starts at its hashed slot, so its color stays the same between visits. If another channel on the page already holds that slot it steps 7 slots on, a clearly different hue, so up to 20 channels never share a color; with a plain hash, two of three channels on the test mesh collided.

DESIGN.md's data-palette section describes both.
2026-10-24 14:52:30 -07:00
agessaman 12672f432f feat(web_viewer): an RX lamp on Real-time and the newest node by name
Real-time's receiver strip gains an RX LED beside the station state, borrowed from the radio's own front panel. It lights for 140 ms on each live reception, and a burst keeps it lit instead of strobing. It is dark when nothing is arriving, which honestly answers "is anything coming in?" on a quiet station. It uses the connected lamp's green because it means receiving, sits behind aria-hidden next to "Last heard", which carries the same information in words, and stays dark under prefers-reduced-motion. Replayed history doesn't light it; it's one class toggle per packet, with no polling.

The dashboard's New nodes tile names the newest arrival from the last day under its count, e.g. "newest: N7JMV-BEACON-RP · 7 hops · 1h ago", so the number has a neighbor behind it. Long names truncate so the tile keeps its height. The snapshot computes it with one indexed query alongside the other contact counts, so nothing new is polled.
2026-10-24 14:48:49 -07:00
agessaman 732ac72b76 feat(web_viewer): a first-run panel and a listening clock for a station that hasn't heard anything
On a fresh install the dashboard was about fifteen identical "No data." boxes and empty donut rings, which read as broken at exactly the moment an operator wants to know the new bot is working. Real-time said "Nothing heard yet" forever, with no sense of whether the silence was normal.

Until the snapshot has seen any node or packet, the dashboard now shows one panel in place of the grid:
- What the station is doing, from the same verdict as the strip: listening, starting, not running (start the bot), or the radio problem in the way.
- What fills in first: nodes from adverts, then paths and hop counts, then one-hop neighbors.
- That timing depends on the mesh.
- For admins, buttons to watch Real-time and check the radio settings; both pages are admin-only, so anonymous visitors get the panel without them.
The grid comes back on its own once anything is heard.

Real-time's empty tape now says "Listening since 2:28 PM (12 min) · nothing heard yet", counting each second from the bot's start time, which /api/banner-status now reports while the bot runs. After ten minutes with nothing, it adds one line of diagnosis: that can be normal on a quiet mesh, otherwise check the frequency and preset in Radio settings, or the Logs. When the bot isn't running or the radio can't receive, it says that instead.
2026-10-24 14:45:16 -07:00
agessaman b42f3c39b2 fix(web_viewer): say when the radio comes back and where the tape has gaps
Recoveries passed in silence. When the banner poll saw the radio come back, the offline or zombie banner simply vanished; clearing the flag by hand replaced the banner's markup with "Offline flag cleared … Refresh to confirm", so a refresh was the only confirmation. Worse, that replacement was permanent: if the radio dropped again on the same page, the banner came back showing the stale success message (and its Since time was gone). The zombie banner had the same bug.

The banner poll now notices when the bot starts running again, the radio answers again, reconnects, or comes back online. It shows one notice for the most basic of these, e.g. "Radio back online at 2:23 PM · offline for 42 min, since 1:41 PM". The notice dismisses itself after 20 seconds or on close. The server keeps no start time for a dropped radio link, so for that case the page notes when it first saw the link down. The clear and restart buttons no longer touch their banner: they wait with a spinner, poll again sooner, and reset once the flag clears, so the banner is intact if the radio drops again.

Real-time records both kinds of event on the tape as small dividers in time order:
- A recovery gets the same line with a green dot.
- A dropped socket gets a line when it reconnects. The reconnect replays the newest 50 rows; if the oldest of them reaches back past the drop, the line says "Link lost 2:28–2:31 PM · nothing missed" (and drops under 15 seconds aren't mentioned). Otherwise the line says which span isn't shown, with an amber dot, and the 10-minute spark draws that span as unknown instead of quiet.
Clear tape removes the dividers, and at most 20 are kept.
2026-10-24 14:33:08 -07:00
agessaman 87aaac3006 fix(web_viewer): stop claiming the station is up when it isn't
The dashboard's health strip and Real-time's receiver strip both said all was well whenever the viewer itself answered. On a database the bot had never run against, the strip showed a green "Online · radio ok" beside "bot down?", and Real-time a green "Listening": /api/health reported "healthy" with no bot at all, and "radio ok" only meant the zombie flag was unset.

/api/banner-status, which every page already polls every 10 seconds, now also says whether the bot is running and whether its radio is connected. The stored start time survives the bot stopping, so "running" comes from the system_health heartbeat the bot rewrites every 30 seconds: older than two minutes, or missing, and the bot isn't there. radio_connected is only reported while it is, since it's the bot's last word on the link. The poll also runs once on load instead of waiting 10 seconds.

base.html turns that into one verdict for both pages: Bot starting, Bot not running (with when it was last seen), Radio not responding, Radio disconnected, Radio can't transmit, or Listening. The lamp colors follow DESIGN.md: red for not working, amber for degraded (sends failing while receiving may still work), green only when the radio is listening. Real-time says "Checking the bot…" until the first answer instead of assuming. Uptime shows a dash while the bot isn't running, in place of "bot down?".

The change chips compared the last two complete days even when one of them had recorded nothing, so a day the bot was down showed as a 100% collapse on every tile. When either day has no packets, adverts or messages, the chips stay neutral and the note under the tiles names the day: "No change shown: nothing was recorded on Oct 23." A fresh install, where both days are empty, gets the neutral chips without the note.
2026-10-24 14:14:43 -07:00