Lovelace: mini graph card

Or you could use a 0/100 sensor read the posts below this link. You basically turn your cooling into a binary sensor 0 when it is off, 100 when it is on. This method effectively gives you a second y axis.

@Ildar_Gabdullin 0/1 senor 0 when it is off, 1 when it is on.

There is a fair few posts about this around the point in the post below.

Hi, I’m playing around with labels and gridlines for the x-axis. Does anybody know if there is a reason that one data point is always missing from the time frame (hours_to_show * points_per_hour), at least for the line graph?

Code:
hours_to_show: 24
group_by: hour

Data points in graph:

Start data point: 13:00 - 13:59 (previous day)
End data point: 11:00 - 11:59

Shouldn’t the time start at 12:00 - 12:59 instead of 13:00 - 13:59, spanning an overall time of 24 hours?

Hi,

Can I only display a first entity as a graph with no values or extremes and the second entity not as a graph but show the extrema and average values?

I try this, but did not work:

          - type: custom:mini-graph-card
            name: Verbrauch pro Tag
            font_size: 80
            entities:
              - entity: sensor.um_daily_energy_vorratsraum_kuehlschrank
                show_fill: false
                show_line: true
                show_points: false
              - entity: sensor.vorratsraum_kuhlschrank_plug_s_leistung
                show_state: false
                show_graph: false
                show_points: false
                show:
                  extrema: true
                  average: true
            decimals: 0
            hours_to_show: 168
            points_per_hour: 0.2
            aggregate_func: last
            group_by: date
            show:
              name: false
              icon: false
              state: false
              extrema: true
              average: true
              fill: fade
              graph: bar
              legend: false
              labels: false
              labels_secondary: false

Any idea or hint?

Thanks.

It didn’t work for me just got error messaged, as a newbie I guess I should stick to tried and tested before going for new stuff anyway the error messages , the first one saying that visual editor is not supported and the second one asking for a list of entities

Swap the two series under entities around and remove the invalid extrema options for that series. I’m fairly sure the extrema is only for the first series in the list. show: is documented only for the main card options.

Thanks, if I set show_graph to false there are no extrema too.

So I have a workaround with spaces between the bars but better then nothing.

          - type: custom:mini-graph-card
            name: Verbrauch pro Tag
            font_size: 80
            entities:
              - entity: sensor.vorratsraum_kuhlschrank_plug_s_leistung
                show_graph: true
                y_axis: secondary
                color: transparent
              - entity: sensor.um_daily_energy_vorratsraum_kuehlschrank
                show_fill: false
                show_line: true
            animate: true
            cache: true
            height: 125
            line_width: 4
            decimals: 0
            hour24: true
            hours_to_show: 168
            points_per_hour: 0.2
            aggregate_func: max
            group_by: date
            show:
              name: false
              icon: false
              state: false
              extrema: true
              average: true
              fill: fade
              graph: bar
              legend: false
              labels: false
              labels_secondary: false

Any idea to optimize?

You might be able to shrink that with card-mod, but it’s not something I’ve ever looked into.

Nothing I can think of, except to switch to ApexCharts.

1 Like

As suggested you can try it with card-mod:

card_mod:
  style: |
    .bars {
      transform: translateX(-7%);
    }
    .bar {
      width: 13.37%;
    }

Looks like this for your code:

1 Like

Great working perfect.

How could I enable the x-axis labels?

I will try to create a PR.

The labels, ticks or grid lines are drawn dynamically by setting the maximal number of labels/lines for the timeframe and are aligned to the time scale.

Any idea how to solve situation where the graph does not load when the main entity is temporarily not available? This happens periodically when some of my BLE RuuviTags drop outside receiver range or battery runs empty (like in this example).

The other entities in this graph could, and should, still be shown but instead it just has the loading indicator:

Are you sure the entity becomes “unavailable”? Seems that it becomes “not existing” which I consider as an emergency case. Anyway, browse for last 5-10 recently closed issues in m-g-c repo, they are about the same; if you do not want to be alerted by m-g-c about this emergency case, disable the “loading_indicator” (check Docs).

Installed the latest version of HA core 2025-11-3 now all my Mini-Graph-Cards are broken, they display only a wait circle. Nothing changed in my setup or yaml, no card mod things just plain Mini Graphs.

The Entity is available see the Temperature in the example yet, the graph is not drawn, and this throughout my whole dash, breaking it completely?

type: custom:mini-graph-card
name: Temp
entities:
  - entity: sensor.t_voordeur
  - color: "#bfbfbf"
    entity: sensor.nightstate
    name: Night
    show_legend: false
    show_line: false
    show_points: false
    heigth: 250
    hours_to_show: 48
    y_axis: secondary
align_icon: left
align_state: center
font_size_header: 12
smoothing: false
show:
  legend: false
  fill: fade
  labels: "true"
  extrema: "false"
  state: true
  name_adaptive_color: "true"
  icon_adaptive_color: "true"
  state_adaptive_color: "true"
  points: false
  height: 250
  graph: line
  font_size: 20
  hour24: true
color_thresholds:
  - value: 10
    color: "#00ff00"
  - value: 16
    color: "#ff8800"
  - value: 25
    color: "#ff0000"
hours_to_show: 48

Mini-Graph_card version latest version.

Some of your entities do not exist, not unavailable.
If you do not care about missing entities - use “loading_indicator: false”. Care to read at least a post before yours.

Also, half of your code contains misplaced options.

Thank for your reply, all entities do exist and even though some misplaced comments or lines, “not great in programming”, it all worked fine till I updated the core of HA last night.

Maybe you can point out what has been misplaced?

Spinner is shown if some entity does not exist. Also, purge your browser cache just in case.
Cannot easily point out which line are misplaced, answering from a phone. Suggest to check with Docs.

My problem has been solved, I did a re-install of the previous HA core, and then went back to the newest core, and miraculously the graph card was responding again, can not explain, thank for your answers.

I have a card with three lines and need to increase the space below the lowest of the three. I’ve tried to add padding with card_mod but to no avail. Is it possible?

Post a SHORT simplified code of your card, a screenshot and point exactly at the thing you need to change.

Sounds like you just need to set a minimum value of the y-axis, but it’s not very clear what you’re asking.