The catalog had the umlauts stripped, unlike its own 454 entry (Löwenbräu) and the companion card. Product ID and position are unchanged. Issue #8; ships with card 0.4.5, which adds keg artwork for both Oktoberfestbier kegs.
Co-authored-by: Cursor <cursoragent@cursor.com>
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>
The dev host has only Python 3.14; the 0.13.205 pin needs 3.12 (its numpy has no 3.14 wheel). The pycares 4.5.0 workaround is no longer needed: verify_cleanup passes with pycares 5.2.1.
Core 2026.x no longer treats a parked reauth flow as in progress for a new user flow with the same unique ID, so that path now aborts already_configured instead of already_in_progress. Both are translated; the test accepts either.
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.
An uninitialised probe reports -128 (0x80 read as a signed 8-bit
integer) while the refrigeration starts up. The cloud API relays it
verbatim and the sensor reported it as a real measurement, polluting
history graphs and long-term statistics.
Readings outside -20..50 C are now treated as firmware sentinels and
the sensor reports no value, so the state is 'unknown' and the recorder
excludes it. A range check is used rather than matching -128 exactly so
sibling sentinels are caught too. Both temperature fields are validated;
previously the details.temperature fallback was used unconditionally.
The sensor deliberately reports 'unknown' rather than going unavailable:
the coordinator poll succeeded and only the reading is missing, which
matches how every other sensor here signals absent data.
Logic lives in a new HA-free temperature.py so it can be unit-tested
without the Home Assistant harness, following the keg_detection.py
precedent.
Refs: Falkvinge/hassio-integration-perfectdraft-pro#4
Co-authored-by: Cursor <cursoragent@cursor.com>
Verification caught this change violating its own requirement that every
abort reason the flow can emit has a translation. async_set_unique_id()
defaults to raise_on_progress=True and raises already_in_progress when
another flow holds the same unique ID. That is reachable, and reachable
by exactly the users this change is for: park a reauth flow, give up,
try Add Integration for the same account, and the raw key surfaces.
The coverage test was hardcoded to three reasons, so it checked a "for
every" requirement against a list written by hand and passed anyway.
Replace it with an AST scan of config_flow.py that resolves each
aborting helper call to the reason it raises, honouring explicit reason=
and the raise_on_progress=False opt-out, plus a sanity test so a scanner
that goes blind fails instead of silently passing. Confirmed the new
check fails against the pre-fix translation files.
Also adds a regression test for the concurrent-flow path, which is the
evidence that this abort is real rather than theoretical.
Co-authored-by: Cursor <cursoragent@cursor.com>
async_step_token is shared by the user and reauth sources but was written
only for the former. It called _abort_if_unique_id_configured() on every
path, and during reauth the unique ID belongs to the entry being repaired,
so the duplicate guard fired by design: authentication succeeded, the flow
aborted with already_configured, the new tokens were discarded, and the
coordinator's next poll re-raised the reauth repair. The integration was
unrecoverable through the UI short of delete-and-re-add, which costs entity
history and the restored keg-freshness baseline.
Branch on self.source at the terminal step, per HA's documented pattern for
flows shared between setup and reauth: reauth now guards with
_abort_if_unique_id_mismatch() and persists through
async_update_reload_and_abort(), which merges the new tokens into the
existing entry, keeps email and machine ID, reloads, and aborts with
reauth_successful. The user path keeps _abort_if_unique_id_configured()
unchanged.
Reauth also stops re-fetching /api/me when the entry already records a
machine ID, removing a round trip from a flow the user waits on and a
failure mode where a transient /api/me error turned a successful sign-in
into cannot_connect.
The helpers require core 2024.11, so declare that floor in hacs.json —
otherwise older cores would AttributeError mid-flow, which is worse than
the bug being fixed.
Adds the repo's first HA test harness (requirements-test.txt, opt-in) with
regression tests covering token persistence, entry reload, account
mismatch, case-insensitive email, and the explicit assertion that reauth
never aborts as already_configured. tests/test_keg_detection.py still runs
standalone under python3 -m unittest.
Version set to 0.3.1 rather than the 0.4.0 that PR #2 introduced; no
v0.4.0 tag was ever cut, so nothing was released under that number.
Co-authored-by: Cursor <cursoragent@cursor.com>
Keg-change detection previously fired only when the pour counter reset
to 0 while the keg read near full. That misses the common case where the
user swaps the keg and pours immediately, so pours never reads 0.
Detection now also fires on two volume-based signals (independent of the
pour counter): (b) remaining volume jumping from below 80% to at least
95%, and (c) any upward jump of at least 50 percentage points. The
decision logic is extracted to a dependency-free keg_detection module
with unit tests covering each trigger and the swap-then-pour case.
Adds a "Mark Keg Changed" button as a deterministic manual override,
wired to the freshness sensor via a dispatcher signal; the sensor now
tracks and restores last_volume alongside last_pours.
Bumps version to 0.3.0.
Co-authored-by: Cursor <cursoragent@cursor.com>