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

Latest Update made the Card go blank and causes the Overview page to go Blank too #67

Open
LokeYourC3PH opened this issue Nov 11, 2024 · 29 comments

Comments

@LokeYourC3PH
Copy link

What the title says. After updating to the latest version about 9-10 hours ago, the card is now completely blank, and the Dashboard/Overview panel where it is located also does not show up until I do a CTRL+F5 to force reload it. Then I can see everything, and the card itself is basically a 1px empty line, and I had to configure the Dashboard/Overview to remove it for everything to work normally again.

@LokeYourC3PH
Copy link
Author

Note: Adding it back manually after removing it makes the Dashboard go completely blank and you need to remove it via the "Raw Configuration Editor". This is pretty bad.

@Chreece
Copy link
Contributor

Chreece commented Nov 11, 2024

Which integration are you using?

@LokeYourC3PH
Copy link
Author

Which integration are you using?

Didn't get it at first, my bad.

HACS, I use the HACS version.

@LokeYourC3PH
Copy link
Author

I've got something from the raw logs that might help:

2024-11-11 14:52:57.542 ERROR (MainThread) [frontend.js.modern.202411062] Uncaught error from Firefox 132.0 on Windows 10
TypeError: hass.states[weatherEntity] is undefined
set hass (/hacsfiles/air-visual-card/air-visual-card.js:396:34)
createCardElement (src/panels/lovelace/cards/hui-card.ts:125:8)
ev.stopPropagation (src/panels/lovelace/cards/hui-card.ts:152:13)
dispatchEvent (src/common/dom/fire_event.ts:76:7)
tag.includes (src/panels/lovelace/create-element/create-element-base.ts:198:14)
2024-11-11 14:54:10.530 ERROR (MainThread) [frontend.js.modern.202411062] Uncaught error from Firefox 132.0 on Windows 10
TypeError: hass.states[weatherEntity] is undefined
set hass (/hacsfiles/air-visual-card/air-visual-card.js:396:34)
createCardElement (src/panels/lovelace/cards/hui-card.ts:125:8)
ev.stopPropagation (src/panels/lovelace/cards/hui-card.ts:152:13)
dispatchEvent (src/common/dom/fire_event.ts:76:7)
tag.includes (src/panels/lovelace/create-element/create-element-base.ts:198:14)

@ytilis
Copy link

ytilis commented Nov 11, 2024

Chiming in that I'm seeing the same thing. I use Home Assistant Sections and the entire section containing the card becomes blank. The rest of my dashboard was unaffected, just the section containing the card. Editing the Section in YAML mode to remove the card fixed the Section, though as with the original issue reporter, trying to re-add the card only causes it to fail to render again.

I'm seeing the following console error in the frontend when the card is on the page:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'attributes')
    at set hass (air-visual-card.js?hacstag=157674859204:396:68)
    at i.value (hui-card.ts:126:21)
    at i.value (hui-card.ts:42:10)
    at i.value (hui-section.ts:70:13)
    at hui-section.ts:277:12
    at Array.map (<anonymous>)
    at i.value (hui-section.ts:276:32)
    at i.value (hui-section.ts:198:10)
    at i.value (hui-section.ts:98:12)
    at i.performUpdate (reactive-element.ts:1327:14)

The problem on this line:

