Add the single-instance lock, a terminal close now stopping a bot started from it, the systemd unit's --wait-for-lock (and that install-service.sh only replaces an existing unit with --upgrade), the heartbeat-based Docker healthcheck, and the {path_names} placeholder.
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.
Bring main's commits into dev ahead of the 1.2.0 release PR so it merges cleanly: the waev.app broker docs (#357) and the frontend-lint dependency bump (#308). The only conflict was CHANGELOG.md. The waev.app entry main had under Unreleased now ships in 1.2.0, and since 1.2.0 was never tagged, the entries merged after the cut (the {path_names} placeholder, the instance-lock and viewer fixes, the heartbeat healthcheck) move into its section too, dated 2026-11-14.
{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}.
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.
A service that found another instance running (a manual run during maintenance) exited three times inside the start limit and stayed failed after the other instance stopped. The new --wait-for-lock flag retries the single-instance lock every 5 seconds instead of exiting 1, announcing the wait once, and resolves db_path on every attempt so an edit during the wait is honored. The systemd unit and the Debian package's unit start the bot with it.
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.
The terminal-close probe slept a second and then closed the pty, so a slow child could be hung up before it installed its SIGHUP handler, and on Linux the child's read raises EIO instead of returning EOF. The child now writes a ready byte that the parent waits for, the read tolerates OSError, and the parent reaps or kills the child on every exit path so a hang never outlives the test.
The shutdown handler printed before setting its flags. Once the bot's terminal had closed, that print raised OSError and swallowed SIGTERM and SIGINT, leaving a bot that only kill -9 could stop. The flags are now set first and the print is guarded.
SIGHUP was always a config reload, so a bot started from a terminal kept running unattended after the terminal closed. It now shuts down when SIGHUP arrives and the controlling terminal it started with is gone. SIGHUP stays a reload under systemd, launchd, Docker, and nohup, and when sent by hand while the terminal is open.
macOS still opens /dev/tty after a hangup, so the terminal check also does an empty write. I could only verify it on macOS.
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.
One section with the whole entry format, a table of what each key field accepts, the value options, the message escapes and mesh-count placeholders (previously only in config.ini.example), and the forms the bot rejects with what to write instead. Also drop the paragraph that argued against an exact fortnight, which predates week=, and stop saying keys go straight to CronTrigger.from_crontab.
Add the v1.1.0 to v1.2.0 upgrade notes, leading with the change that makes the Dashboard, Contacts, Mesh Graph and Multibyte pages public when a password is set, and listing the defaults that change what goes on air. Refresh BUGS.md to v1.2.0 and TODO.md's coverage figures from the v1.2.0 run (67%), dropping trace_runner and wx_command from the low-coverage list.
Cut the [1.2.0] changelog section from Unreleased, and bump pyproject, the Home Assistant add-on version (its image is tagged from the release), and the version examples in the docs and build-deb usage.
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.
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.
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.
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.
The add-on store icon and logo reuse the web viewer favicon's robot and palette, with a mesh of three nodes for an antenna. dark_logo.png carries a light wordmark for Home Assistant's dark theme.
- 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.
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.
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.
- 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().
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.
The mkdocs page now covers install and points at the add-on documentation instead of repeating it. DOCS.md gains an options table and matches what the entrypoint does. Changelog entries for ha_ingress and the startup exit status.
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.
The add-on build reuses the job's checkout, QEMU, buildx and login, shares one tag spec with the base image, and builds FROM the base image's sha- tag that the same job just pushed, so the polling step is gone.
- 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.
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
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.
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.
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.
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.
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.
- 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.
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.
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.
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.