Observed by MThomas564 on a machine with the keg fitted (#9, PR #10).
Appended after 48134 to keep numeric key order; catalog floor ratchets
to 117.
Co-authored-by: MThomas564 <mattraethomas97@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Chromium truncates prompt() default values at 2,000 characters, cutting off the ~2,500-character token. The command now adds a 'Click to copy' button whose handler calls navigator.clipboard.writeText; the click supplies the user activation the Clipboard API needs in every browser. The token is also logged as a fallback.
Co-authored-by: Cursor <cursoragent@cursor.com>
Console copy() cannot copy a value that arrives asynchronously in Firefox (it only sets a helper result read when the command returns) or Chromium (copy is gone by then). A second command would work but adds a step. Instead the single command opens prompt() with the token selected, so Ctrl+C/Cmd+C copies it, and also logs it as a fallback.
Co-authored-by: Cursor <cursoragent@cursor.com>
Firefox's console copy() only records a helper result that is read when the command returns, so calling it from the token promise copied nothing. Store the token in window.pdToken, then copy(pdToken) in a second command, which every browser supports.
Co-authored-by: Cursor <cursoragent@cursor.com>
PerfectDraft's Cognito PreAuthentication Lambda now requires a "domain"
field in ClientMetadata. The api.perfectdraft.com /authentication/sign-in
gateway does not forward it, so every setup and reauth failed with
"PreAuthentication failed with error 'domain'" (#11, #12, #13).
authenticate() now calls Cognito InitiateAuth (USER_PASSWORD_AUTH)
itself, the endpoint token refresh already uses.
A failed sign-in now says what was rejected and why. A wrong email or
password returns to the credentials form; a rejected token stays on the
token step; both show Cognito's reason instead of the old blanket "token
may have expired", which hid this outage.
The README snippet copies the token to the clipboard. It captures copy()
up front because Chromium removes it once the console command returns.
Root cause and fix by @cesa030 in #11; confirmed in @brettjenkins' fork.
Co-authored-by: Cursor <cursoragent@cursor.com>
The DE/AT wrap is a distinct SKU from the UK Budweiser keg at 31747.
Observed from a fitted machine in issue #3. Bump to 0.3.3.
Co-authored-by: Cursor <cursoragent@cursor.com>
Companion to the previous commit, which is Brett Jenkins' catalog work
cherry-picked with authorship intact rather than copied in as data. This
commit adds what the backport needs around it.
README: credit Brett and his fork for the keg name sensor, the Keg and
Keg Product sensors, and the whole 114-entry catalog, and explain why the
catalog is hand-maintained — the API will not return the ID-to-name
mapping in bulk, so every entry is observed from a machine with that keg
fitted and none of it can be inferred. Also tells a user with a blank Keg
sensor to report their Keg Product ID, which is the only way the catalog
grows.
tests/test_keg_catalog.py: format and content guards for the spec
scenarios, stdlib-only so it runs under python3 -m unittest alongside
test_keg_detection.py without the opt-in HA harness.
Two of those guards cover failure modes that are silent rather than loud:
- Duplicate keys. json.loads() keeps the last one, so a repeated ID
would quietly discard an observed name. Only a pair-count comparison
sees it.
- Non-numeric keys. _load_keg_catalog builds {int(k): v ...} and
catches ValueError by returning an empty dict, so one "_meta" or
"_source" key would disable the entire catalog and leave every keg
with no name. This matters because embedding attribution or
provenance in the JSON is the obvious next idea, and it cannot be
done without changing the loader first. The test documents that.
Version 0.3.2, continuing from 0.3.1. Not the fork's 0.4.1: 0f3b4c2
renumbered to 0.3.1 deliberately because no v0.4.0 tag was ever cut.
hacs.json is left alone, including the 2024.11.0 floor the fork predates.
Resolves the tapped keg's product id to a beer name via a bundled
catalog (keg_catalog.json), exposing it as a new Keg sensor alongside
the existing Keg Remaining/Freshness sensors.
Critical fix:
- Cognito refresh now parses response with content_type=None
(was crashing after 1hr when access token expired)
HACS compliance:
- Added README.md with full setup instructions including the
token generation command
- Fixed manifest.json URLs to point at actual repo
- Version bumped to 0.2.0
Brand:
- Added brand/icon.png (PerfectDraft glass icon from official app)
New sensor:
- Keg Freshness: 30-day countdown from keg insertion, detected
via numberOfPoursSinceStartup reset + kegVolume near full,
persisted across restarts via RestoreEntity
Polish:
- Fixed MALFORMED_ARGUMENT in token step description
- Cleaner description referencing README for instructions
Made-with: Cursor