Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Null" attributes throw and error (and do not load card) #247

Open
1 task done
Slalamander opened this issue Feb 13, 2024 · 1 comment
Open
1 task done

"Null" attributes throw and error (and do not load card) #247

Slalamander opened this issue Feb 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Slalamander
Copy link

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!

  • 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:

  1. Make a card, and define an entity, for example a light, with its attribute set to effect.
  2. Refresh the dashboard.
  3. Turn on the light and apply an effect. Refresh the page, the card should be showing correctly.
  4. Turn off the light.
  5. The card should now have disappeared from the dashboard.
  6. 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

(Optional): Suggested Solution

Any suggested solution to this bug.

@Slalamander Slalamander added the bug Something isn't working label Feb 13, 2024
Copy link

Thank you for creating your first issue for the Swiss Army Knife custom card!

@Slalamander Slalamander changed the title "Null" attributes crash a card "Null" attributes throw and error (and do not load card) Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant