Lovelace: mini graph card

Thank you!

After looking at my other tabs, I realized the issue only appears when I use the ‘vertical-stack-in-card’. Here’s a screenshot showing no issues when separated normally.

1 Like

I love the design of this and have been able to duplicate most of it, however struggling with the y_axis. I’m guessing your using ‘state_map’? I’ve tried this without luck. Any chance you can share you Lovelace code?

I am interested aswell :slight_smile:

I created a template sensor to pull the ‘hvac_action’ attribute from the thermostat. If heating, value 1 is output. If idle or otherwise, value 0 is output. With this new sensor, the graph can easily display the on/off status. I believe it’s possible using the state_map feature but this was something that provided me with more flexibility due to my different heating systems (hvac_action output - ‘Heat’, ‘heating’, ‘idle’, ‘off’, etc…)

        family_heating:
            friendly_name: "Family Heating"
            value_template: >-
                {% if states.climate.family_room.attributes.hvac_action == 'idle' %}
                  0
                {% elif states.climate.family_room.attributes.hvac_action == 'heating' %}
                  1
                {% elif states.climate.family_room.attributes.hvac_action == 'off' %}
                  0
                {% endif %}

Here is my code from the ‘mini-graph-card’ under the thermostat. I used the state_map feature to label the On/Off status:

      - cards:
          - align_state: center
            entities:
              - entity: sensor.dining_room_temperature
                name: Dining
              - entity: sensor.office_temperature
                name: Office
              - entity: sensor.living_room_temperature
                name: Living
              - entity: sensor.dining_heating
                color: white
                name: Boiler
                show_legend: true
                show_line: false
                show_points: false
                y_axis: secondary
              - entity: sensor.mitsubishi_heating
                color: gray
                name: HP
                show_legend: true
                show_line: false
                show_points: false
                y_axis: secondary
            group: true
            hours_to_show: 4
            line_width: 3
            points_per_hour: 9
            show:
              extrema: false
              fill: fade
              icon: false
              labels: hover
              labels_secondary: hover
              name: false
              state: false
            state_map:
              - label: 'Off'
                value: '0'
              - label: 'On'
                value: '1'
            type: 'custom:mini-graph-card'
        type: horizontal-stack
4 Likes

Hi, where does the height property go and what is the syntax I can use? Thanks!

This is an example of one of my configs:

          - type: custom:mini-graph-card
            name: Speed Test
            more_info: false
            group: false
            height: 0
            line_width: 4
            hour24: true
            hours_to_show: 168
            points_per_hour: 0.25
            aggregate_func: max
            group_by: date
            animate: false
            decimals: 0
            align_state: left
            show:
              name: true
              icon: true
              state: true
              graph: line
              fill: false
              points: false
              legend: false
              extrema: false
              labels: false

As you can see I have the option “height: 0” there, that’s the option you can use, the defcault value is 150, so if you want a “higher” card, just change it to something higher than 150 until you find the right dimension for you.

2 Likes

Just keep in mind that “height” option is for the line graph, not the whole card.
For the whole card maybe you need to use card-mod, not sure, surely @kalkih knows better :slight_smile:

Does anyone know how to transpose ‘on’ and ‘off’ values as 1 and 0 values on a graph without having to create a template sensor?
Thanks

I got it working somehow…
Perhaps a cycle of the supplying sensor did it?

nice indeed!
what sensor do you use for the air quality? Been looking for a VOC sensor myself, and have only found the https://www.robbshop.nl/mh9-co2-monitor and couple that to my Zwave hub. It does not show VOC in Mqtt though but only the CO2 ppm. Would be interested how you integrated this into HA.

1 Like

I use the Foobot which has an integration. Found one on eBay for lower than retail. Important to note the CO2 “sensor” they advertise is useless since it’s derived from the air quality and VOC sensor.

Hi!
I want to be able to change the fill color and opacity but I am stuck!
I am using card-mod but cant’ make it work.

      - type: custom:mini-graph-card
        entities: 
          - sensor.humedad_living_2
        style: |
          .line--fill {
            fill: red;
            stroke: red;
            animation: 0 !important;
            opacity: 1 !important;
          }

Can someone tell me what am I doing wrong?

Thanks!

Hi, I’m trying to get the ‘horizontal stack’ card setup, but I get the following error, when entering the code in lovelace:

Error:

Cannot read property 'setConfig' of undefined

Code:

- type: horizontal-stack
  cards:
    - type: 'custom:mini-graph-card'
      entities:
        - sensor.kitchen_sensor_temperature
      line_color: blue
      line_width: 8
      font_size: 75
    - type: 'custom:mini-graph-card'
      entities:
        - sensor.kitchen_sensor_temperature
      line_color: '#e74c3c'
      line_width: 8
      font_size: 75
    - type: 'custom:mini-graph-card'
      entities:
        - sensor.kitchen_sensor_temperature
      line_color: var(--accent-color)
      line_width: 8
      font_size: 75

Help would be appreciated, thanks!

Try change:
- sensor.kitchen_sensor_temperature
to:
- entity: sensor.kitchen_sensor_temperature

Doesn’t make a difference, I’m afraid.

If you mean the UI Editor, remove the dash and the 2 spaces intend.

type: horizontal-stack
cards:
  - type: 'custom:mini-graph-card'
    entities:
      - sensor.kitchen_sensor_temperature
    line_color: blue
    line_width: 8
    font_size: 75
  - type: 'custom:mini-graph-card'
    entities:
      - sensor.kitchen_sensor_temperature
    line_color: '#e74c3c'
    line_width: 8
    font_size: 75
  - type: 'custom:mini-graph-card'
    entities:
      - sensor.kitchen_sensor_temperature
    line_color: var(--accent-color)
    line_width: 8
    font_size: 75
2 Likes

This should do it:

style: |
  .fill--rect {
    fill: red;
    opacity: 1;
  }
1 Like

Brilliant, working now thanks!

Hi at all, i’m using Mini Graph Card and all is working very well!!! Please, someone could point me to the right direction on how to include this graph in Tilboard theme?? [TileBoard - New dashboard for Homeassistant] I wanna open MiniGraph Card insted of standard history graph that comes to tileboard.

thanks a lot.

Do you have ESPHome setup on your installation?
If so this is a good one:


You can connect it to a NodeMCU or something and have it report through ESPHome to your dashboard.
It has two sensors in, one is temperature and humidity, the other CO2 and VOC (volatile organic compounds) things like smoke, solvents etc