Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom_components/shade_engine/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"issue_tracker": "https://github.com/vfilby/shade-engine/issues",
"requirements": [],
"single_config_entry": true,
"version": "0.5.0"
"version": "0.5.1"
}
21 changes: 19 additions & 2 deletions custom_components/shade_engine/www/shade-engine-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* the history strip, graph_hours (default 24) sets its window.
*/

const CARD_VERSION = "0.5.0";
const CARD_VERSION = "0.5.1";

const RAD = Math.PI / 180;
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
Expand Down Expand Up @@ -473,7 +473,24 @@ class ShadeEngineCard extends HTMLElement {
}
}

customElements.define("shade-engine-card", ShadeEngineCard);
/* Register the element only once Home Assistant's app has booted.
*
* The integration loads this module via `extra_module_url`, which the index
* page imports concurrently with app.js. Since HA 2026.8 the frontend installs
* the scoped-custom-element-registry polyfill, which REPLACES
* window.customElements with a fresh registry; anything defined on the native
* registry before that swap is invisible to customElements.get() and the
* dashboard shows "Custom element doesn't exist". With a warm cache this
* module reliably wins that race and loses the registry, so wait for HA's root
* element and then define on whatever registry is current. */
function registerCard() {
const registry = window.customElements;
if (registry.get("shade-engine-card")) return;
registry.define("shade-engine-card", ShadeEngineCard);
}
customElements
.whenDefined("home-assistant")
.then(registerCard, registerCard);

window.customCards = window.customCards || [];
window.customCards.push({
Expand Down
Loading