Lovelace: mini graph card

Same as for day/night background graph.

Sorry wrong thread…

The post should be placed in another thread

Can someone please explain how the ‘fixed_value’ setting works? From the description, it sounds like it should just use an entity’s current state rather than looking at its history. I can’t seem to get it to work that way.

My situation is this: I’m using the Dark Sky weather integration (sensor version) which give me lots of individual sensors for rain probability by hour e.g. sensor.precip_probability_1h, sensor.precip_probability_2h, sensor.precip_probability_3h, etc…

I’m trying to graph these as a bar graph, and also exclude these sensors from the recorder (I really don’t need to save any history for these). But it only seems to work if I do enable recording of the sensors. I thought using ‘fixed_value: true’ would allow me to exclude recording of these sensors.

According to the source code:

    if (this.config.entities[index].fixed_value === true) {
      const last = stateHistory[stateHistory.length - 1];
      this.Graph[index].history = [last, last];
    } else {
      this.Graph[index].history = stateHistory;
    }

for this sensor only the LAST value is used to build a graph, the values are taken from DB.

Thanks. So in this case I would still need to record the history for these sensors since the card does look in stateHistory?

Seems to be so.
AFAIK the card always work with a DB.

I cannot seem to figure out how to get the vales beside the names like this

image

My code

type: custom:mini-graph-card
name: BBQ Meat Temps
icon: mdi:grill
hours_to_show: 10
entities:
  - entity: sensor.meat_probe_1
    name: Probe 1
    show_state: true
    color: red
    state_adaptive_color: true
  - entity: sensor.meat_probe_2
    name: Probe 2
    show_state: true
    color: green
    state_adaptive_color: true
show:
  name: true
  points: false
  icon: true
  state: true
  labels: false
card_mod: null
style: |
  .graph__legend__item:nth-of-type(1) .ellipsis:after {
    content: ": {{states('sensor.meat_probe_1')}} ppm";
  }
  .graph__legend__item:nth-of-type(2) .ellipsis:after {
    content: ": {{states('sensor.meat_probe_2')}} ppm";
  }

results in this ?
Thanks,
Grey

image

This is a card-mod style.
Do you have the card-mod installed?
The styles are not supposed to be used by “simple copy/paste” method - using them needs understanding them. Otherwise in some cases you will not get an expected result (((.

Some card-mod examples in this thread are provided w/o using the “card_mod” keyword.
Starting from card-mod 3.0 the “card_mod” keyword is advised to be used before the “style” keyword:

card_mod:
  style:
    .....

In fact, many styles continue to work w/o using the “card_mod” keyword, but in some cards/places it will not work any more unless you use a proper “3.0” syntax.

LOL I never will understand Lambda or .graph__legend__item:nth-of-type(2) .ellipsis:after {
content: “: {{states(‘sensor.meat_probe_2’)}} °F”;
}

But I found your Mod Thanks,
Grey

But there is still no way to get y-axis values on the left like between 60 and 220 is there?

image

Find a corresponding issue on Github and start monitoring it.
Or contribute a code for it)

Thanks ! The only code I know is +1 or “me too”
I do thank you for your work. I have learned or been exposed to many options.

This is great. Is there a way to assign a different color to bars based on the day? For example, I’d like Saturdays and Sundays to be a different color than weekdays bars in my daily electricity bar graph.

Not possible currently.
Create an issue on a GitHub or contribute a code.

Thanks, have created a feature request.

Hi all, mini-graph-card broke for me yesterday after updating to 2022.6.1 (from 2022.5.5). Data shown on the card has no relation to real entity historic data. I would assume it’s related to DB changes in 2022.6 but that is just a shot in the dark.

Anyone else experiencing the issue?

1 Like

Yes, it happened to me too. How do you set up a recorder? See the recorder’s documentation. I had to change the settings and now it seems to be fine, I just have to wait until the old data 3 days I have set in the chart is deleted.

I’m running MariaDB add-on with no custom settings. What settings exactly are you talking about? I don’t see anything in Recorder documentation that would be applicable to the issue at hand. The normal history data looks completely fine only mini-graph-card is not displaying correct values.

I had previously set:

recorder:
  purge_keep_days: 5
  commit_interval: 15
  exclude:
    event_types:
      - call_service
    domains:
      - sensor

  include:
    entities:
      - sensor.xxxxx

New setting where only sensors data is recorded, nothing else.

recorder:
  purge_keep_days: 5
  commit_interval: 15
  include:
    domains:
      - sensor
  exclude:
    event_types:
      - call_service

Thanks for the specifics but I don’t think it’s the same issue. I run my Recorder with default settings and it records all data. Also my history is correct when I check the standard HA graphs, it’s only the mini-graph-card that has the issue.

EDIT: Ok just to update: When I was making my original post I rebooted HA. (without changing anything) It looks like the graph since the reboot is fine. I have no idea what was the issue but it looks to be resolved now.