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

Cannot read properties of undefined (reading 'length') #960

Closed
ildar170975 opened this issue Apr 25, 2023 · 8 comments
Closed

Cannot read properties of undefined (reading 'length') #960

ildar170975 opened this issue Apr 25, 2023 · 8 comments
Labels
bug Something isn't working released on @dev released

Comments

@ildar170975
Copy link
Collaborator

ildar170975 commented Apr 25, 2023

0.12.0-dev.2

Observe this error in Browser console for ALL entities which were not changed within a selected period:

  1. DB size did not change within 4 days (> 24 hrs which is a default value for hours_to_show)
type: custom:mini-graph-card
entities:
  - sensor.home_assistant_v2_db_size

изображение

изображение

  1. This input_number helper was not changed for a long time.
    Consider this card:
type: vertical-stack
cards:
  - type: custom:mini-graph-card
    entities:
      - input_number.testing_device_class_apparent_power
  - type: history-graph
    entities:
      - entity: input_number.testing_device_class_apparent_power
  - type: entities
    entities:
      - entity: input_number.testing_device_class_apparent_power

Now the graph is not displayed, same errors in the console:
изображение
изображение

Change the helper's value - then the graph will be displayed w/o errors:

изображение

  1. Any sensor which value was changed more than 15 minutes ago:
    изображение
@ildar170975 ildar170975 added the bug Something isn't working label Apr 25, 2023
@akloeckner
Copy link
Collaborator

That might be related to the way, HA reports history. I believe, if we ask it "what is the history of the last hour?", it will respond with "nothing" if there were no changes. If we want to fix that, we have to also ask it "What's the current state", and just use that in a flat line.

Not sure, if that's already what we're doing. If it's not, it will be quite some code change. Then, just displaying a message instead of the graph might be easier: "no changes in the last X hours".

@ildar170975
Copy link
Collaborator Author

Tested with 0.11:
no errors, graph IS displayed, also plenty of "fetch" messages in console:

изображение

@ildar170975
Copy link
Collaborator Author

ildar170975 commented Apr 25, 2023

it will be quite some code change.

I just upgraded to 0.12.dev version - and got these "no graph displayed" issues for MANY of my graphs.
Earlier these graphs were displayed as flat - and it was OK since it was true.
As you can see in the post above, downgrading to 0.11 again caused these graphs displayed.

Then, just displaying a message instead of the graph might be easier: "no changes in the last X hours".

This will be absolutely not informative, 99% of users will expect flat lines in this case.

@akloeckner
Copy link
Collaborator

Hmm... OK. So it's good I didn't fire the release script on the master branch. 😆

@akloeckner
Copy link
Collaborator

It might be my change here: 527f005

That's the only difference in calcPoints I could find.

akloeckner added a commit to akloeckner/mini-graph-card that referenced this issue Apr 26, 2023
This re-insures the logic to keep the last known state before the start of our grah interval within the history.
While this is not really correct, it allows for rendering state-state-graphs.

This element was mistakenly removed in kalkih#881.

The piece of code relies on history being chronographical.

fixes kalkih#960
akloeckner added a commit to akloeckner/mini-graph-card that referenced this issue Apr 26, 2023
This re-insures the logic to keep the last known state before the start of our grah interval within the history.
While this is not really correct, it allows for rendering steady-state-graphs.

This element was mistakenly removed in kalkih#881.

The piece of code relies on history being chronographical.

fixes kalkih#960
@ildar170975
Copy link
Collaborator Author

ildar170975 commented Apr 27, 2023

Seems to be solved by #961 (changes not yet added to a release)
@akloeckner - thanks a lot!

akloeckner added a commit that referenced this issue Apr 27, 2023
This re-insures the logic to keep the last known state before the start of our grah interval within the history.
While this is not really correct, it allows for rendering steady-state-graphs.

This element was mistakenly removed in #881.

The piece of code relies on history being chronographical.

fixes #960
github-actions bot pushed a commit that referenced this issue Apr 27, 2023
# [0.12.0-dev.3](v0.12.0-dev.2...v0.12.0-dev.3) (2023-04-27)

### Bug Fixes

* retain the last out-of-bounds state ([#961](#961)) ([8ebe173](8ebe173)), closes [#881](#881) [#960](#960)
@github-actions
Copy link

🎉 This issue has been resolved in version 0.12.0-dev.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this issue Jan 27, 2024
# [0.12.0](v0.11.0...v0.12.0) (2024-01-27)

### Bug Fixes

* add first datapoint tooltip for line graph ([#882](#882)) ([7576fe6](7576fe6))
* allow zero tooltip ([057a395](057a395)), closes [#805](#805)
* cards would always assume icon_image was set ([#957](#957)) ([f376732](f376732))
* drop out-of-bound coords in reducer ([#881](#881)) ([527f005](527f005)), closes [#251](#251)
* retain the last out-of-bounds state ([#961](#961)) ([8ebe173](8ebe173)), closes [#881](#881) [#960](#960)
* **documentation:** enquote html color ([dbdeab8](dbdeab8)), closes [#872](#872)
* **stalebot:** issues should also use exemptLabels ([4d74c1f](4d74c1f))
* **workflows:** remove invalid description field ([e755e24](e755e24))

### Features

* Add support of attribute tree when available ([#996](#996)) ([9c1c31e](9c1c31e))
* pull two years worth of changes into release channel ([f5fb98d](f5fb98d)), closes [#1059](#1059)
* **option:** override icon with an image URL ([#789](#789)) ([2860a09](2860a09))
Copy link

🎉 This issue has been resolved in version 0.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released on @dev released
Projects
None yet
Development

No branches or pull requests

2 participants