Skip to content

v0.7.7 — fix the last "Configuration error" trigger: a swallowed define()

Choose a tag to compare

@petergCA petergCA released this 25 Jul 05:59
· 15 commits to main since this release

The root cause, finally captured

v0.7.5's self-reporting trap caught the failure live: on affected page loads, Lovelace rebuilt the card into "Custom element doesn't exist: sensor-sentinel-card" over and over — while the card's JavaScript was demonstrably loaded and running.

How that's possible: the scoped custom-element-registry polyfill (pulled in by cards like tabbed-card) can make customElements.define() throw at a moment when get() still returns undefined. This card's define guard (added in v0.6.18) treated any define() throw as "another copy already registered it" and swallowed it. Under the polyfill race that assumption is wrong — the element ends up genuinely unregistered, so Home Assistant's every rebuild attempt re-fails and the red card sticks (or flashes on slow devices, where views build before the module arrives; HA only hides the placeholder error for 2 seconds).

Fixes

  • Registration is now retried with backoff (up to 8 attempts) until customElements.get() confirms the element is truly defined — a define() throw is never again assumed benign.
  • The self-heal sweep re-defines the element first when it finds a stuck error card while the tag is undefined, then triggers the rebuild — previously the rebuild was doomed to re-fail.
  • First sweep moved up to 300 ms (shorter visible flash on slow devices, e.g. the iPhone Companion app) and a 45 s tail sweep added.
  • Better diagnostics: the sensor-sentinel-error-log ring now records the real error message and whether the tag was defined at heal time.

Note on updating

After updating via HACS, restart Core, then reload each device once (on the iPhone Companion app: Settings → Companion App → Debugging → Reset frontend cache if it's been showing stale behavior). Console banner should read SENSOR-SENTINEL-CARD v0.7.7.