cn-map-card.js:165 Uncaught (in promise) TypeError: Cannot read property 'primary-background-color' of undefined
at HTMLElement.set hass [as hass] (cn-map-card.js:165)
at chunk.b78314dc93f493d4fbaf.js:44804
at Array.forEach (<anonymous>)
at HTMLElement.value (chunk.b78314dc93f493d4fbaf.js:44804)
at HTMLElement.performUpdate (app.a9501bd7.js:1)
at HTMLElement._enqueueUpdate (app.a9501bd7.js:1)
就是以下代码部分
if(dark_mode==="auto"){
if(this.theme!=newTheme){
let cardColor = hass.themes.themes[newTheme]["primary-background-color"] || "#FFFFF";
let lightness = cardColor?w3color(cardColor).lightness:1;
let colorDark = lightness<0.5?true:false;
style = colorDark?'dark':'normal';
this.map.setMapStyle("amap://styles/"+style);
this.root.querySelector("#map").className = style;
this.old_mode = dark_mode;
this.theme=hass.themes.default_theme;
}
}
这一行
let cardColor=let cardColor = hass.themes.themes[newTheme]["primary-background-color"] || "#FFFFF";