15 Commits
Author SHA1 Message Date
rick b28aa89404 Merge branch 'impl/card-layouts-and-imagery' — v0.2.0: layouts, fallback art, +16 keg images 2026-06-01 21:11:06 +02:00
rickandCursor a2319363d6 Add selectable layouts, tiered fallback art, 16 keg images (v0.2.0)
- Five layouts selectable via `layout` config + editor dropdown:
  landscape (default, unchanged), portrait, compact, hero, vessel
- Width-tolerant emoji matrix: shrinks to fit narrow cards instead of
  overflowing (min-width:0, container-query emoji sizing, min_columns:1).
  Fixes the reported crop on narrow placements.
- New matrix knobs: `matrix_columns` (auto|N) and `max_matrix_width`
- Tiered visual fallback so every beer looks intentional:
  keg photo -> brewery logo -> generated palette-tinted keg silhouette
- 16 new keg photos sourced from regional PerfectDraft stores
  (BrewDog, Tiny Rebel, Thornbridge, Fuller's, Theakston, Peroni,
   Diebels, Haake-Beck, La Virgen, Stella Unfiltered, Bud Light,
   Tennent's, Leffe Ambrée, Hertog Jan Grand, Castelain Ch'ti)
- All keg images re-encoded to WebP @ <=800px: dist/kegs 19MB -> 2.1MB
- OpenSpec change: card-layouts-and-imagery (proposal/design/specs/tasks)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 21:09:25 +02:00
rick 5adce69c23 Merge branch 'impl/perfectdraft-card' — v0.1.6 with 31 new keg images 2026-04-18 20:31:16 +02:00
rick c086437ce5 Add 31 real keg images, 2 new beers, image fallback (v0.1.6)
- Wire imagePath for 31 newly downloaded keg product images
- Add Castelain Ch'ti Blonde and Hertog Jan Grand Pilsener entries
- Add onerror fallback on <img> to show letter initial if image fails
- Remove 18 stale placeholder images from dist/kegs/
- Bump CARD_VERSION, EDITOR_VERSION, and package.json to 0.1.6

Made-with: Cursor
2026-04-18 20:31:04 +02:00
rick 571d2837f6 Add agent handoff notes for next session
Made-with: Cursor
2026-04-18 20:16:38 +02:00
rick a53485a927 Merge branch 'impl/perfectdraft-card' 2026-04-18 19:59:09 +02:00
rick 3d8344b9bf Add screenshot to README
Made-with: Cursor
2026-04-18 19:59:04 +02:00
rick ffe8006840 Merge branch 'impl/perfectdraft-card' 2026-04-18 19:56:58 +02:00
rick 2134576537 Remove 51 placeholder images, keep 21 real keg photos (v0.1.5)
64 of 72 images were CDN placeholder JPEGs (10KB each) disguised
as PNGs. Replaced 8 originals with full-resolution versions and
found 13 additional real images using alternate CDN filenames.

Beers without images now fall back to color palette display instead
of showing a broken "Awaiting Image" placeholder.

21 beers with real product images, remainder use brand colors.

Made-with: Cursor
2026-04-18 19:56:52 +02:00
rick a44f5ab9cf Merge branch 'impl/perfectdraft-card' 2026-04-18 19:46:08 +02:00
rick d1b64fd9c7 Emoji grid fills zone: stretch rows, bigger emojis (v0.1.4)
- Grid rows use 1fr to stretch vertically across full zone height
- Each glass is a flex container filling its grid cell
- Emoji font-size: min(7vw, 5em) — roughly 150% of previous
- Grid align-content: stretch instead of center

Made-with: Cursor
2026-04-18 19:45:56 +02:00
rick 7493721d4a Merge branch 'impl/perfectdraft-card' 2026-04-18 19:34:54 +02:00
rick 6de5f6a960 Scale up elements, label zone to ~1/4 width (v0.1.3)
- Label zone: 1/4 width (was 1/3), keg zone gets 3/4
- Beer logo: flex-grows to fill space, 80% width
- Temperature: 3em, beer name: 1.6em, count label: 1.3em
- Emoji grid: min(4.5vw, 3.5em) auto-scales to fill zone
- All elements sized up for NSPanel Pro readability

Made-with: Cursor
2026-04-18 19:34:47 +02:00
rick 42147366ae Merge branch 'impl/perfectdraft-card' 2026-04-18 19:07:50 +02:00
rick 63be469bb2 Emoji grid with fixed slots, Leffe Noël alias (v0.1.2)
- Emoji grid now uses CSS Grid with fixed max-glass slots per size
  (e.g., 6x3 for 330mL). Empty slots shown as faded greyed-out emojis.
- Added Leffe Noël as alias for Leffe Winter (same beer, French name)
- Bumped editor version to 0.1.2

Made-with: Cursor
2026-04-18 19:07:44 +02:00
297 changed files with 1518 additions and 150 deletions
+72
View File
@@ -0,0 +1,72 @@
# Agent Handoff — PerfectDraft Card
## Current State (2026-04-18)
The PerfectDraft Card custom Lovelace card is working and deployed on a Sonoff NSPanel Pro 120 in landscape mode. Current release is **v0.1.5** on GitHub via HACS.
## What's Done
- Full card implementation: two-zone layout (beer label left ~1/4, emoji grid right ~3/4)
- 72-beer catalog with brand color palettes
- 21 real keg product images (full resolution from PerfectDraft CDN)
- CSS Grid emoji layout with fixed slots (6×3 for 330mL, etc.)
- Glass size selection dialog (250/330/500/UK pint/US pint)
- Beer selection dialog with search
- Freshness warning system (CSS-only, 4 tiers)
- Visual card editor with HA device registry auto-discovery
- HACS-compatible, deployed via GitHub releases
- Screenshot in both repos' READMEs
- Editor version marker for debugging
## What Needs Doing Next (Immediate)
### 1. Add 31 newly downloaded beer images to catalog
**31 new keg images** were downloaded from the PerfectDraft store DOM and are sitting in:
```
.worktree/perfectdraft-card/src/assets/kegs/
```
These need to be wired into `src/beer-catalog.ts` by adding `imagePath: kegImage("slug")` to each beer entry that now has an image file. The beers that gained images are:
leffe-dete, hoegaarden, stella-artois-0, leffe-0, kwak, dupont, san-miguel, fruh-kolsch, castelain, lowenbrau, schneider, hasseroder, camden-pale, camden-hells, camden-ipa, camden-eazy, becks, trooper, northern-monk, st-austell, old-speckled-hen, anoesteke, vocation-hop-skip, vocation-life-death, franziskaner-royal, saint-feuillien, leffe-prestige, leffe-brune, hoegaarden-rosee, rousse-mont-blanc, ninkasi
Also discovered from the DOM:
- **New beers to add to catalog**: Castelain Ch'ti Blonde (slug: `castelain-chti`), Hertog Jan Grand Pilsener (slug: `hertog-jan-grand`), Anheuser-Busch Bud uses filename `keg-abb_2x.png` (already have as `bud.png`)
- **Leffe d'Été** image filename is `keg--leffe-summer-e_te__2x.png` (not `keg--leffe_d_ete`)
- **Haake-Beck** image is a JPG (`haake_beck.jpg`) at `/h/a/` path — the cached version is too small (9KB). May need to find from UK store DOM.
- **Diebels** image returned a placeholder — no real image found yet.
After updating the catalog: rebuild (`npm run build` in the worktree), commit, merge to main, push to both remotes, create GitHub release v0.1.6.
### 2. Test ghost emojis after D&D session
User will drink some beers and report back on how the greyed-out empty emoji slots look on the NSPanel Pro. Current implementation: `opacity: 0.15; filter: grayscale(1)`.
### 3. Test freshness warnings
Untested — will activate naturally as the keg approaches 14 days old.
### 4. Test tap dialogs on NSPanel Pro
Beer picker and glass size dialogs haven't been tested on the NSPanel Pro's touch screen yet.
## Architecture Notes
- **Worktree**: Implementation branch is at `.worktree/perfectdraft-card/` on branch `impl/perfectdraft-card`
- **Main branch**: Merged and pushed to both remotes after each release
- **Remotes**: `origin` = Gitea (git.falkvinge.net), `github` = GitHub (Falkvinge/hassio-component-perfectdraft-pro)
- **Credentials**: `.git/credentials` store file with PATs for both remotes
- **Build**: `npm run build` in worktree produces `dist/perfectdraft-card.js` + `dist/kegs/*.png`
- **HACS**: Downloads from GitHub release tags. `dist/` is committed (not gitignored).
- **Entity resolution**: Uses `hass.entities` registry with `platform === "perfectdraft"` and `translation_key` for sensor mapping. Entity IDs do NOT contain "perfectdraft" — they use user-chosen device names.
- **Editor version**: Shown in top-right of card editor. Keep in sync with GitHub release tags.
- **Image base URL**: Detected at runtime via `getCardBaseUrl()` scanning `<script>` tags for "perfectdraft-card".
## Sibling Project
The PerfectDraft Pro HA integration is at `/home/rick/Lab/Dev/Hassio-PerfectDraftPro`. The card reads its sensors via the HA entity registry. The integration's `DISCOVERY.md` has the full API documentation.
## OpenSpec
The change `perfectdraft-card` has all artifacts complete in `openspec/changes/perfectdraft-card/`. Tasks file tracks progress at 65/73 (remaining are manual testing tasks).
+22 -2
View File
@@ -4,10 +4,13 @@ A custom Lovelace card for the [PerfectDraft Pro Home Assistant integration](htt
Designed and optimised for the Sonoff NSPanel Pro 120 in landscape mode, but works on any HA dashboard.
![PerfectDraft Card showing Leffe Blonde at 3°C with 18 glasses remaining](docs/screenshot.png)
## Features
- **Beer emoji pictogram** — see how many glasses remain in your keg at a glance
- **Built-in beer catalog** — 45+ PerfectDraft beers with brand color palettes
- **Five layouts** — landscape, portrait, compact, hero, or single-vessel gauge; choose what fits your dashboard (defaults to landscape, so existing cards are unchanged)
- **Beer emoji pictogram** — see how many glasses remain in your keg at a glance, in a grid that shrinks to fit narrow cards
- **Built-in beer catalog** — 75+ PerfectDraft beers, 68 with real keg photos; brand-tinted fallback art for the rest so every beer looks intentional
- **Glass size selector** — tap the emoji zone to choose between 250 mL, 330 mL, 500 mL, UK pint, or US pint
- **Beer selector** — tap the label zone to pick your current beer from the catalog
- **Freshness warnings** — escalating CSS-animated alerts as your keg approaches its 30-day expiry
@@ -51,6 +54,9 @@ type: custom:perfectdraft-card
device_id: "perfectdraft_pro"
beer_name: "Leffe Blonde"
glass_size: 330
layout: landscape # landscape | portrait | compact | hero | vessel
# matrix_columns: auto # "auto" or a fixed number of emoji columns
# max_matrix_width: "480px" # cap + centre the emoji grid on wide cards
# beer_entity: sensor.perfectdraft_pro_keg_name # future: auto beer detection
# custom_beers:
# - name: "My Homebrew IPA"
@@ -69,6 +75,20 @@ glass_size: 330
Selections persist in your browser across page refreshes.
## Layouts
Set `layout` (or pick it in the visual editor) to match where the card lives:
| Layout | Best for |
|--------|----------|
| `landscape` (default) | Wall panels (NSPanel Pro), wide cards — label left, emoji grid right |
| `portrait` | Phones and tall/narrow columns — label on top, grid below |
| `compact` | Dense dashboards — a single row with a remaining-beer bar |
| `hero` | Showing off the beer — full-bleed keg photo with status overlaid |
| `vessel` | A calm single glass that fills to show how much is left |
The emoji grid is width-tolerant: it shrinks to fit narrow cards instead of overflowing. Power users can force a column count with `matrix_columns` or cap/centre the grid with `max_matrix_width`.
## Supported glass sizes
| Size | Description |
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Some files were not shown because too many files have changed in this diff Show More