Mini-graph-card cant read history data

Hi I’m new to HA and i appreciate the help.
mini-graph-card seems it cant read history data its value is stuck so its flat line actual values are at the end where it works. History works well as does graph card.

type: custom:mini-graph-card
entities:
  - sensor.thermometer_tent
name: Temperature
line_color: blue
line_width: 8
font_size: 75
hours_to_show: 48
points_per_hour: 20

image

And points before i added the graph move in time just all values are 23.9

Where does statistical graph produce this

chart_type: line
period: hour
type: statistics-graph
entities:
  - sensor.thermometer_tent
stat_types:
  - mean
  - min
  - max
title: tent

image

The same sensor. And when i go to history i also see the information.
So i guess its not reading the history properly.
Here is the picture of history of same sensor.

The mini-graph card can only show data from the moment it was created. If you want something that can look up LTS, try try the apexcharts card.

What do you mean?
From the moment when the card was created? ??? This is not correct.
From the moment when the sensor was created?

Sorry yes “it” being the sensor.

A difference between mini-graph and history-graph:
when a sensor is unavailable or unknown (not created yet) - then m-g-c shows a flat (not correct), h-g shows a gap (correct).
But I am not sure if this is related to the case in the 1st post….
I would suggest to post a screenshot of history-graph with same hours-to-show.

yes here is the history graph there are values.


thank you
sensor was made week ago

You are showing a History view which contains LTS before ~04:00 , August 2.
Means - you have NO history before that moment.
And that is why mini-graph shows a flatline (just a guess since you have not mentioned at what time that mini-graph stops showing flatline).

If I can explain more for clarity:

Normally, data gets recorded in the states table in the DB, according to your recorder settings. The granularity will be as often as the sensor value changes.

Some sensors have extra attributes that allow them to be stored in the long-term stats table. Here, data is rolled up to a minimum of an hour granularity (and hence become a statistic for that interval). Data here is currently kept forever.

1 Like

Thank you so much for explaining it so clearly. You did help and its appreciated and one more question? Can u set up recorded and just point me to the right direction. Thank you once more <3

I’m not following you completely, but if you’re asking what data can be used, then the answer is that it depends on the card whether it will retrieve long-term stats (LTS). As Ildar mentioned, the mini graph card doesn’t read it, but Apex Charts can.

Actually, History view shows “augmented” history - history and LTS. Not sure if any custom card can do it.
I guess that the main issue here is - “why my history is flatline”. Answer - because you have no recorded history. And may be OP should reconsider his settings for Recorder instead of searching for a card which allows to see a non-precise statistical data.

Yes, I think we’re saying the same thing.

Apex Charts definitely can. There’s an option for it.

Indeed. You cannot plot data that you don’t have. If you try and plot a week’s data, but you’re only recording the last 3 days, then it won’t work.

When you plot long periods, one will likely already be aggregating. There’s no issue plotting LTS unless you want to visualise sub-hour data.

1 Like

Is there any progress on this? I managed to show long term data using apex charts but I do not like the look of it.

type: custom:apexcharts-card
graph_span: 30d
span:
  end: day
header:
  show: true
  title: ApexCharts-Card
  show_states: true
  colorize_states: true
series:
  - entity: sensor.withings_weight
    statistics:
      type: max
      period: day
    group_by:
      func: sum
      duration: 1day

I would prefer mini-graph but this only supports the last 10 days. If I extend the hours_to_show the graph is flat. -.-

type: custom:mini-graph-card
entities:
  - sensor.withings_weight
  - entity: sensor.total_weight_loss
    show_state: true
    show_graph: false
name: Weight
hours_to_show: 264
points_per_hour: 0.04
show:
  labels: true
color_thresholds:
  - value: 105
    color: "#D50000"
  - value: 100
    color: "#FFD000"
  - value: 95
    color: "#00CB11"