dbuezas / lovelace-plotly-graph-card

Highly customisable Lovelace card to plot interactive graphs. Brings scrolling, zooming, and much more!
410 stars 19 forks source link

Data missing from graphs #267

Open jazzmonger opened 1 year ago

jazzmonger commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Data is often missing from graphs. Reproducible on iPad, iPhone, macOS, Ubuntu and Debian. Safari, chrome, Brave browsers. Hone assistant app on iOS and macOS.

This happens intermittently on all platforms. Sometimes it's one data point, sometimes it's multiple data points in a row. The data comes back most of the time if you refresh the page.

Screenshots If applicable, add screenshots to help explain your problem. 960F29BD-375B-41EB-954D-DDEEC7444C61 F1AF8DF3-9DD0-4FEA-8AE3-2F837244ED05

yaml

type: custom:plotly-graph
defaults:
  entity:
    show_value: true
hours_to_show: 0.5
entities:
  - entity: sensor.house_stoking_sensor
    filters:
      - filter: y !== null && +y > 100
    yaxis: y1
    show_value: false
    line:
      color: red
      dash: dashdot
  - entity: sensor.house_auger_display_sensor
    filters:
      - filter: y !== null && +y > 90
    yaxis: y1
    show_value: false
    line:
      color: white
  - entity: sensor.house_heating_idling_sensor
    filters:
      - filter: y !== null && +y > 40
    yaxis: y1
    show_value: false
    line:
      color: white
  - entity: sensor.house_uart_pipe_temp
    name: UART pipe temp Avg
    internal: true
    filters:
      - median:
          window_size: 100
          extended: true
          centered: true
    yaxis: y1
    show_value: true
    line:
      color: green
      shape: spline
      width: 2
      smoothing: 1
  - entity: sensor.house_uart_pipe_temp
    unit_of_measurement: Pipe Temp
    yaxis: y1
    show_value: true
    line:
      color: yellow
      shape: spline
      width: 2
      smoothing: 1
autorange_after_scroll: true
refresh_interval: auto
default_trace:
  line:
    width: 1
layout:
  height: 600
  yaxis:
    zeroline: false
    fixedrange: true
    range:
      - 100
      - 350
  yaxis2:
    gridcolor: whitesmoke
    fixedrange: false
    zeroline: false
    range:
      - 100
      - 350
  yaxis3:
    gridcolor: whitesmoke
    zeroline: true
    fixedrange: true
  grid:
    ygap: 1
    rows: 1
    columns: 1
    pattern: coupled
    roworder: top to bottom
  xaxis:
    rangeselector:
      bgcolor: '#474747'
      'y': 1.11
      buttons:
        - count: 30
          step: minute
        - count: 1
          step: hour
        - count: 2
          step: hour
        - count: 3
          step: hour
        - count: 12
          step: hour
        - count: 1
          step: day
        - count: 2
          step: day
        - count: 7
          step: day

Additional context Add any other context about the problem here.

jazzmonger commented 1 year ago

2D6E0376-9222-4EF2-9819-04219F18042B

and after a refresh of the browser the missing data is back. I've tried it with and without the filters. No difference.

3BDC8041-DEFC-4C85-97DE-B704ACAE9E51

dbuezas commented 1 year ago

Interesting. Does this also happen with refresh_interval: 10s (auto gets push updates from home assistant, setting a time interval pulls them)

jazzmonger commented 1 year ago

Like MANY other folks I had trouble with refresh_interval in that it doesn't "refresh" so based on your recommendation I use auto which gives me near real-time updates, which I need.

If it gets cold again and I need to use the pellet stove, I can certainly test the other refresh option again.

why would a browser refresh make them show up? The data is clearly there, and I can see it in the log entries.

Jeff

dbuezas commented 1 year ago

Yes, a browser refresh will fetch everything as one interval so everything should be visible.

I'll take a look soon

dbuezas commented 1 year ago

One thing I want to try is to assume there may always be data between now and the last know datapoint (instead of between now and the last time I fetched data.

And also to assume there may be missing data between any two datapoints that arrived via the web socket (auto mode)

jazzmonger commented 1 year ago

I just tested the refresh option you suggested. Same problem exists. 8847213C-89B3-4666-B032-CB9B4B04419F

after a browser refresh 01957C4B-D2F1-4184-BF93-21FE40CE49CB

dbuezas commented 1 year ago

Ok, thanks. I'll think about how to deal with this without bombarding the home assistant backend with requests