It seems that if a custom card that defines hass() is embedded within vertical-stack-in-card, then attribute passed to hass() is undefined, resulting in Uncaught (in promise) TypeError: hass is undefined
For example, card defined as follows:
class IQVIACard extends HTMLElement {
set hass(hass) {
if (!this.content) {
const card = document.createElement('ha-card');
card.header = 'IQVIA';
this.content = document.createElement('div');
this.content.style.padding = '16px 16px 16px 16px';
card.appendChild(this.content);
this.appendChild(card);
}
const getColor = function (aindex) {
var color = 'var(--secondary-text-color)';
if (aindex >= 2.5) color = 'var(--make-blue)';
if (aindex >= 4.9) color = 'var(--make-yellow)';
if (aindex >= 7.3) color = 'var(--make-orange)';
if (aindex >= 9.7) color = 'var(--make-red)';
return color;
};
const allergy_today = hass.states[this.config.entity_allergy_today];
// ...
We get:
Uncaught (in promise) TypeError: hass is undefined
set hass local/iqvia-card.js?v=1:23
createCardElement local/vertical-stack-in-card.js?v=0.3.3:95
promises local/vertical-stack-in-card.js?v=0.3.3:25
renderCard local/vertical-stack-in-card.js?v=0.3.3:25
setConfig /local/vertical-stack-in-card.js?v=0.3.3:20
It seems that if a custom card that defines hass() is embedded within vertical-stack-in-card, then attribute passed to hass() is undefined, resulting in
Uncaught (in promise) TypeError: hass is undefined
For example, card defined as follows:
We get:
Tested also with version 0.4.0