Skip to content

Temporary error upon loading the card #586

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

Closed
2 tasks done
afarago opened this issue Nov 27, 2023 · 3 comments
Closed
2 tasks done

Temporary error upon loading the card #586

afarago opened this issue Nov 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@afarago
Copy link
Contributor

afarago commented Nov 27, 2023

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
5.3.0

Last working release (if known):

Browser and Operating System:
Version 119.0.6045.160 (Official Build) (64-bit)
Windows 11

Description of problem:
Initial loading of the page shows an error, that disappears in <1 sec, still is quite disturbing.
image

This comes upw even with the simplest layout of the card.

Javascript errors shown in the web inspector (if applicable):
none

Additional information:
example config tested:

type: custom:hourly-weather
entity: weather.home
@afarago afarago added the bug Something isn't working label Nov 27, 2023
@decompil3d
Copy link
Owner

Interesting, I wonder if this is a result of the recent change to use a web service call to get forecasts from HA. Perhaps we can hold off on showing errors if the web service call hasn't completed yet. If someone has time to look at this I can look at a PR. Otherwise, I'll get to this when I can.

@evilmouse69
Copy link

I also got the same error come up on my little wall panel

IMG_7597

afarago added a commit to afarago/lovelace-hourly-weather that referenced this issue Jan 11, 2024
@afarago
Copy link
Contributor Author

afarago commented Jan 11, 2024

So in the past days I was able to debug the problem, and get the root cause.

  • (I have a quite big dashboard with multiple different cards, using Meteorologisk institutt (Met.no))
  • initially we start the subscription with subscribeToForecastEvents
  • upon loading card starts rendering renderCore
  • this calls const forecast = this.getForecast();
  • as there is no answer yet from the subscription ( this.forecastEvent?.forecast is equals null in private getForecast() that returns the default daily granularity from the this.hass?.states[this.config.entity]?.attributes.forecast (6 items with daily granularity))
  • yields to error (this._showError(this.localize('errors.too_many_segments_requested')))
  • shortly HA kicks in for the subscription and subscribeMessage callback returns with the hourly distribution (24 entries in the array)
  • card re-renders with correct content.

I have an initial suggestion, please feel to review the PR and comment/modify.

decompil3d added a commit that referenced this issue Feb 23, 2024
* handle weather forecast callback delay #586

* adding test for transient error handling
handle if HA not supports subscription

* [tiny] Spacing nit

---------

Co-authored-by: Jonathan Keslin <[email protected]>
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

3 participants