Files
POS-Automation/docs/ha-setup.md
T
Mortdecai 93f6c33cd3 feat: simplify Google switch to on-only (state push restored)
Dropped the both-on/off-fire workaround now that HomeGraph reportState works
(new SA key + linked agent). turn_off is a no-op; on-tap prints; tile auto-reverts
via reportState. Verified: turn_on prints, turn_off does nothing. Docs/DECISIONS
updated to mark the HomeGraph auth issue resolved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 04:53:26 -04:00

57 lines
3.2 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.
The switch state is forced **always-off**; an **on-tap fires the print** and the
tile auto-reverts to off a few seconds later (via HomeGraph reportState). `turn_off`
is a no-op. The bridge debounce guards against any stray double-fire.
## 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.)
## HomeGraph auth — RESOLVED 2026-06-07
The old `SERVICE_ACCOUNT.json` key (project `seth-freiberg`, SA
`claude@seth-freiberg.iam`) was invalid (`invalid_grant`) — rotated in the lgtv
2026-06-06 cleanup, never refreshed — so `requestSync`/`reportState` 400'd. Seth
issued a new JSON key (id `8e3e812b6913…`); deployed to `/config/SERVICE_ACCOUNT.json`
(0600), restarted HA. After a Google re-link registered the agent, both APIs return
200 → live state push works for all devices. (Note: a manually-triggered
`google_assistant.request_sync` via the admin API logs a harmless 404 because it sends
the unlinked owner-context id `2c22820…`; HA's automatic reporting uses the linked
`f948247…` and succeeds.)
## Status: working
Tapping **Print Daily Briefing** in Google Home (account `slingshooter08`) prints —
verified end-to-end. If you ever re-add it: "Hey Google, sync my devices" surfaces the
tile; remove any stale/phantom device if Google's count exceeds HA's 3.
## 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).