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
{{ message }}
This repository was archived by the owner on Oct 8, 2020. It is now read-only.
class ContentCardExample extends HTMLElement {
constructor() {
super();
console.log('*****Event - card - constructor', Math.random().toString(36).substr(2, 9), new Date().getTime());
}
set hass(hass) {
if (!this.content) {
let startTime = new Date()
console.log("Create new ha-card", startTime)
const card = document.createElement("ha-card");
card.header = "Example card";
this.content = document.createElement("div");
this.content.style.padding = "0 16px 16px";
card.appendChild(this.content);
this.appendChild(card);
}
const entityId = this.config.entity;
const state = hass.states[entityId];
const stateStr = state ? state.state : "unavailable";
this.content.innerHTML = `
The state of ${entityId} is ${stateStr}!
<br><br>
<img src="http://via.placeholder.com/350x150">
`;
}
setConfig(config) {
if (!config.entity) {
throw new Error("You need to define an entity");
}
this.config = config;
}
// The height of your card. Home Assistant uses this to automatically
// distribute all cards over the available columns.
getCardSize() {
return 3;
}
}
customElements.define("content-card-example", ContentCardExample);
When I activate the custom header, the constructor of a customElements is called multiple times. This worsens the display of the view massively.
System Home Assistant 0.116.0b5
Frontend-Version: 20201001.1 - latest
Config
Without custom_header:

With custom_header:

customElement:
Is there a workaround for so I can use the CCH?