home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.03k stars 2.76k forks source link

History graph: bad position for on and off graph datapoints. #10489

Closed mdeweerd closed 1 year ago

mdeweerd commented 2 years ago

Checklist

Describe the issue you are experiencing

History graph: bad position for on and off graph datapoints.

Straight graph line for shown values, not as steep as initial line while consumption is increasing.

I discovered this on the next top graph. My daily consumption is higher than the day before, but the incoming line is steeper than the line between the points in view. (the bottom graph shows the amount of increase which is added to the total at a fixed time each day).

image

Increasing the number of hours shown on the history graph, revealed that the line shown in the graph is straight even with a different consumption each day.

The expectation is that the graph shows multiple segments with different steepness.

The graph for multiple days: image

Context

I get the daily gas consumption from the suppliers API once per day. I add this to a counter so that I get a total increasing sum.

The next table shows the summation values for the last few days and the increase for each day.

Sum Increase
1758 +71
1829 +74
1903 +81
1984 +84
2068 N/A

The next graph is supposed to show the incoming line from 1903kWh, shows the data points at 1984kWh and 2068kWh and ends flat as the next increase is pending. The previous increase was 81 and the one fully in the graph is 84, so the incoming line should be flatter than the one shown.

I then increased the number of hours shown to check that this was just an issue for the incoming line. However, it appears that despite the unequal daily consumptions, the line shown is flat. To demonstrate that there are indeed different datapoints equal to the table provided above, here are different screenshots with the popups at the datapoints:

image

image

image

image

image

Describe the behavior you expected

Steps to reproduce the issue

I am not sure how to reproduce this, I suppose with similar datapoints.

What version of Home Assistant Core has the issue?

2010

What was the last working version of Home Assistant Core?

core-2021.10.6

In which browser are you experiencing the issue with?

Version 95.0.4638.69 (Build officiel) (64 bits) & Firefox 93.0 (64 bits)

Which operating system are you using to run this browser?

Windows 10 20H2 Build 19042.1288

State of relevant entities

image

Problem-relevant frontend configuration

The datapoints are provided in the report.
For completeness, this is the yaml for the history graph (the duration for the first graph was 48):

  - title: Conso
    path: conso
    type: panel
    badges: []
    cards:
      - type: history-graph
        entities:
          - entity: sensor.current_summation_derived
          - entity: sensor.current_summation
          - entity: sensor.current_demand_log
          - entity: counter.gas_consumption
          - entity: sensor.gas_consumption_kwh
          - entity: sensor.gas_consumption_m3
          - entity: sensor.compteur_gazpar
        refresh_interval: 4
        hours_to_show: 120

Definition of the counter shown (with the issue):

counter:
  gas_consumption:
    initial: 0
    restore: true

Automation increasing it:

- id: '1633280482973'
  alias: Accumuler consommation Gazpar
  description: Ajoute la consommation du jour pr..c..dent au compteur global
  trigger:
  - platform: time
    at: '23:30:00'
  condition: []
  action:
  - service: counter.configure
    target:
      entity_id: counter.gas_consumption
    data:
      value: '{{ states(''counter.gas_consumption'') | float + states(''sensor.compteur_gazpar'')
        | float }}'
  mode: single

Javascript errors shown in your browser console/inspector

image

Additional information

image

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mdeweerd commented 2 years ago

Not resolved in 2021.12.10 IMHO.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mdeweerd commented 2 years ago

@github-actions - This is still not ok in Home Assistant 2022.4.7 . Please do not consider this closed until a human from the developer team responds to this.

This is the last time that I will respond to a bot.

ildar170975 commented 2 years ago

This is the last time that I will respond to a bot.

I guess there are only few people are subscribed to this issue, probably none of them is dev. Next time this issue will be closed automatically if you do not "un-stale" it.

mdeweerd commented 2 years ago

@ildar170975 Thanks for your reaction - I know this is because of https://github.com/home-assistant/frontend/blob/dev/.github/workflows/stale.yml - I unstaled it twice, but not three times!

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

karwosts commented 1 year ago

Is this still relevant? I don't recall seeing any history graphs with slopes between points, I thought it was always step function. Is that an old feature or how is that graph being generated?

mdeweerd commented 1 year ago

I just checked this and the graphs seem aligned now - great! so I am closing this issue;

With regards to the slopes: I think that:

  1. if you have enough data-points, it looks like a slope;
  2. A statistics-graph seems to have smooth curves.