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

No other cards are visible after I added this card #55

Closed
digidestination opened this issue Nov 25, 2021 · 8 comments
Closed

No other cards are visible after I added this card #55

digidestination opened this issue Nov 25, 2021 · 8 comments

Comments

@digidestination
Copy link

After I added this card, this and all other cards disappear.

@Swampen
Copy link
Contributor

Swampen commented Nov 25, 2021

Can you add your card configuration and any errors in the dev console (F12)

@jaruba
Copy link
Contributor

jaruba commented Dec 2, 2021

@Swampen it's likely that me and @digidestination have the same issue

i recently updated ha and all the extensions including this one, under Overview -> Home i can see all the cards when i refresh the page, but while browsing around ha, the next time i get to Overview there are no cards at all..

dev tools shows this as the only error in lovelance:

air-visual-card.js?hacstag=157674859200:426 Uncaught TypeError: Cannot read properties of undefined (reading 'attributes')
    at HTMLElement.set hass [as hass] (air-visual-card.js?hacstag=157674859209:426)
    at HTMLElement.value (hui-masonry-view.ts:44)
    at HTMLElement.value (hui-masonry-view.ts:44)
    at HTMLElement.t.addEventListener.once (hui-masonry-view.ts:44)
    at i (typography.js:181)
    at ha-logbook.ts:28

which points to this line: https://github.com/dnguyen800/air-visual-card/blob/master/dist/air-visual-card.js#L426

and my card's config is:

type: custom:vertical-stack-in-card
title: Air Quality
cards:
  - type: custom:air-visual-card
    air_pollution_level: sensor.u_s_air_pollution_level_2
    air_quality_index: sensor.u_s_air_quality_index_2
    main_pollutant: sensor.u_s_main_pollutant_2
    city: Bucharest
    hide_title: true
    hide_weather: true

this error makes no sense to me though, as i don't set the weather property:
https://github.com/dnguyen800/air-visual-card/blob/master/dist/air-visual-card.js#L256

which means that weatherEntity should be '', so this should be falsey:
https://github.com/dnguyen800/air-visual-card/blob/master/dist/air-visual-card.js#L425

and thus the code should never reach the 426th line which is where the error is from

@jaruba
Copy link
Contributor

jaruba commented Dec 2, 2021

@Swampen huh, i logged weatherEntity at the 426th line, and it's showing weather.home.. but I have no such entity.. and i never set weather in the card config or configuration.yaml...

@jaruba
Copy link
Contributor

jaruba commented Dec 2, 2021

a few more tests i did:

weather.home
weather.my_home

and still got the error once.. this just gets stranger and stranger..

@jaruba
Copy link
Contributor

jaruba commented Dec 2, 2021

@Swampen I created a PR for this: #56

@Swampen
Copy link
Contributor

Swampen commented Dec 2, 2021

@jaruba Great! You found a solution.
I think maybe this line also might be causing some problems. https://github.com/dnguyen800/air-visual-card/blob/master/dist/air-visual-card-editor.js#L64
Did you by any chance configure it with the GUI?

I don't have contributer rights to this repo, so I can't do anything with your PR. @dnguyen800 needs to take a look at it.

@dnguyen800
Copy link
Owner

i'll update it today. Thanks for finding and fixing the issue!

dnguyen800 added a commit that referenced this issue Dec 3, 2021
@jaruba
Copy link
Contributor

jaruba commented Dec 3, 2021

@dnguyen800 thanks! works great now

@Swampen yeah, i used the GUI to add the card and configure it, that default value shouldn't be used though.. weather.home is only available for those that never changed their HA's home name, as the weather entity name changes according to the HA home name. (ex: if i set the home name to "My Home", the weather entity becomes weather.my_home)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants