Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b28aa89404 | ||
|
|
a2319363d6 | ||
|
|
5adce69c23 | ||
|
|
c086437ce5 | ||
|
|
571d2837f6 | ||
|
|
a53485a927 | ||
|
|
3d8344b9bf | ||
|
|
ffe8006840 | ||
|
|
2134576537 | ||
|
|
a44f5ab9cf | ||
|
|
d1b64fd9c7 |
@@ -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).
|
||||
@@ -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.
|
||||
|
||||

|
||||
|
||||
## 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 |
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 29 KiB |