Files
POS-Automation/docs/ha-setup.md
T
Mortdecai b540d5e394 docs: expose POS briefing as a switch tile (scenes don't tile in Google Home)
Google renders SCENE devices (HA scripts/scenes) as voice/Routine-only, not as
tappable tiles -> the button was invisible. Switched the Google exposure to a
template switch (tiles like the TV). Documents the broken HomeGraph SA key
(invalid_grant) that disables requestSync/reportState until regenerated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 14:15:41 -04:00

63 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# HA + Google Home setup — POS Briefing button (DEPLOYED 2026-06-07)
Status: deployed on VM HA (`192.168.0.146`, HAOS 2026.2.3) and verified end-to-end
through HA. Final Google-app surfacing is yours (see "Your steps").
Chain: **Google Home tile → HA `switch.print_daily_briefing``button.press` on
`button.pos_briefing_print_daily_briefing` → MQTT `posbriefing/button/press`
(broker CT 301) → `pos-briefing-mqtt.service` on steel141 → `pos_briefing.py`
printer (by MAC) → TM-m30.**
## Why a switch, not a scene
A `script`/`scene` exposed to Google gets the **Scene** trait, which Google Home
does **not** render as a tappable tile (it's voice/Routine-only). A **switch**
renders as a tile (like the LG TV). So the action is exposed as a template switch.
Because HomeGraph state reporting is currently broken (see below), the switch is
forced **always-off** and **both on and off fire the print**, so a tap always
prints regardless of Google's cached state. The bridge debounce prevents any
double-print. (Once the SA key is fixed, this can be simplified to on-only.)
## What is deployed on VM HA `/config` (backups in `/config/.backup/`)
- **`scripts.yaml`** — `script.print_daily_briefing` (presses the button). Kept as
an alternate trigger; not exposed to Google.
- **`configuration.yaml`**:
- `switch:` template `print_daily_briefing` (the tile; entity `switch.print_daily_briefing`).
- `google_assistant.entity_config` exposes `switch.print_daily_briefing`
(alongside the LG TV + projector; nothing else changed).
- `ha core check` passed → `ha core restart`. Local SYNC webhook confirms the entity
is reported to Google as `action.devices.types.SWITCH`.
## Verified
- Local Google SYNC (the manual integration's local-fulfillment webhook) returns 3
devices: **Print Daily Briefing (SWITCH)**, Big TV (SWITCH), Projector (SETTOP).
- `switch.turn_on switch.print_daily_briefing` → bridge `Briefing printed OK`
**physical receipt**. (Same for the earlier `script` path.)
## Known issue — HomeGraph auth broken (pre-existing, not from this work)
HA's `SERVICE_ACCOUNT.json` (project `seth-freiberg`, SA `claude@seth-freiberg.iam`)
has an **invalid private key** (`invalid_grant: Invalid JWT Signature`) — the key was
rotated/deleted during the lgtv 2026-06-06 security cleanup but the HA copy was never
refreshed. Effects:
- `devices:requestSync` 400 → HA can't proactively push device-list changes; you must
re-sync from the Google side ("Hey Google, sync my devices").
- `devices:reportStateAndNotification` 400 → device states (incl. the TV/projector)
don't push to Google in real time.
**Fix (GCP, your call):** create a new JSON key for `claude@seth-freiberg.iam`
(HomeGraph API enabled), deploy to `/config/SERVICE_ACCOUNT.json` (chmod 600), restart
HA. Then `request_sync` and live state work for all devices, and this switch can drop
the both-directions-fire hack.
## Your steps (Google Home app, account `slingshooter08`)
1. Say **"Hey Google, sync my devices"** (linking-based sync; works despite the SA-key
issue). **Print Daily Briefing** should appear as a tile.
2. Remove any **stale/phantom device** — HA only sends 3 devices; if Google shows 4,
the extra is leftover from a prior link. (Settings → the duplicate → Remove.)
3. Tap **Print Daily Briefing** → receipt prints in ~12 min.
## Notes
- A print takes ~12 min (gemma4:26b). `posbriefing/status` goes `printing``ok`.
- Google-linking invariants (lgtv 2026-06-06, satisfied — don't re-fix): manual
`google_assistant`, scopes `email`+`name`, "HTTP basic auth header" OFF, GCP consent
screen untouched (shared project).