Skip to content

ha-remote: five Home Assistant toggles with an Android companion - #31

Merged
freethinkel merged 3 commits into
fmctools:mainfrom
krtkygpta:HA-remote
Nov 19, 2026
Merged

freethinkel merged 3 commits into
fmctools:mainfrom
krtkygpta:HA-remote

Conversation

@krtkygpta

Copy link
Copy Markdown
Contributor

What this adds

apps/ha-remote — a watch app that shows up to five Home Assistant controls (lights or light groups) as tappable rows with stock-style toggle switches, grouped into sections named from the phone. Tapping a row sends a compact toggle request over the app channel (channel key K); the Android companion is the only Home Assistant client: it runs the command and sends the authoritative state back, so rows reflect reality — including changes made from other controllers (5 s polling on the phone).

Three surfaces:

  • Menu app — the control list; exits on the crown button.
  • Page (app_features!(PAGE)) — the same screen next to the face; rows toggle right there.
  • Widget card (app_features!(WIDGET)) — the favorite control's name and state; the stock card is text-only, so a tap opens the app and toggling happens there or on the page.

Protocol

ASCII H1 frames, 128 B max, five slots, 15-byte UTF-8 names, 10-byte section titles.

  • Watch → phone: H1? hello/config request, H1T seq slot target toggle request, H1W result widget-capability probe.
  • Phone → watch: H1C/H1G config (enabled slots, names, sections, favorite), H1A seq ack, H1S slot on result authoritative state, H1P 10 s heartbeat, H1E seq code generic errors.

Entity IDs, Home Assistant URLs and tokens never leave the phone; the channel carries names, indexes, states and generic error codes only. The watch persists a D2 blob (names, sections, last states) in its own storage as a display fallback. Full contract: ANDROID_COMPANION.md.

Companion app (separate repo, not part of this PR)

krtkygpta/ha-remote hosts the Android companion (Material 3, a foreground service keeps the BLE link and the HA connection alive, background state sync) and mirrors this watch app under the same apps/ha-remote/ layout, with PC install instructions. It connects to the already-bonded watch with a second GATT client while Nothing X stays connected (no second pairing, no bind handshake), reads K over the shell service, and speaks the same H1 protocol.

Requirements

Also in store.md: the FMC patched firmware/App Loader with channel key K (2026-11-13 or newer); the page and widget surfaces need a loader from 2026-11-15 or newer and stub v4+.

About the second commit

store: pass the SDK remap path as TOML-safe POSIX on Windows — scripts/store build passes the SDK path inside a cargo --config TOML value; on Windows, native backslashes in that quoted value are parsed as escapes and every build fails. .as_posix() is byte-identical behavior on Linux/macOS. Happy to split it into its own PR if you prefer to keep this one app-only.

Testing

  • 9/9 host tests pass (cargo test -p ha-remote); clean release build against the pinned SDK (4a5b025); scripts/store check ha-remote passes.
  • Installed and run on my own CMF Watch Pro 2 (2026-11-16 loader): lights and groups toggle end-to-end through the companion while Nothing X stays connected on the same phone; HA state changes propagate both ways.

Running on the watch

(Screenshot taken during development; the current build hides unconfigured rows and shows per-name icons.)

@freethinkel
freethinkel merged commit 9a66286 into fmctools:main Nov 19, 2026
2 checks passed
@bhavikrb

Copy link
Copy Markdown

@krtkygpta Could you please upload the APK or those who can't build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants