The versatile custom Swiss Army Knife card for Home Assistant allows you to create your unique visualization using several graphical tools, styling options and animations.
244
stars
21
forks
source link
"Null" attributes throw and error (and do not load card) #247
Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!
So make sure your problem is not related to that!
[x] Yes, I'm sure that it is not a configuration mistake
Swiss Army Knife version
V2.5.1
Bug description
When defining an attribute in an entity configuration, the entire card disappears if that attribute becomes null. This is for example the case for most attributes of a light when said light is turned off. The console shows an error message with TypeError: t is null. Using a convert statement in the entity config is a workaround to solving this. This is a possible fix for brightness values, but for example for effects of a light it is not.
To Reproduce
Steps to reproduce the behavior:
Make a card, and define an entity, for example a light, with its attribute set to effect.
Refresh the dashboard.
Turn on the light and apply an effect. Refresh the page, the card should be showing correctly.
Turn off the light.
The card should now have disappeared from the dashboard.
See error
Expected behavior
Show the card, passing a state of null or something similar to the connected tools.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop browser (please complete the following information):
OS: Windows
Browser Firefox
Version 122.0.1
Additional context
The error thrown in the browser's console:
Uncaught (in promise) TypeError: t is null
_buildStateString swiss-army-knife-card.js:971
set hass swiss-army-knife-card.js:927
_createCard decluttering-card.js:192
async*set hass decluttering-card.js:186
value hui-view.ts:68
value hui-view.ts:304
value hui-view.ts:80
r fire_event.ts:76
h create-element-base.ts:127
promise callback*7778/h/< create-element-base.ts:125
h create-element-base.ts:213
c create-element-base.ts:170
f create-card-element.ts:102
value hui-view.ts:66
_cards hui-view.ts:288
value hui-view.ts:287
value hui-view.ts:216
value hui-view.ts:132
performUpdate reactive-element.ts:1327
scheduleUpdate reactive-element.ts:1261
_$Ej reactive-element.ts:1233
requestUpdate reactive-element.ts:1208
_$Eu reactive-element.ts:946
b reactive-element.ts:931
i hui-view.ts:45
E scoped-custom-element-registry.js:385
t scoped-custom-element-registry.js:236
value hui-root.ts:963
value hui-root.ts:681
setTimeout handler*96151/r/< render-status.ts:2
r render-status.ts:2
value hui-root.ts:681
_$AE reactive-element.ts:1378
performUpdate reactive-element.ts:1343
scheduleUpdate reactive-element.ts:1261
_$Ej reactive-element.ts:1233
requestUpdate reactive-element.ts:1208
_$Eu reactive-element.ts:946
b reactive-element.ts:931
A lit-element.ts:115
o hui-root.ts:103
E scoped-custom-element-registry.js:385
t scoped-custom-element-registry.js:236
u lit-html.ts:1129
g lit-html.ts:1543
_$AI lit-html.ts:1384
z lit-html.ts:2183
update lit-element.ts:165
performUpdate reactive-element.ts:1329
scheduleUpdate reactive-element.ts:1261
swiss-army-knife-card.js:971:2629
Bug report notice
Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!
So make sure your problem is not related to that!
Swiss Army Knife version
V2.5.1
Bug description
When defining an attribute in an entity configuration, the entire card disappears if that attribute becomes
null
. This is for example the case for most attributes of a light when said light is turned off. The console shows an error message withTypeError: t is null
. Using a convert statement in the entity config is a workaround to solving this. This is a possible fix for brightness values, but for example for effects of a light it is not.To Reproduce
Steps to reproduce the behavior:
effect
.Expected behavior
Show the card, passing a state of
null
or something similar to the connected tools.Screenshots
If applicable, add screenshots to help explain your problem.
Desktop browser (please complete the following information):
Additional context The error thrown in the browser's console:
(Optional): Suggested Solution
Any suggested solution to this bug.