Lovelace: mini graph card

Hi there,

I have some graphs showing my PC’s usage with data drawn from HASS.Agent. When the PC is off, it shows NaN as the entities are unavailable. How can I go about making it display “OFF” when the PC isn’t running?

My initial thought is to make a template sensor for each one that returns OFF when NaN and the entity_id when the state is available, but if there’s a better way to go about it I’d like to get some insight. Many thanks.

image

Make it a template boolean sensor. Everything where state returns >= 0 is “On”, and all other “Off”.

would that then populate the entities field? That would just return a 1 or 0 instead of the entity as a string, wouldn’t it?
What about this:

  - platform: template
    sensors:
      cpu_available:
        state: >
        {% if not is_state('sensor.pc_cpuload', 'unavailable') %}
          'sensor.pc_cpuload'
        {% else %}
          "OFF"
        {% endif %}

and this populates the entities field

Hello,

I was wonding if it is possible to use conditional styling on the following:

type: custom:mini-graph-card
entities:
  - entity: sensor.dhw_tank_temperature
color_thresholds:
  - value: 35
    color: "#3320a1"
  - value: 38
    color: "#4295f5"
  - value: 42
    color: "#edda09"
  - value: 45
    color: "#c0392b"
hours_to_show: 168
name: Melegvíz hőmérséklet
hour24: true
tap_action: none
card_mod:
  style: |
    .name.flex {
      color: #c0392b;
    }

With something like this:

type: custom:mini-graph-card
entities:
  - entity: sensor.dhw_tank_temperature
color_thresholds:
  - value: 35
    color: "#3320a1"
  - value: 38
    color: "#4295f5"
  - value: 42
    color: "#edda09"
  - value: 45
    color: "#c0392b"
hours_to_show: 168
name: Melegvíz hőmérséklet
hour24: true
tap_action: none
card_mod:
  style: |
    .name.flex {
      color: #c0392b;
          {% if states(config.entity) | float >= 1 %} 
             red 
          {% elif states(config.entity) | float >= 50 %}
             greenyellow
          {% endif %}
       ;
    }

Unfortunately it does not work.

try “config.entities[0].entity”

I’ve been using this widget to track rainfall in my garden, but coming up against a funny problem. When I set it to ‘bar’ each bar shows the actual total reading for the day when I hover over the bar. But if I use ‘line’ (much prettier), it seems to show the average between days when I hover over the points.

Any ideas on how to set the hover points to show the daily reading instead when using the line?

my config is:

type: custom:mini-graph-card
icon: mdi:weather-rainy
name: Daily Rainfall
aggregate_func: max
hours_to_show: 168
group_by: date
show:
  graph: line
  fill: true
  icon: false
color_thresholds:
  - value: 20
    color: '#030ffc'
  - value: 15
    color: '#353ffc'
  - value: 10
    color: '#656dfc'
  - value: 5
    color: '#979dfc'
  - value: 2
    color: '#afb3fa'
  - value: 0
    color: '#ffffff'
entities:
  - entity: sensor.rainfall_24h
    state_adaptive_color: false

Hello, I’m looking for help how to show my HDD state and all attributes on mini-graph-card.

entity: sensor.unraid_disk_2_usage
state_content:
  - total_size
  - used_space
  - free_space
  - mount_point
vertical: true
name: WD Red
grid_options:
  columns: 12
  rows: 2

I try:

type: custom:mini-graph-card
entities:
  - entity: sensor.unraid_disk_1_usage
    show_state: true
    attribute: total_size
    attribute: mount_point
    attribute: free_space
    attribute: used_space

Regards.

Schema:

type: custom:mini-graph-card
entities:
  - entity: sensor.xxx
    attribute: attr_xxx
    ...
  - entity: sensor.yyy
    attribute: attr_yyy
    ...

Hi, thanks for help but that also don’t work:

Because you are not following Docs & particular example - you got two “attribute” options instead of one.

Can You point me where in docs I can find something about attributes? Some examples?
Regards.

The card has an option “entities” - which is a list of entries.
Each entry is “entity object”.
An example was provided here.
In your case it should be like

type: custom:mini-graph-card
entities:
  - entity: sensor.unraid_disk_1_usage
    attribute: total_size
    ...
  - entity: sensor.unraid_disk_1_usage
    attribute: free_space
    ...
  ...similarly for other numerical attributes

Thanks, that’s better but it shows in percents strange values. It’s possible to see it TB?

image

save your card & re-check

OK, I missed "unit: TB" option.:smiley:

Can You tell me last thing? It’s possible to shows values wright above that bars?

There is no such an option in this card.

There’s no other way to show that TB values? Different place, different order?
Regards.

You may try using card-mod (you will have to learn how to use it); also you may try other people’s forks of this card (cannot suggest you a particular fork).

1 Like

BTW, you got currently ONE reading for THREE sensors - so you got THREE bars.
After some period you may see more bars (6,9,12,…) - depends on your sensors, points_per_hour & hours_to_show.
In this case you may want to see a value for every bar (i.e. “last value” & “some old value”) - which is not supported by this card & cannot be achieved by card-mod.

1 Like

Thank You very much for help. I will handle that now. :slight_smile:
Regards.