if (weatherEntity != '' && typeof hass.states[weatherEntity].attributes['wind_speed_unit'] != "undefined"){

You're checking to make sure that weatherEntity is defined, there's no check to make sure that hass.states[weatherEntity] exists. This is happening because you're using weather.home as the default weather value on this line:

weather: "weather.home",

My weather entity has a different id. So the if statement sees the default value of weather.home you've provided in the config, but if the end-user has a different weather entity name, this will fail because there is no state for this non-existant entity.

The best solution, honestly, is probably not to set a default weather entity value, and just leave it blank by default. But since many users probably already have this non-existent entity in their configs due to this default, you'll need to confirm that the entity exists, unless there's a way to do a config migration to remove weather.home if it doesn't exist. IDK how much power HACS gives you to modify existing configs.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

Yes you are right, the weather entity check should return '' if no none is given.
I will try to make a PR in the afternoon to fix that problem. Sorry for that 😔

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

Could you please test the card from my repo:
https://github.com/Chreece/air-visual-card
Please clean browser cache afterwards (shift+f5)

@LokeYourC3PH
Copy link
Author

LokeYourC3PH commented Nov 12, 2024

I mean in my case, my weather integration is PirateWeather, which is quite different from (and better in every way) the default weather integration, which if this card requires the default weather integration to be present all of a sudden, would make sense for why it fails.

The entity ID for it is "weather.pirateweather", which I hope to use in the stead of the default one.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

@LokeYourC3PH still after the changes on my repo you have the same error?

@LokeYourC3PH
Copy link
Author

@LokeYourC3PH still after the changes on my repo you have the same error?

I only use HACS and never manually install plugins, so I cannot test your repo. Gotta wait for ytilis to confirm.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

HACS is using repos though.
But I understand, you can wait for others to test...

@LokeYourC3PH
Copy link
Author

LokeYourC3PH commented Nov 12, 2024

HACS is using repos though. But I understand, you can wait for others to test...

You're right, I could try to manually add your Repo and see if it works, no promises though 👍

EDIT: Hmm, getting an error trying to add your Repo:

image

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

It's not an integration but front-end, I don't know how it's in English

@LokeYourC3PH
Copy link
Author

LokeYourC3PH commented Nov 12, 2024

It's not an integration but front-end, I don't know how it's in English

I see, there's the following options:
image

According to what you say, I would assume Dashboard, so I will try that.

EDIT: Seems like Dashboard works, I will try the plugin now.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

Exactly, dashboard

@LokeYourC3PH
Copy link
Author

LokeYourC3PH commented Nov 12, 2024

Exactly, dashboard

image

Yup, your commit fixed it.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

Are you using the WAQI integration? You should also have the text (Excellent|Good etc) above the PM2.5

@LokeYourC3PH
Copy link
Author

LokeYourC3PH commented Nov 12, 2024

Are you using the WAQI integration? You should also have the text (Excellent|Good etc) above the PM2.5

I'm using the AirVisual Cloud Integration

From my time in Korea, I've come to find out that AirVisual is a lot more accurate than WAQI or other open/public sources.

The extension from AirVisual also has those values, and PirateWeather could show wind speed and all that in the card as well, but this card doesn't utilize those extensions/integrations to their fullest degree that it could.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

I'm happy that AirVisual and the PirateWeather works better for you. My concern is that you don't get the text above the pm2.5 because you should have...
I'll have to look on that... Can you give me the attributes from the sensor you are using for AQI?

@LokeYourC3PH
Copy link
Author

I'm happy that AirVisual and the PirateWeather works better for you. My concern is that you don't get the text above the pm2.5 because you should have... I'll have to look on that... Can you give me the attributes from the sensor you are using for AQI?

Sure, I'll see if I can find them 👍

@LokeYourC3PH
Copy link
Author

I'm happy that AirVisual and the PirateWeather works better for you. My concern is that you don't get the text above the pm2.5 because you should have... I'll have to look on that... Can you give me the attributes from the sensor you are using for AQI?

Here you go:

image

@ntlgr
Copy link

ntlgr commented Nov 12, 2024

Having the same problem.

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

Having the same problem.

please read the conversation above

@LokeYourC3PH can you update your card from my repo?

@LokeYourC3PH
Copy link
Author

Having the same problem.

please read the conversation above

@LokeYourC3PH can you update your card from my repo?

Done, testing now.

@LokeYourC3PH
Copy link
Author

Having the same problem.

please read the conversation above

@LokeYourC3PH can you update your card from my repo?

@Chreece This is the outcome of that update:
image

@Chreece
Copy link
Contributor

Chreece commented Nov 12, 2024

please make sure that AirVisual integration has values on it's entities

Edit: Fixed... Please update now

@LokeYourC3PH
Copy link
Author

please make sure that AirVisual integration has values on it's entities

Edit: Fixed... Please update now

Yep, works ^^

image

@LokeYourC3PH
Copy link
Author

please make sure that AirVisual integration has values on it's entities

Edit: Fixed... Please update now

Will the fixes be added to this original repo, or should I keep using your repo for the time being?

@Chreece
Copy link
Contributor

Chreece commented Nov 16, 2024

Will the fixes be added to this original repo, or should I keep using your repo for the time being?

That's up to @dnguyen800, the PR is waiting to be merged

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