Closed digidestination closed 2 years ago
Can you add your card configuration and any errors in the dev console (F12)
@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
@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...
a few more tests i did:
weather
property to weather.my_home
in the card's config and logged weatherEntity
again on line 426, and something strange happened, i got 2 logs:
weather.home
weather.my_home
and still got the error once.. this just gets stranger and stranger..
@Swampen I created a PR for this: https://github.com/dnguyen800/air-visual-card/pull/56
@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.
i'll update it today. Thanks for finding and fixing the issue!
@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
)
After I added this card, this and all other cards disappear.