Lovelace: mini graph card

omg… so simple and simply overlooked… the shame

Thank you!

1 Like

i am having an issue when trying to add the secondary y-axis.

currently i am just pulling in my energy meter for hte past 24 hours and trying to overlay a "nightmode’ binary sensor to compare day/night visually.

the example shows an input number. must it be so or can in be on/off?

I would need your help. I start with HA. I’m trying to understand how custom cards work.
I wanted to install mini-graph-card.
Can you tell me or I’m wrong. I would like to keep the card configurator.

  1. I sent the file mini-graph-card-bundle.js in / config.

  2. I added at the top of the configuration editor the line:

Attractions:
   - type: module
     url: /local/mini-graph-card-bundle.js?v=0.5.0


3. I created a card and I put the code:

- type: custom: mini-graph-card
   entities:
     - ssensor.processor_use
   show:
     labels: true
   color_thresholds:
     - value: 20
       color: "# f39c12"
     - value: 21
       color: "# d35400"
     - value: 21.5
       color: "# c0392b"


it does not work.

The .js needs to be in /config/www

thank you for the answer.
it’s the same thing

The red error box is telling you the problem.

It says that your indentation is off. And it’s telling you exactly where the indentation is off - in line 2.

Look at line 2. You should see how bad the indentation starting there is compared to everything else.

sorry but what is indentation?

1 Like

One thing I noticed, ssensor should be sensor :wink:

So basically it should be (once indentation is fixed):

- type: custom: mini-graph-card
  entities:
    - sensor.processor_use
  show:
    labels: true
  color_thresholds:
    - value: 20
      color: "# f39c12"
    - value: 21
      color: "# d35400"
    - value: 21.5
      color: "# c0392b"

Yes, that’s by design.

No.

Yep, seems broken indeed, not sure when this broke, will look into it.

As long as it reports its state as a value 0-1 for example, I believe it should work.
If it doesn’t you would have to create a template sensor or similar of that entity, that treat on as 1 and off as 0 e.g.

1 Like

thanks. i suspect that is the issue. i’ll create a template sensors to convert the on/off to 1/0. makes sense to me now as i see we need to convert the string to a numerical representation to graph

1 Like

Just following up. That was that case. Now that I have my template sensor 1 for night and 0 for day, it displays just fine

1 Like

Is their a way to display a different sensor data in the header for example have pi hole percentage senor listed instead of the number of ads blocked

pi-hole

Sure,
You could do something like this.
You can also display multiple sensor states in the header with the show_state option.

- type: custom:mini-graph-card
  entities:
    - entity: sensor.percentage
      show_graph: false
      show_legend: false
    - entity: sensor.ads_blocked
      name: Ads blocked
      color: blue
    - entity: sensor.queries
      name: Queries
      color: red
1 Like

Hey there, I was trying this graph and I found a bug! :smiley:
For some odd reason, the “show_legend: false” hide the “next” entity from the legend instead of the one that is “assigned to”

I was able to have the same behaviour on a different graph, so I guess it’s definetely abug :smiley:

I actually just noticed that as well :laughing:, it’s fixed in the development branch, could probably do a new release tomorrow!

1 Like

@kalkih I’ve been trying to style my Mini Graph Cards and I would love for them to be a perfect square (not the actual graph, but the entire card).

The custom Button Card component solves this with an aspect_ratio option. Any chance you would want, and be able to, to add exactly that configuration option?

I can understand you do not want to add too many configuration options, so if not, I’ll try to get this working with some custom CSS.

For a card with 2 line graphs for 2 different kind of sensors (Temperature and pH level) on different numeric ranges, can I establish different color_thresholds for each graph line? Can’t find a way to do it…

Also, can the legend color entries (the little color square) have also an adaptive color?

Just updated but the problem it’s still there unfortunately :slight_smile: