For users: README.md. Progress, open issues and every measurement: PLAN.md. User-visible changes by date: CHANGELOG.md. Reverse-engineering notes: docs/.
Amazon's mixer daemon owns the audio hardware and runs the whole front end (libasp: AEC, beamforming, mic
calibration). hassmic takes the place of the Alexa client PuffinApp as the mixer's client through the reversed C API
of libmixerAPI.so, feeds the 16 kHz post-AEC stream to the stock libpryon.so wake word engine (or, picked on the
settings page, to microWakeWord: TFLite Micro's audio front end and an int8 TFLite interpreter of our own, mww_*.c),
and speaks the ESPHome native API (default) or Wyoming to Home Assistant.
Boot integration (scripts/system/): hassmic.rc (init) starts boot.sh (fixed, on /system), which picks the factory
copy or a verified push update and runs main.sh (updatable): main.sh firewall keeps the egress lock in place and is
the root side of push updates, main.sh satellite stops Alexa, updater and telemetry and keeps hassmic running.
No hassmic.conf = stock behaviour. sysinstall.sh writes the system partition from the running OS (otatool remount;
dm-verity is off): for install-system.sh, and for every update (pushed or online) once it passed its self test
(main.c: wake word engine loaded, ports bound, a second of mic audio; ota_healthy() leaves state/ota/healthy with
the build's version, root's ota_watch promotes the installed update only on its own), which renews the factory copy and the bootstrap (boot.sh, otatool, hassmic.rc) over Wi-Fi.
Everything that differs between Echo models lives in devices/<codename>/: build settings, hardware constants linked
into the daemon (board.c), service names and install method for the scripts (device.conf), init rc and SELinux
rules. DEVICE picks one (default donut). The adb scripts check it against the connected Echo. Porting guide:
devices/README.md.
| Path | What |
|---|---|
devices/ |
one directory per Echo model (donut, biscuit, radar): device.mk, board.c, device.conf, hassmic.rc, sepolicy.rules, setup.sh, install instructions |
src/hassmic/ |
the daemon: core (capture, wake word, playback, LEDs, buttons), sound_pryon.c (optional sound detection, docs/re-aed.md), whisper_pryon.c (whisper detection with Amazon's model, docs/re-whisper.md), proto_esphome.c, proto_wyoming.c, arb.c (wake word arbitration between Echos), dropin.c (Drop In: calls between Echos of the arbitration network), call.c (a call's audio: gate, echo suppressor, jitter buffer, playout, and the call microphone: Amazon's call path, the mixer's micHfp on the Dots and the Echo 2, a VOICE_COMMUNICATION recorder beside a HOTWORD one on the Android models, audio_android.c, docs/re-checkers.md "Calls"), duck.c (music ducked on the other Echos that heard the wake word), settings.c (settings by name, state/config), web.c (the settings page; its files in web/), artifacts.c (models copied between Echos by the page), davs.c (models downloaded from Amazon by the page, with dha.c for the device attestation its login needs, docs/re-davs-login.md), earsup.c (experimental: our own wake sound taken back out of the mic audio sent to the pipeline), micdenoise.c (RNNoise on the mic audio sent to the pipeline), micgain.c (gain of the mic audio sent to the pipeline), wakealign.c (where the wake word ends: its phones aligned with a cut-down Montreal Forced Aligner model, tools/wakealign/), wordtail.c (the same by the level, without a model), micend.c (experimental: the end of a request heard on the Echo, by the talker's level and Amazon's VAD), afemeta.c (the front end's record in the micAsr samples' lowest bits, docs/re-vad.md), sendspin.c (kept in sync by a rate of its own: resample.c), mass.c (Music Assistant's own API for the screen's music pages, json.c reads it), a2dp.c (Bluetooth speaker both ways), hfp.c (phone calls over Bluetooth: the Echo as hands-free unit, its audio by scoaudio.c and, on the Echo Dot 2, cvsd.c or wideband msbc.c on sbc.c; docs/re-hfp.md), btout.c (playing on a Bluetooth speaker: the mixer's A2DP route, docs/re-a2dp-source.md), ble.c, push updates (ota.c), online updates (update.c), http.c (the one HTTP/1.1 client for everything HTTPS: updates, the plugin index, media, Amazon's downloads, Music Assistant's images) on tls.c (TLS 1.2 and 1.3 on mbedTLS; issue #236), adbwifi.c (the debug access switch), improv.c (setup from a phone: Improv Wi-Fi over ble.c's peripheral role), netaddr.c (a new IP address: links over the old one closed, mDNS announced again until Home Assistant is back), wifimotion.c (experimental motion sensor from the Wi-Fi driver's receive level), wake.c (picks the wake word engine by the model: wake_pryon.c, or wake_mww.c = microWakeWord with mww_features.c (its audio front end), mww_model.c (its int8 .tflite models) and mww_store.c (its models in state/mww, managed by the page)) |
src/ui/ |
the Echo Show's screen UI, a process of its own (hassmic's screen.c starts it; ui.h lists the parts): scene.c (display list diffed per frame into one dirty rectangle, caches, touches, scrolling), widgets.c (icons, buttons, sliders, keyboard), face.c, drawer.c (pulled from the top edge: home, music, DND, apps), music.c (Music Assistant: playing, queue, library, search, speakers), words.c (what was said, the reply and the timers on a see-through layer of their own), gfx.c (anti-aliased drawing into the gralloc buffer), android.c (libhmui.so: JNI for the layers, text, images, apps, the screenshot; loaded by scripts/device/screen.dex, tools/mkscreen.py), touch.c (the touchscreen's evdev node, protocol B; tests/unit/touch_test.c); tools/uishot.c draws every view on the PC |
src/kmod/ |
kernel modules for Wi-Fi motion, hooking the Wi-Fi driver's receive path: hassmic_rcpi.c (biscuit, radar), hassmic_rcpi4m.c (donut; checkers, crown, cronos, athena, cannoli as 32-bit ARM; cupcake); built by make when the model's kernel sources and compiler are in toolchain/, see below |
src/tools/ |
mixcap, mixplay, pryon_test, aed_test (stock sound detector, docs/re-aed.md), whisper_test (whisper detector, docs/re-whisper.md), latency, otatool, runas (AIPC refuses uid 0, the image has no su), curlspy, hciscan (raw HCI on /dev/stpbt), a2dpprobe (stands in for the Bluetooth stack on the mixer's A2DP output) |
src/include/ |
C headers for the reversed libmixerAPI.so and libpryon.so |
wakealign/ |
the wake word aligners (src/hassmic/wakealign.c), cut out of the Montreal Forced Aligner's models: CC BY 4.0, credited in its README |
geo/ |
the countries' borders (src/hassmic/geo.c: Home Assistant's home location to a country, for the time zone's name), from Natural Earth (public domain): tools/geo/build.py |
src/third_party/ |
monocypher 4.0.2, dr_flac.h, minimp3.h, libfreeaptx 0.2.2, RNNoise 0.1.1, mbedTLS 3.6.8 (mbedtls/: the parts hassmic_config.h builds, put there by tools/mbedtls-vendor.sh from the release's tarball, unchanged; a static library per target), Nayuki's QR Code generator 1.8.0 (qrcodegen/, the C version's two files unchanged: the screen UI's party code) (own licences, see README) |
scripts/ |
PC side: setup.sh (guided install), artifacts.sh (Amazon artifacts for an installed Echo: more wake words, the whisper detection model, the newest sound detection model; the old way through the Alexa app, a fallback to the settings page's "Download from Amazon"), deploy.sh, probe.sh, capture-test.sh, mic-compare.sh (micRaw against micAsr on a running Echo), wifi-join.sh, install-system.sh, ota-push.sh, bundle.sh (packs and signs an update; also CI's), otatool.py (bundles on the PC: keys, signing, checking, pushing; the Echo's own is src/tools/otatool.c), mkbootroot.py (a root boot.img from the model's stock one: checkers'), adb-wifi.sh (adb over Wi-Fi with the update key), kiosk-install.sh (Kiosk Satellite on an installed Show); lib/device.sh picks the model, lib/build.sh builds the Echo's binaries or takes the commit's release build, lib/setup.sh has the guided setup's helpers, lib/twrp.sh the Echo Shows' wipe in TWRP (setup's and install-boot.sh --uninstall's), lib/artifacts.sh the logic of artifacts.sh, lib/kiosk.sh and lib/apkcert.py fetch and check Kiosk Satellite |
scripts/device/, scripts/system/ |
run on the Echo, reading the model's device.conf next to them; boot integration (boot.sh, main.sh) |
tools/ |
mkstubs.sh (stand-ins for the stock libraries, for building without the firmware), geo/ (build.py: Natural Earth's borders -> geo/borders.bin; geo.py its format and lookup in Python), wakealign/ (the wake word aligners from the Montreal Forced Aligner's models: build.sh -> wakealign/<word>-<locale>.wa and a <model>.was per acoustic model, needs MFA's env), speechcorpus/ (a speech corpus of designed voices: "Speech corpus" below), OTA payload dumper, Thumb disassembly helpers, qrun.sh (device binaries under qemu-arm; a toolchain/qemu-arm serves too), dexasm.py (a Dalvik assembler, writer, reader and type check, and a check against the firmware's own framework, for our hand-made dex files: no javac or d8 here), mkwifictl.py (assembles scripts/device/wifictl.dex, checkers' way into WifiService), mkringbar.py (scripts/device/ringbar.dex, checkers' light band on the screen), davs-fetch.py |
docs/ |
user guide (GUIDE.md), security model (SECURITY.md), reverse-engineering notes; img/src/*.typ are the README figures (Typst + CeTZ), tools/figures.sh renders them to img/*-light.svg / *-dark.svg |
sdk/ |
what a plugin author needs (docs/plugins.md): PROTOCOL.md (the broker protocol), messages.def -> plugmsg.h and the test vectors vectors/ (tools/mkplugmsg.py, which holds each scope's versions to scopes.lock: a version only adds), the C client (hassmic_plugin.h, hmplugin.c), filter.def (the system calls a plugin may make; tools/mkfilter.py makes the launcher's seccomp program from it), plugcheck.py (packages) |
| (not here) | plugins, the project's own too, each in a repository of its own: microWakeWord in hassmic-plugin-microwakeword (the engine's sources copied from src/hassmic until the engine leaves the core, the SDK copied from sdk/; its make test HASSMIC=<this tree> runs it in this tree's PC build); the list of plugins in hassmic-plugins, the one place official ones are made so: its key's listing (docs/plugins.md 5.2, 5.3) |
tests/ |
protocol tests against the reference implementations |
blueprints/ |
Home Assistant blueprints for features that need an automation (automation/drop_in.yaml: Drop In by voice) |
keys/ |
release.pub: the key online updates are signed with; release.conf: that key and the repository whose releases they are (CI and releases, below) |
.github/workflows/ |
build.yml: builds, tests, betas and releases |
Device binaries need the NDK and the unpacked firmware in firmware/<codename>/ (the model's install page, steps 1–2, e.g. devices/donut/README.md), or
STUBS=1 instead of the firmware (below). Without the NDK only the host targets build. A model with the Thread radio
(device.mk THREAD := 1, the Echo 4) also builds our border router, upstream's ot-br-posix, with cmake and ninja from
pinned archives fetched once into toolchain/src/otbr/ (scripts/otbr-build.sh, ~14 MB, ~3 min), and our own radio
program gprcp (scripts/gprcp-build.sh: OpenThread's RCP on Qorvo's GP712 library, which is the Raspberry Pi's
hard-float ARM, so a static musl build by zig 0.17.1, the version CI pins; sources into
toolchain/src/gp712/). The test references:
uv sync (uv) makes .venv from uv.lock, every package pinned; to change one, edit
pyproject.toml, run uv lock and commit both.
make [DEVICE=donut] # ARM binaries into build/donut/
make DEVICE=donut STUBS=1 # the same, without the firmware: stand-ins for its libraries
make host # PC build (build/hassmic-host) + qemu build for the tests (needs libopus)
make host-tests # what tests/run.py needs (HOST_TESTS: hassmic's PC builds, the stand-in plugins); CI's
make unit-plugfuzz # the plugins' broker fuzzed for a minute (clang with libFuzzer; not in make unit)
make unit # C unit tests; microWakeWord against pymicro-features and TFLite (mww_ref.py);
# the Drop In blueprint (blueprint_dropin.py); one target each (make
# unit-<name>, UNIT_TESTS), so make -j unit runs them at once
.venv/bin/python tests/run.py [-j N] [name ...] # every PC test below at once (CI), each in a network namespace of its own
# (unshare -rn); logs of those that fail, all in build/test-logs/;
# one that failed with the others runs again alone: passing then, it is
# flaky (a warning, <name>.first.log), not a failure; --strict: no reruns;
# --skip <name> leaves one out (CI: unit, on a runner of its own)
.venv/bin/python tests/blueprint_dropin.py # the Drop In blueprint against stand-ins of Home Assistant's registries,
# states, actions and template engine (also in make unit)
.venv/bin/python tests/fake_ha_esphome.py # ESPHome native API, as Home Assistant (aioesphomeapi): entities,
# settings, voice assistant, replies, announcements (HTTP, HTTPS)
.venv/bin/python tests/fake_ha_esphome_timers.py # the same API: timers (ringing, and the next one running), encryption,
# clock and zone, noise reduction, LEDs, light sensor
.venv/bin/python tests/fake_ha_esphome_features.py # sound detection (3 s windows: HASSMIC_FAKE_SOUND_WINDOW), Wi-Fi motion
.venv/bin/python tests/fake_ha_esphome_buttons.py # runs cancelled while HA thinks or streams; the "Button" event entity
.venv/bin/python tests/fake_ha_esphome_address.py # a new address: links closed, mDNS announced again (netaddr.c)
.venv/bin/python tests/fake_zigbee.py # zigbeed (src/zigbee/) on simulated RCPs (tests/zbair.py) with zigpy-deconz
.venv/bin/python tests/fake_zigbee_z2m.py # zigbeed with Zigbee2MQTT's library (npm ci --prefix tests/zigbee-js first)
.venv/bin/python tests/fake_radio.py # the Echo 4's Thread and Zigbee radio (radio.c): the real rcpbridge in
# front of a stand-in RCP (tests/fake_rcp.py), a stand-in of the border
# router's REST; who is let in, one host at a time, the page's actions
# (the five share their setup: tests/esphome_common.py; one file was 90 s)
.venv/bin/python tests/fake_ha_arbitration.py # two Echos + Home Assistant + an unknown device: wake word arbitration: merge, forger,
# pairing; _join.py (tags, action, crash), _rounds.py, _kiosk.py, _window.py;
# shared tests/arbecho.py (the network's pace at 0.1: HASSMIC_ARB_SCALE)
.venv/bin/python tests/fake_ha_dropin.py # Drop In between two Echos: call, answer, hang-up paths, refusals, lost peer,
# the ringtone at the sounds volume (HASSMIC_EARCONS: stand-in stock sounds)
.venv/bin/python tests/fake_hfp.py # phone calls over Bluetooth: a phone behind a fake controller, the audio as SCO data (CVSD, mSBC), volume, a second call
.venv/bin/python tests/ha_real_dropin.py --setup # once: build/ha-venv, Home Assistant (pinned) and what its integrations need
.venv/bin/python tests/ha_real_dropin.py # the Drop In blueprint in that real Home Assistant with four PC Echos (one
# the released build, from its git tag), in a network namespace with only
# loopback (unshare -rn); skips without build/ha-venv or user namespaces
.venv/bin/python tests/fake_web.py # the settings page: login by the action button, signed requests, export/import;
# one wait for the button, nobody else's login in the time after each
# (one_wait: contested, run out, approved; adb; "off"), the count of asks
.venv/bin/python tests/fake_web_artifacts.py # models copied from one Echo to another through the page, root's installer
.venv/bin/python tests/fake_web_wifi.py # Wi-Fi switch: the sealed password, its PSK, root's wifi.sh against a fake wpa_cli;
# the fixed address (both worlds, netwatch's keep, the way back)
.venv/bin/python tests/fake_wifi_join.py # checkers' setup join (wifi-join.sh) through a fake adb and WifiService
.venv/bin/python tests/fake_wifi_roam.py # roaming between access points (issue #234): root's roam.sh against a fake
# wpa_cli (Amazon's picker, a Dot 5's scan_results, BTM), pinned moves
.venv/bin/python tests/fake_web_mww.py # microWakeWord: models from the page, the engine switch, real detections on the PC
.venv/bin/python tests/fake_plugins.py # plugins: hassmic under the launcher with a stand-in wake word plugin (docs/plugins.md)
.venv/bin/python tests/fake_plugins_fetch.py # plugins from the plugin index (a stand-in site built by hassmic-plugins' own tool,
# tests/plugsite.py), revocations, pushed, and by itself
.venv/bin/python tests/fake_plugins_race.py # the one install slot: who takes it from whom, what the press installs (and that a
# stranger's logins do not turn it), the decision at install; the push port's times
.venv/bin/python tests/fake_plugins_sync.py # a plugin copied Echo to Echo on an acceptance voucher: the whole way, every refusal;
# its note: who takes it off and how often the button is asked for it, a
# pending one, the event after a dismissal, a failed install, web_button
.venv/bin/python tests/fake_plugins_net.py # phase 2 with a stand-in forwarder: storage, the log as a plugin gets
# it (hassmic's own writers with sentinels), the owner's server and nothing
# else (other hosts behind a veth pair: tests/peerhost.py, run.py
# netns(peer=True), other_socket), the development flag
.venv/bin/python tests/fake_plugins_music.py # phase 4 with a stand-in player: its stream, ducking, the button,
# "stop", HA's media player, newest wins, UDP from private and public
# addresses, the search and its proposal, entities and actions in HA
.venv/bin/python tests/fake_plugins_call.py # calls with a stand-in phone, the Show's build and a second Echo:
# calls out by a token, in rung and answered only by a person, the room and
# the far side both ways, busy against Drop In, ring limits, refusals
.venv/bin/python tests/fake_plugins_request.py # requests with a stand-in listener: each request's copy byte for
# byte as Home Assistant got it, its ends, its texts, a slow reader, the
# second press, the partner rule, -w remote, Wyoming
.venv/bin/python tests/fake_plugins_lan.py # reach with the stand-in forwarder as "testlan": net.lan and
# net.internet against the other hosts, the whole log (official only), up
# to eight plugins at once and one that waits for its memory's place
.venv/bin/python tests/fake_plugins_button.py # buttons with tests/plugins/testbutton.c: the buttons as Home
# Assistant's "Button" hears them (never a press that served a wait), rows
# of its own on its card, `page` and `button` in updates, an older build
.venv/bin/python tests/fake_plugins_selftest.py # hassmic updates beside plugins (nothing held or fetched) and the self test
# with a wake word plugin: off, a fall back, a silent launcher, late passes
.venv/bin/python tests/fake_web_davs.py # models downloaded from a fake Amazon on the Echo itself: the code pair
# login with the device attestation token, the download, staging, deregister
.venv/bin/python tests/fake_ha.py [--qemu] # Wyoming (wyoming)
.venv/bin/python tests/fake_ma_sendspin.py # Sendspin, as Music Assistant 2.10.8 (aiosendspin 10.2.1: Sendspin 1.0), the
# server strict: a deviation it would only log closes the connection
.venv/bin/python tests/fake_ma_sendspin.py --legacy # the same as Music Assistant up to 2.10.6 (aiosendspin 9.1.1, the draft before
# 1.0) from build/aiosendspin-9.1.1, which --setup makes (tests/run.py does)
.venv/bin/python tests/fake_ha_wakealign.py # the wake word's end by the aligner: file per language, too slow or busy
# by the level, speaker adaptation in use and saved
.venv/bin/python tests/fake_ha_stop_word.py # "<wake word>, stop" between two Echos: a dropped run cancelled, the setting
# stop_ends_listening off and on (the round, listening, thinking, 4 s)
.venv/bin/python tests/fake_ma_api.py # Music Assistant's API for the screen (mass.c) against a stand-in server
.venv/bin/python tests/fake_screen.py # the Echo Show's screen: what hassmic tells its UI (build/hassmic-host-screen,
# a stand-in UI), Sendspin's metadata and artwork, the band, restarts
tests/ota_push_test.sh # signed push-update path end to end
.venv/bin/python tests/fake_ota_port.py # the push port against senders without the key: connections per address, bundles
# that burst and stall, what both otatools print when refused; a signed bundle
# under idle connections from two addresses, a bundle's first two seconds
tests/otatool_test.sh # the PC's otatool (Python) against the Echo's (C)
.venv/bin/python tests/fake_ha_update.py # online updates: Home Assistant, GitHub and root's installer in one
.venv/bin/python tests/fake_ha_wakesound.py # wake sound removal off and on, against the PC's stand-in echo
.venv/bin/python tests/fake_ha_volumes.py # separate volumes: four of their own or following the music, media, keys,
# restart, Bluetooth speaker, page, exports, against the mixer's volumes as
# files (HASSMIC_FAKE_MIXER, HASSMIC_FAKE_SPEAKER)
.venv/bin/python tests/fake_ha_timer_sound.py # the timer's sound: stock's tone (a stand-in) by default, looped and cut
# off, the beep at its level, uploads as the page makes them, Play, delete,
# a restart (the page's loudness check: tests/unit/web_loudness_test.py)
.venv/bin/python tests/fake_ha_ring.py # the light ring: the animation set hassmic -G makes, Home Assistant's light,
# the Echo's own patterns first, the listening ring turned by the beam
.venv/bin/python tests/fake_ha_ring_acs.py # the same on the Echo Dot 5's binary animations: the set, its index files,
# the light drawn into its slots through a stand-in for libhmled.so
.venv/bin/python tests/fake_ha_ring_live_acs.py # "Light ring live" on the Echo Dot 5: frames into its slot through that
# stand-in, the Echo's own first, ledcontroller started again
.venv/bin/python tests/fake_improv.py # setup from a phone (Improv over BLE) on a fake Bluetooth controller,
# Wi-Fi through root's wifi.sh, adoption, factory reset
.venv/bin/python tests/fake_ha_bt_proxy.py # the Bluetooth proxy switched off and on (issue #152) on that controllertools/qrun.sh [-t secs] <arm-binary> args runs a device binary on the PC under qemu-arm against
firmware/$DEVICE/rootfs, in a PID namespace of its own (bionic's mutexes hang with a pid over 65535). Where users may
not make namespaces (Ubuntu 24.04 and later) it stops and names the sysctl that allows them; --userns prints it.
The Wi-Fi motion kernel modules (src/kmod/) need the model's kernel sources and compiler in toolchain/; without
them make leaves the module out and says so, and that Echo gets no Wi-Fi motion (donut falls back to its driver's
RX_STAT, the last frame from anyone). make kernel-tools downloads them (scripts/kernel-tools.sh, about 115 MB,
770 MB unpacked; the guided setup does it in its downloads step, CI before every build); the kernel needs bc to
build:
make kernel-tools DEVICE=donut # kernel 4.4.22 (arm64), aarch64-linux-android-4.9
make kernel-tools DEVICE=radar # biscuit, radar: kernel 3.18.19 (ARM), arm-eabi-4.8
make kernel-tools DEVICE=cannoli # kernel 5.4.86 (ARM), arm-eabi-4.8The pins are in device.mk (KSRC_URL, KSRC_SHA256, KCC_URL, KCC_DIGEST), or the Makefile's defaults for the
3.18 models: the sources by their checksum, the compiler by a digest over its files, since googlesource packs its
archive anew for every download.
The compilers are the ones Amazon built those kernels with (their version strings say so). The kernel config is in
the repository: biscuit's and radar's devices/<codename>/kconfig is their kernel's own (IKCONFIG, read out of the
firmware's boot.img with scripts/extract-ikconfig; device.mk KCONFIG); donut's kernel carries none, so its
devices/donut/kconfig is a fragment on top of the arm64 defconfig (KFRAG), with what donut's own modules show
(vermagic, no modversions, no signature). Where the kernel has CONFIG_MODVERSIONS (athena, cannoli),
devices/<codename>/Module.symvers has its CRCs of what the module imports: tools/kcrc.py --check <stock .ko>... boot.img <symbol>... reads them out of the boot image, checked against the CRCs the stock modules carry. Cannoli's
kernel is Android's common kernel: its struct module has init 36 bytes further on than kernel.org's, which
tools/kmod-init.py puts right after the build (device.mk KMOD_INIT), and it exports no kallsyms_lookup_name
(HM_DRIVER_SYMS in hassmic_rcpi4m.c).
Trial runs on the device: scripts/deploy.sh, then adb shell sh /data/local/hassmic/run.sh. On an installed Echo
the satellite then runs /data/local/hassmic/hassmic in place of the installed copy, until the next update's install
removes it, a start finds another update installed than the one it was pushed over (hassmic.over beside it), or it
exits 5 times within 20 s each (moved to hassmic.failed; main.sh "trial", issue #251); adb shell rm /data/local/hassmic/hassmic goes back
by hand.
The release build instead (scripts/lib/build.sh): the scripts that need the Echo's binaries (deploy.sh,
install-system.sh, ota-push.sh, the guided setup) take the bundle CI published of the checked-out commit when
there is no NDK here, or with PREBUILT=1 (PREBUILT=0: always build). That needs the tag CI made of the commit
(v<version>[-beta]) to point at HEAD and no changes to tracked files; the bundle must verify against
keys/release.pub (scripts/otatool.py), and its binaries go into build/<codename>/, listed in PREBUILT there,
so a later build here replaces them instead of taking them as up to date. They are the same bytes as a build here
(reproducible). scripts/probe.sh checks the Echo's libraries against devices/<codename>/probe.md5, the pinned
firmware's checksums, so that path needs no unpacked firmware either; regenerate it when the firmware pin changes
(command in probe.sh).
otatool on the PC is Python (scripts/otatool.py, standard library only), so a prebuilt install needs no
compiler at all. Monocypher's EdDSA is Ed25519 with BLAKE2b where Ed25519 has SHA-512, which no Python package offers;
the arithmetic is RFC 8032's. The Echo keeps the C otatool (src/tools/otatool.c), which is what checks a bundle
there, so the two are held to each other: tests/otatool_test.sh (signatures byte for byte, each one's bundles
installed by the other), and CI checks every bundle it signs with both before it publishes.
For measurements and fixtures with speech in them (the wake word's end, wakealign.h; requests cut or held up),
testdata/corpus/ has 7393 clips, 4.3 h of speech (500 MB, in Git LFS: git lfs pull --include "testdata/corpus/**"
fetches them; CI does not), made 2026-10-29 by tools/speechcorpus/run.sh [OUT] (about 1.5 h on a 16 GB GPU). 30
voices designed by OmniVoice from a description (gender, age, pitch, whisper, English accents; nobody's voice cloned),
German, English, French, Spanish, some voices in a second language. Each says the 8 wake words with commands (with a
comma and without), the wake word alone, ", stop" and each command alone; align.py adds clips of the wake
word and the command joined by pauses of known length, which OmniVoice hardly makes by itself. Every clip is checked
by speech to text (canary-1b-v2; verify.py says what it lets through: 7110 pass) and has its words' times from the
Montreal Forced Aligner, the ground truth. One line per clip in manifest.jsonl (testdata/corpus/README.md lists
the fields). Licence: CC BY-NC, as OmniVoice's model, not MIT (the README says why); a fixture cut from it carries
that along (testdata/alexa_omnivoice.raw).
Measured on it: tools/wakealign/corpus_eval.py (where the replay after the wake word starts: stock Pryon under qemu,
the release's rule, the aligner alone and adapted, against MFA's times; results in build/corpus-eval/) and
build/ha-venv/bin/python tools/vad_leadin.py (Home Assistant's own VAD on the commands, with and without the lead-in);
with --publish docs/wake-word-end both write their tables there, described in docs/wake-word-end.md.
Making it again needs OmniVoice in toolchain/omnivoice/venv (uv venv -p 3.11, then uv pip install omnivoice==0.2.1 torch==2.9.1 torchaudio==2.9.1 transformers==5.16.1 num2words; weights k2-fsa/OmniVoice in
toolchain/omnivoice/hf), MFA 3.4.3 in toolchain/mfa/ (micromamba env env, models in
mfa_root/pretrained_models) and a canary Wyoming server (verify.py's STT, the host it reaches).
.github/workflows/build.yml builds every model, runs the PC tests and publishes the update bundles that online
updates install (src/hassmic/update.c):
- a push to
mainpublishesv<version>-beta(a prerelease: thebetachannel); - a push to
releasepublishesv<version>(thereleasechannel); - pull requests build and test only.
A beta is published only when it brings the Echos something: each bundle goes out with a content ID
(hassmic-<codename>.content-id, from scripts/content-id.sh: the bundle as it would be with the version left out,
hashed; builds repeat byte for byte, so a commit that changes only CI, tests or the docs gives the same IDs), and when every
model's ID equals the newest release's, main publishes nothing. Its commits then show in the next beta's notes. A push
to release always publishes. On the Echo Dot 5 the ID is that of its firebreak layer (below), the bundle's files with
the policy files: a rule or the mirror script changed publishes too.
The release job packs the bundles again from the build jobs' artifacts, signed with the release key, and stops unless each
is byte for byte the bundle its build job packed and checked (<codename>.bundle-sha256; the signature is a file of its
own, so the key does not change the bundle): bundle.sh leaves out what it does not find, and a file missing from the
artifact's list would otherwise go out without a word.
The version is the commit's time in UTC, 2026.10.02.091530 (make version): nothing to bump. Home Assistant
compares these as calendar versions, so newer is newer across both channels, and a commit published as beta and then
as release has the same version: an Echo running that beta is not offered the release of it. A commit that is
published already is not published again (a re-run). Builds of your own report <version>+<commit id>[-dirty];
Home Assistant cannot compare that form and so offers whatever is on the channel, once online updates are on.
Each release has hassmic-<codename>.bundle and .bundle.sig per model; the Echo picks its own by the board's
codename. CI builds with RELEASE=1: the daemon reports the bare version.
The Echo Dot 5 (cannoli) has a third file, hassmic-cannoli-overlay.zip: its layer for firebreak
(scripts/overlay.py, its page), the bundle's files with the update key and the SELinux
chain, packed again by the release job and held to the build job's as the bundle is (cannoli.overlay-sha256). It is
not signed: firebreak bakes what its manifest names into the image and runs its mirror script on the computer it runs
on, so it is code from this release like the bundle, and is to come from a release that is trusted. Its update.pub
is the key the bundle is signed with, so a Dot takes what its builder signs afterwards: for a released bundle the
release key's public half (RELEASE_PUB, which CI names), for a bundle of an owner's own, signed with their
secrets/update.key, their secrets/update.pub, which scripts/overlay.py takes by itself when it verifies the
bundle's signature.
Plugins are not in hassmic's releases, official ones neither: each plugin's own repository releases its package,
and the plugin index (hassmic-plugins) lists it and publishes it with its listing, signed by the index key
(docs/plugins.md 5.2, 5.3). This repository carries only the index's public key and address (keys/plugins.pub,
keys/plugins.conf, built into plugin_index.c); the release job has no plugin step, and the release key has no
part in plugins.
Before a release: the plugin index's least serials. keys/plugins.conf also has PLUGINS_LEAST_INDEX and
PLUGINS_LEAST_REVOKED, the oldest index and revocation list this build takes (docs/plugins.md 5.5): an Echo of the
release refuses older ones, also one that never saw the index (new, or after a factory reset), and counts a package
listed by an older index as one from a file. Raise them by hand before pushing to release, and after a revocation
that has to reach Echos that were reset: scripts/plugins-least.sh reads the published site, checks both signatures
against keys/plugins.pub (or the second index key, PLUGINS_PUB2, where one is named) and writes the two serials;
commit keys/plugins.conf (--check only says what the site has). Not in CI: a build is reproducible from its commit,
and a value read at build time would make two builds of
one commit differ. Never above the site's: an Echo of that build would refuse every list there is. 0 while nothing
is published.
The plugin protocol's versions and the releases. Every release carries sdk/scopes.lock, and every scope
version a release carried is for good (sdk/PROTOCOL.md "Versions"): the test job runs tools/mkplugmsg.py --released against every tag v*, which needs the whole history and every tag (fetch-depth: 0; in a shallow
clone git cannot tell which tags a commit descends from, so it fails there, and make unit-plugmsg on a PC says it
skipped). A push to main and one to release build at the same time (concurrency is per branch), so the release
job asks once more, the tags fetched anew, right before gh release create: of two pushes that add the same version
each its own way, the second to publish stops. What is left is the seconds between that check and the release.
Should two releases ever carry one version otherwise, every build fails ("releases ... carried ... otherwise") until
one of them is gone: delete the wrong one's release and its tag (gh release delete <tag> --cleanup-tag, or delete
the release on GitHub and then git push origin :refs/tags/<tag>), fix the definition on its branch, and push again.
The release job's fetch prunes the tags (--prune --prune-tags), so a tag deleted while a build ran is gone there too.
Echos that installed that release keep it; a plugin built against its SDK names a version no later build carries
the same way, which is why it is the newer (or the beta) of the two that goes.
No firmware in CI. make STUBS=1 links against stand-ins for the stock libraries, built from
devices/<codename>/stubs/*.syms: the functions our binaries take from each library, plus the symbols of the
executable it refers to or defines too (the linker exports those), in the library's own order (the order the linker
exports them in). They come out byte-identical to a firmware link. tools/mkstubs.sh writes the lists from the
firmware and checks exactly that, for every binary of every model; run it when the code starts using another function
of a stock library (a stub build then fails to link until it has). For the same reason the build is reproducible:
ESPHome's "compiled" time is the commit's (BUILD_TIME), not the clock's.
Wi-Fi motion's kernel module is built in CI for every model, against kernel.org's sources and the pinned AOSP compiler
(make kernel-tools, as the guided setup), with the config from the repository; a model whose module does not build fails the job rather than ship without it.
The modules come out byte-identical to local builds.
The release key. keys/release.pub is in every build and install; root accepts bundles signed with it, next to the
owner's update.pub (scripts/system/main.sh), but hassmic only downloads any once the owner picks a channel on the
settings page. The secret half is secrets/release.key on the maintainer's PC (back it up) and, base64-encoded
(base64 -w0 secrets/release.key), the secret RELEASE_SIGNING_KEY of the GitHub environment release, whose
deployment branches are main and release only. The one job that names that environment packs and signs the
bundles, from the binaries the build jobs left; the build jobs run whatever a branch or pull request brings, so they
only ever sign with a throwaway key (to check the bundling). A pull request runs on refs/pull/<n>/merge and is refused
the environment, workflow changes in it included. That leaves whoever can push to main or release directly:
protect both branches. A new key goes out signed by the old one: Echos prefer the release.pub of the copy they run
over the one on their system partition.
What the key does not cover, on purpose: root accepts a release-signed bundle that hassmic hands it whatever "Online updates" is set to (the setting is enforced by hassmic, which only downloads with a channel picked), and an older one as well as a newer one (switching from beta back to release relies on that). So a hassmic taken over through the network could put an older release back; it could not install code of its own.
Releases from a fork. A fork's CI cannot sign with this project's key, so a fork that publishes builds of its own
signs them with its own key, and its Echos then look for updates in the fork. keys/release.conf names the repository
(UPDATE_REPO, compiled into update.c, and where scripts/lib/build.sh takes prebuilt binaries from) and the key
(RELEASE_PUB, in every bundle and install as release.pub); a fork sets both in secrets/fork.conf, outside git (and,
with an index of its own, PLUGIN_INDEX and PLUGINS_PUB of keys/plugins.conf there too, and PLUGINS_PUB2 with
PLUGINS_PUB2_WITH only for a second key of its own: a second key is built in only beside the first key it names by
its hex, so this project's never beside a fork's first; fork-release.sh keeps those lines), so
its tree stays this one and its branches make pull requests here like any other. Once, on the PC, as an admin of the
fork:
scripts/fork-release.sh me/fork # key pair and secrets/fork.conf; on GitHub (gh): environment release, its secret, a variableIt makes secrets/release.key and .pub, and on GitHub the environment release (main and release only) with
the secret RELEASE_SIGNING_KEY, plus the repository variable RELEASE_PUBLIC_KEY (the public half, which the build
jobs need too: they pack the bundles). An environment the fork has already is kept as it is when it admits only chosen
branches or protected ones, and refused, before anything is written, when it admits every branch (by its setting or a
pattern like **). Where secrets/fork.conf has an index of the fork's own, it also sets the repository variables
PLUGIN_INDEX_URL (its address), PLUGINS_PUBLIC_KEY (base64 of its key) and, with a second key, PLUGINS_PUBLIC_KEY2,
and deletes each of them secrets/fork.conf no longer names (CI goes by the variables alone: a second key dropped
there stayed in every CI build); a fork can set them by hand as well (gh variable set). In CI, scripts/fork-release.sh ci writes secrets/fork.conf
from those variables and the repository the workflow runs in (secrets/ is not in git: without them a fork's CI builds
carried this project's index and key, whatever its own fork.conf said); the index's address and key go in as a pair
(one without the other fails the job), a second key with PLUGINS_PUB2_WITH of the first; without any of them (this
project) it does nothing. No key may be one under which any signature holds (small order: all zero, the identity,
in any encoding Monocypher takes): the Makefile refuses each it builds in or packs, and every key where it cannot ask
(no python3). Then allow the fork's
workflows (off in a fork until someone does), protect main and release, push a commit of your own to main (the
script changes nothing in git; a commit whose tag the fork took from this project is not published again, and a manual
run never publishes), and put each Echo on a build of the fork once from the PC (scripts/ota-push.sh or
scripts/setup.sh): that brings it the fork's key. Back up secrets/. A fork without secrets/fork.conf builds what
this project builds, byte for byte, and its Echos take this project's updates. tests/unit/fork_release_test.sh runs
the script against a stand-in gh. A fork's releases somewhere other than GitHub (a Forgejo or Gitea, a mirror on a
LAN without internet), or a plugin index of its own that a build does not name: the settings page's "Where software
comes from" (src/hassmic/sources.c, docs/GUIDE.md), per Echo; the HASSMIC_UPDATE_* and HASSMIC_PLUGIN_INDEX
variables are the tests' only.
Trying the workflow locally with nektos/act: the publishing step only says what it would publish under act. The toolchains go on a volume: unpacked inside the job containers (3 GB), act times out removing them and fails the job after every step passed; one job at a time for the same reason.
echo "RELEASE_SIGNING_KEY=$(base64 -w0 secrets/release.key)" > /tmp/act.secrets
mkdir -p /tmp/act-toolchain
act push --secret-file /tmp/act.secrets --artifact-server-path /tmp/act-artifacts --concurrent-jobs 1 \
--container-options "-v /tmp/act-toolchain:$PWD/toolchain"Without a payload act takes the branch checked out; -e with {"ref": "refs/heads/release"} plays a push to release.
What act 0.2.89 gets wrong (2026-10):
- Its artifact server refuses
upload-artifact@v7(unknown field "mime_type", nektos/act#6114). Until a release has the fix, build act from nektos/act#6115 (git fetch origin pull/6115/head,go build). --concurrent-jobs 1does not hold for the legs of the build matrix: on a fresh volume the three unpack the NDK over each other. Fill it first with one run per model (--matrix device:donut, ...); the release job takes one artifact as well as three.- Under rootless podman (
DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock,--container-daemon-socket -) copying actions into/var/run/actfails (path escapes from parent: the image's/var/runis a link to/run). An image on top ofcatthehacker/ubuntu:act-latestwithRUN rm /var/run && mkdir /var/run && for f in /run/*; do ln -s "$f" /var/run/; done, given with-P ubuntu-latest=<image> --pull=false, works.
hassmic speaks ESPHome's native API, written anew in src/hassmic/proto_esphome.c, and names an ESPHome release in
DeviceInfoResponse (and the mDNS record), which Home Assistant shows on the device page as " (ESPHome
)". src/hassmic/esphome_api.h holds the API version we speak (ESPHOME_API_MINOR), the release we name
(ESPHOME_VERSION) and the newest one looked at (ESPHOME_LOOKED). The release named is the newest that speaks our API
version with an api.proto whose every change since was looked at; never one ahead of what hassmic does.
tools/esphome-version.py walks ESPHome's releases after it: one with our API version and the same api.proto byte for
byte follows on; the walk stops at another API version or a changed api.proto.
tools/esphome-version.py # what there is (exit 3: something to do or look at)
tools/esphome-version.py --write # name the newest release the walk reached: no review needed
tools/esphome-version.py --diff # api.proto from the release named to where the walk stopped
tools/esphome-version.py --to TAG # name TAG after reading its diff (our API version only)
tools/esphome-version.py --looked # stay: quiet until a release after the newest now.github/workflows/esphome-version.yml runs it on the 4th of each month and keeps one issue labelled tracking ("ESPHome
protocol: a newer release to look at") with its words while it exits 3; it commits nothing. A new API version is code
first (what each step changes for what hassmic offers), then ESPHOME_API_MINOR, then --to. make unit-esphome_version
holds the walk to a stand-in GitHub.
- Log:
/data/local/hassmic/boot.log. State (API key, Bluetooth keys, Sendspin, settings):/data/local/hassmic/state/. - What the wake word hears:
kill -TTIN $(pidof hassmic)starts writing the processed mic stream to/data/local/hassmic/state/capture.raw(16 kHz mono s16le); the same signal stops it.mixcapcannot read that stream while hassmic runs: the mixer feeds it to one client only.
GET https://api.amazonalexa.com/v2/deviceArtifacts/?artifactFilter= + URL-quoted base64 of
{"artifactType":"wakeword","artifactKey":"echo","filters":{"engineCompatibilityIdList":[…],"locale":["de-DE"],"modelClass":["B"]}},
header Authorization: Bearer <access_token>. The answer is JSON with a signed CloudFront downloadUrl (.tar.gz) that
expires within minutes. Found by preloading src/tools/curlspy.c into the stock downloader: scripts/device/davs-spy.sh.
- Each model is built for exactly one firmware (
FIRMWARE_IDin itsdevice.conf;donut: 6574.1).scripts/probe.shcompares the Echo'sPROBE_FILESwith it (the libraries with reverse-engineered interfaces and the audio path; not libopus, libz or what is dlopen'd, whose ABIs are public). Another build, byinstall-system.sh(device_check_firmware) and the setup:INSTALL=bootnever (its boot.img is the pinned build's);twrp-abwhen every probed file is the same, else refused (the firmware step puts the pinned build back);running(athena) when they are the same, else after a question. - No model
#ifdefs in shared code: a new difference becomes astruct boardfield, adevice.confvariable or a backend (see devices/README.md). - Feature commits update CHANGELOG.md (user-facing, dated, plain language), PLAN.md (status,
measurements) and docs/GUIDE.md when behaviour visible to users changes. The README stays short:
a row in its table or a figure (
tools/figures.shafter editingdocs/img/src/), the detail in the guide. - Code comments explain why, with device facts and measurements.
- Every listening port must stay in TCP/UDP 16384–32767: the Echo's firewall admits nothing else inbound. The
exceptions are Kiosk Satellite's fixed UDP 2330, admitted by
lockdown.shonly whilearbitration_mode=kiosk, and, on the screen models withKIOSK_PACKAGE, the app's own TCP 2324 and 6053 from private addresses while it is installed (they are the app's ports, not hassmic's). - Proprietary, derived or secret material stays out of git (git-ignored):
firmware/(per model: stock image, unpacked rootfs, unlock zips,re/disassembly),toolchain/,build/,device-logs/,secrets/(wifi.conf,update.key,release.key),*.bin,*.zip. - Third-party code in
src/third_party/keeps its own licence. - The unlock and root stay R0rt1z2's, by hand. The unlock tools (kamakiri, amonet, saiyaku), boot-root and their XDA
threads are R0rt1z2's, and he asks that they are only ever used by hand, as his threads say: not from an installer,
a wrapper or a script, not repackaged, not retold (kamakiri-donut v1.1.0's LICENSE and README, 2026-11-06). So the
guided setup and the model pages only link the thread, wait, and check the result (
unlock_thread,root_threadinscripts/lib/setup.sh), and no file of the threads is downloaded, read or copied: magiskpolicy comes from Magisk's own release, the Echo Shows' adbd from Google's emulator image. Everything that did otherwise (running kamakiri, amonet's fastbrick and saiyaku, firebreak on Windows, installing boot-root, pinning the threads' zips, taking tools out of them, copies of their steps) was removed on 2026-11-09 for this reason. Do not add any of it back; a new model's unlock gets a link to its thread, not steps.
Issues open through forms (.github/ISSUE_TEMPLATE/: bug, install or setup problem, an Echo not supported yet,
feature request; questions go to Discussions, security problems to a private report). The bug form asks for the
hassmic version, model, how many Echos, protocol and Home Assistant's version; the code of conduct is
CODE_OF_CONDUCT.md. Pull requests get .github/pull_request_template.md.
Labels (the table in .github/triage.py, created or updated by GH_TOKEN=$(gh auth token) python3 .github/triage.py labels): a type (bug, enhancement, install, model support, question), areas (area: …), models
(model: <codename>), and whose turn it is, kept by .github/workflows/triage.yml:
waiting: maintainer/waiting: reporteron issues,waiting: review/waiting: authoron pull requests. A new issue or pull request is the maintainer's; a comment by a maintainer (owner, member, collaborator) hands it to the reporter or author, a comment by the reporter or author hands it back; anyone else's comment moves nothing. A push to a pull request waiting for its author is back in review; a maintainer's review is the author's turn (the sweep, every three hours: a review of a fork's pull request gets a read-only token). Drafts and the maintainer's own pull requests have no status. A closed item has none either, but the reporter's reply on it makes it the maintainer's again, so the queuelabel:"waiting: maintainer"(withoutis:open) shows those replies too.- The maintainer's commands, a line of their own in a comment (not in a quote or a code block):
/mine(keep it),/reporteror/author(hand it over),/tracking,/untracking,/model <codename>...,/area <area>,.... A comment of commands only hands nothing over by itself. needs: version: the bug form came without a version (or not one like2026.11.25.231912); asked for, the reporter's turn until it is edited in or named in a reply. A version older than the newest release is told so once.- Reminders: 14 days on the reporter's or author's turn, one reminder; an issue 30 days on it (a reminder sent) is
closed as not planned with
stale, and the reporter's reply opens it again. Pull requests are only reminded. in beta: after a beta is published,build.yml's jobtellcomments on every issue its commits name (#N, and the issues a pull request named there closes), once per beta, and makes it the reporter's turn to test; not on tracking issues or the maintainer's own.tracking: a long thread (a port's research, many people) gets none of the above: no status, turns, version check, reminders, closing or beta notes.
Views: label:"waiting: maintainer" sort:updated-asc (the queue, oldest first), is:open label:"waiting: reporter",
is:pr is:open label:"waiting: review". python3 .github/triage.py migrate [--apply] sets the status on open items
without one, from who spoke last. make unit-triage runs the logic against a stand-in GitHub.