You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase 4: entity translations, a useful diagnostic sensor, diagnostics
P2-1 — has_entity_name was set but each entity then hardcoded an English
_attr_name, so a Home Assistant running in another language showed
English names. The names move to strings.json under a translation key,
which is what core requires. The config and options flows were already
translated, so only the entity block was missing.
P2-2 — the status sensor reported "Connected" or "Empty", and "Empty"
was unreachable: after the first refresh coordinator.data is always a
non-empty dict, and before it the entity is unavailable anyway, so
"Connected" only restated the availability the entity already reported.
It now reports when the cellar last synchronised, which is what tells a
user that a six-hourly integration is still alive. It keeps its unique
id, so the existing entity is repurposed rather than orphaned, and no
second entity appears. Because the old value never changed once running,
nothing could have been triggering on a transition — which is what makes
the replacement safe rather than breaking. Existing installs keep the
entity id sensor.<account>_status; fresh ones get _last_synchronised.
P2-6 — its attributes were a fixed API path and a sentence of setup
advice, persisted by the recorder on every state write. The README
documents the endpoint; the state machine is not the place for docs.
P2-3 — diagnostics.py, sequenced after P0-3 deliberately: a diagnostics
download is routinely pasted into a public issue, so it is exactly the
path that would have turned that latent credential exposure into a live
one. Redacts the password and the username, and per bottle the Barcode,
Location and Bin. Keeps the column list, which is the signal behind every
"no 'iWine' column" report, plus one redacted sample row.
P2-4 — the value sensor is MONETARY with state_class TOTAL, so it keeps
a long-term statistic, and Home Assistant treats a unit change on an
existing statistic as an error. The statistic is worth keeping: cellar
value over time is the point of the sensor. So the sensor is unchanged
and the *change* is made loud instead — the options form says what will
happen beforehand, and a warning names both currencies at the moment the
user makes the change and can still act on it.
P3-4 — an unrecognised currency became USD silently, labelling a cellar
in the wrong currency. Only reachable from legacy entry data, which is
where it would least likely be noticed. It now warns and says how to fix
it. Recognised codes and mapped legacy symbols stay silent.
P3-3 — every sensor class now carries a docstring.
The SensorEntity test double now resolves public properties from their
_attr_ attributes the way Home Assistant's Entity base does, so these
tests read the same surface a real instance would rather than reaching
for private attributes.
40 tests added, 270 passing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLPEGFSy3fLEuXNUPAPWR4
Copy file name to clipboardExpand all lines: custom_components/cellar_tracker/strings.json
+15-1Lines changed: 15 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,21 @@
37
37
"data": {
38
38
"scan_interval": "Seconds between refreshes",
39
39
"currency": "Currency"
40
-
}
40
+
},
41
+
"description": "Changing the currency relabels the cellar value; it does not convert it. Home Assistant records the value as a long-term statistic in its current unit, so after a change you may need to clear that sensor's statistics before it records again."
Copy file name to clipboardExpand all lines: custom_components/cellar_tracker/translations/en.json
+15-1Lines changed: 15 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,21 @@
37
37
"data": {
38
38
"scan_interval": "Seconds between refreshes",
39
39
"currency": "Currency"
40
-
}
40
+
},
41
+
"description": "Changing the currency relabels the cellar value; it does not convert it. Home Assistant records the value as a long-term statistic in its current unit, so after a change you may need to clear that sensor's statistics before it records again."
0 commit comments