Skip to content

"Last Cat Seen" persistent image

Date: 2026-06-23

Problem

The "Cat Detected — Laundry Room" automation pushes a notification with image: /api/camera_proxy/camera.wyze_cam_v3_1 — a live frame fetched at send time. Nothing persists it, so tapping/maximizing the notification later shows no photo. The user wants a persistent "Last Cat Seen" image on the Command dashboard's Cameras tab.

Approach

Capture the live frame to disk on each (non-privacy-suppressed) cat detection and render it on the Cameras tab via a dashboard button-card <img> pointed at /local/last_cat_seen.jpg, with a ?t=<timestamp> cache-buster from input_datetime.last_cat_seen and a "seen X ago" caption.

Chosen over Frigate's MQTT detection-snapshot because it is self-contained, testable from the repo, and depends only on entities we know exist (camera.wyze_cam_v3_1). camera.snapshot requires allowlist_external_dirs regardless.

Note (revised during implementation): the original plan used a local_file camera entity, but HA 2026.6+ removed YAML platform setup for local_file (the live instance runs 2026.6.4; CI pins 2026.6.1, so check_config didn't catch it). Replaced with the timestamp cache-buster <img> approach above — no camera entity, works on all HA versions, and the ?t= cache-buster also resolves the stale-browser-cache concern a static image card would have.

Changes

1. automations.yaml — automation id cat_detected_office

Add two actions to the existing action list (after the notify; inside the same privacy-suppressed automation so no snapshot is taken during privacy mode): - camera.snapshot: entity_id: camera.wyze_cam_v3_1, filename: /config/www/last_cat_seen.jpg - input_datetime.set_datetime: entity_id: input_datetime.last_cat_seen, datetime: "{{ now() }}"

The existing notify action and mode: single are unchanged.

2. configuration.yaml

  • Under the existing homeassistant: block, add allowlist_external_dirs: ["/config/www"] (required for camera.snapshot to write there).
  • New top-level camera:platform: local_file, name: Last Cat Seen, file_path: /config/www/last_cat_seen.jpg → entity camera.last_cat_seen.
  • New top-level input_datetime:last_cat_seen with has_date: true, has_time: true.

3. command_dashboard.yamlcameras view

Insert a "Last Cat Seen" card directly above the existing live-feed grid (card index 1): a vertical-stack of - picture-entity of camera.last_cat_seen, name: "🐱 Last Cat Seen", camera_view: auto, rounded card_mod border matching the other camera cards; - a custom:button-card caption rendering relative time from input_datetime.last_cat_seen (e.g. "Seen 3m ago" / "No cat seen yet").

Matches the tab's dark-glass styling.

4. tests/fixtures/entities_allow.txt

Allowlist camera.last_cat_seen and input_datetime.last_cat_seen (Tier-3 entity-ref test scans command_dashboard.yaml and automations.yaml; these entities don't exist on the live registry until the post-deploy restart). After deploy, make snapshot can fold them into entities.txt.

5. Docs — docs/cameras.md

Document the "Last Cat Seen" tile on the Cameras tab (what it shows, that it updates on each detection, blank until the first post-deploy cat).

Deploy / verify

Push → ci.yml test gate → configuration.yaml changed ⇒ full ha core restart. - Pre-deploy: make test passes (entity allowlist covers the two new entities). - Post-deploy: blank until first cat detection, then camera.last_cat_seen populates and the tab shows the frame + timestamp. Optionally make snapshot and commit entities.txt.

Out of scope (YAGNI)

  • No Frigate MQTT image entity / bounding-box snapshot.
  • No history of multiple past cats — only the single most-recent frame.
  • No change to the existing push notification (it already attaches a live image).