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

Graph may not be updated #944

Open
ildar170975 opened this issue Mar 25, 2023 · 10 comments
Open

Graph may not be updated #944

ildar170975 opened this issue Mar 25, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@ildar170975
Copy link
Collaborator

ildar170975 commented Mar 25, 2023

HA 2023.3.5
latest mini-graph-card
Win10+Chrome

Consider this code:

input_number:
  testing_number_01:
    min: 0
    max: 1
    step: 1
    mode: slider
type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_number.testing_number_01
        name: number
        secondary_info: last-changed

  - type: history-graph
    entities:
      - input_number.testing_number_01
    hours_to_show: 1

  - type: custom:mini-graph-card
    entities:
      - input_number.testing_number_01
    hours_to_show: 1
    points_per_hour: 3600
    aggregate_func: last
    smoothing: false
    line_width: 1
    cache: false
    show:
      labels: true

where cache: false seems to be not affecting at all, points_per_hour: 240 is defined to ensure that changes made frequently by a user (here interval is 15 sec) are displayed properly.

Clear browser cache.

The initial state:
image

Now change value and see how the mini-graph-card is updated.
After 1 minute the graph is not updated:
image

Change again:
image
Immediately after changing the graph is redrawn - but we see only "0 -> 1" change instead of "0 -> 1 -> 0".

Go to Editor - the graph is displayed properly:
image

Go back, refresh (F5) - the graph is displayed properly:
image

Setting points_per_hour: 3600, playing with cache: false do not help.

And now the weirdest part:

  1. Copy the whole card onto another view.
  2. Change value - the graph is updated properly - but after several minutes I observe the same behaviour.
@ildar170975 ildar170975 added the bug Something isn't working label Mar 25, 2023
@jlsjonas
Copy link
Collaborator

I'll try to look into it this weekend, thnx for the report!

@akloeckner
Copy link
Collaborator

When searching the repo for update, I found #250 . Maybe related.

@ildar170975
Copy link
Collaborator Author

I noticed the problem recently - may be same time when history-graph became "streaming"; not sure if it could be related...

@echo-lalia
Copy link

I just want to add that I believe I am observing the same issue. Graphs only seem to be accurate on refresh, and have really unexpected behavior when displaying them for a long time. (in addition to not updating regularly, I am having issues where two entities on the same graph/axis will not line up properly, or will disappear)

Before refreshing:
image

After refreshing:
image

- type: custom:mini-graph-card
  entities:
    - entity: sensor.octoprint_actual_tool0_temp
      show_fill: false
    - entity: sensor.octoprint_target_tool0_temp
      smoothing: false
      show_fill: true
      show_line: false
      show_state: false
      show_points: false
  hours_to_show: 1
  points_per_hour: 10
  min_bound_range: 5
  show:
    icon: true
    extrema: false
    fill: fade
    legend: false
    name: false
  icon: mdi:printer-3d-nozzle-heat
  align_icon: state
  update_interval: 5

@ildar170975
Copy link
Collaborator Author

Just confirming that with the same version of mini-graph-card & HA 2024.1 - still same glitch:

1

@akloeckner
Copy link
Collaborator

From your animation, it looks to me like our graph does not update the most recent point, but only shows the second-most recent data point. 🤔

@ildar170975
Copy link
Collaborator Author

Seems so (

@akloeckner
Copy link
Collaborator

While thinking about #1075 , I realized, we have two places where we react to HA state changes:

  • render is called every time this.hass changes. And it actually only renders data cached in this.points and the likes.
  • updateData is called every time this.hass is set. And it actually generates the cached data rendered later by render.

So, I wonder if maybe render is called before updateData. This might explain the behaviour described here.

@ildar170975
Copy link
Collaborator Author

@akloeckner
Have you found anything?
Is there any workaround? Except forcing a user to press F5 periodically )))

@akloeckner
Copy link
Collaborator

No, I don't have that many "binary" sensors plotted with mini-graph-card. Plus, I don't keep the graphs open for long times, usually. 🤷 Also, I have no clear idea how this could be fixed. Not even, if my hypothesis above is correct: I have no clue how the order of execution could be changed without changing the architecture of the code. 😕

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

4 participants