Lovelace: mini graph card

Looks like the graph gets inverted, seems strange, only the graph is inverted and nothing else.
Try without the “fancy” effect on the swipe card.

Hi!
I want another line horizontally. I’m not a programmer and I don’t understand how.

cards:
  - entities:
      - entity: sensor.router_power
        index: 0
    font_size: 75
    line_color: blue
    line_width: 8
    type: 'custom:mini-graph-card'
  - entities:
      - entity: sensor.j_power_0
        index: 0
    font_size: 75
    line_color: '#e74c3c'
    line_width: 8
    type: 'custom:mini-graph-card'
  - entities:
      - entity: sensor.j_power
        index: 0
    font_size: 75
    line_color: var(--accent-color)
    line_width: 8
    type: 'custom:mini-graph-card'
type: horizontal-stack

Narrowed it down to the IOS App, the inverting of the graphs only happens there. and only when i touch the screen (points: hover) It still happens when I take out the effects on the swipe card.

I remember reading someone else’s post about the graphs inverting, but I cant for the life of me find the post and/or the solution.

Okay, does it still happen if you don’t nest the it inside the swipe-card as well?
I’ve never seen the issue before.

Found the problem and am kindof embarrased I missed it, as it was infact the effects on the cards like you said. Thought I removed all the code for the effect from the card, but accidently left one line. Works fine without the effects. Thanks for taking your time to help :+1:

Would still be cool to be able to use the effects, even though they’re a bit of a gimmick. But I suppose the issue lies in the swipe card and not the graph cards.

Simply add more entities as any of the three you already have

  - entities:
      - entity: sensor.great_power_great_responsabilities
        index: 0
    font_size: 75
    line_color: var(--accent-color)
    line_width: 8
    type: 'custom:mini-graph-card'

If instead you meant inside the same graph, inside the entities simply add it:

  - entities:
      - entity: sensor.j_power
        index: 0
      - entity: sensor.great_power_great_responsabilities
        index: 0
    font_size: 75
    line_color: var(--accent-color)
    line_width: 8
    type: 'custom:mini-graph-card'

TBH, I am not sure what “index: 0” does so I am not sure that might or not cause an issue with multiple entities.

Hi! thanks for the quick answer! I misspelled it (sorry). I would like to. so another line

vertical_2_line

Could you share your config for above?

1 Like

Hello everyone,

I really love mini-graph-card and I’m trying to use it in a lot of my pages.
I just have a question: is there a way to fill the card with more “graph”?

I tried upper_bound and lower_bound but most of the space of the card is pretty much empty.

Sure! This is a switch and three sensors in a horizontal stack:

cards:
          - aspect_ratio: 1/1
            color: 'rgba(25, 25, 25, 0.5)'
            color_type: card
            entity: switch.aquecedor
            hold_action:
              action: more-info
            name: Aquecedor
            state:
              - color: 'rgb(255, 255, 255)'
                icon: 'mdi:radiator'
                value: 'on'
            styles:
              card:
                - font-size: 12px
              name:
                - letter-spacing: 0.05em
            type: 'custom:button-card'
          - aspect_ratio: 1/1
            color: 'rgba(25, 25, 25, 0.5)'
            color_type: card
            entity: sensor.temperature_8
            show_icon: true
            show_name: false
            show_state: true
            size: 27px
            styles:
              icon:
                - letter-spacing: 0.05em
                - padding-top: 16%
              state:
                - font-size: 18px
                - font-weight: 300
                - padding-bottom: 18%
            tap_action:
              action: more-info
            type: 'custom:button-card'
          - aspect_ratio: 1/1
            color: 'rgba(25, 25, 25, 0.5)'
            color_type: card
            entity: sensor.humidity_9
            icon: 'mdi:water'
            show_icon: true
            show_name: false
            show_state: true
            size: 30px
            styles:
              icon:
                - letter-spacing: 0.05em
                - padding-top: 16%
              state:
                - font-size: 18px
                - font-weight: 300
                - padding-bottom: 18%
            tap_action:
              action: more-info
            type: 'custom:button-card'
          - aspect_ratio: 1/1
            color: 'rgba(25, 25, 25, 0.5)'
            color_type: card
            entity: sensor.temperatura
            show_icon: true
            show_name: false
            show_state: true
            size: 27px
            styles:
              icon:
                - letter-spacing: 0.05em
                - padding-top: 16%
              state:
                - font-size: 18px
                - font-weight: 300
                - padding-bottom: 18%
            tap_action:
              action: more-info
            type: 'custom:button-card'
type: horizontal-stack

Hope this helps you!

1 Like

In that case simply copy the whole thing you pasted below it, and it will create a second row with the same entities, then change the entities to what you need :slight_smile:

Did you perhaps use the font_size options in those graphs? The white space doesn’t scale with them atm which they probably should.
There’s a height option that you can use to increase the height of the graph but that will still not eliminate the white space.

I’ve tried different font_size now that you mentioned and even without it, but still the cards mostly still look the same. (I’ve tried font_size = 10, same graph but now I can’t even see the label)

this is an example card I’m using

That’s was what I was trying to say, the gaps between elements (white space) doesn’t scale with the font size.

Ok, I understand that but even if I disable everything and only leave the graph:line the card looks the same

Screenshot 2020-02-19 at 11.54.58

Looks like 0.106.0b0 breaks the mini graph card.

mini-graph-card TypeError: "0 is read-only"
    Mc mini-graph-card-bundle.js:1
    Mc mini-graph-card-bundle.js:1
    setConfig mini-graph-card-bundle.js:1
    s create-element-base.ts:39
    a create-element-base.ts:58
    c create-element-base.ts:102
    zt create-card-element.ts:52
    _createCardElement hui-stack-card.ts:77
    _cards hui-stack-card.ts:39
    setConfig hui-stack-card.ts:38
    s create-element-base.ts:39
    c create-element-base.ts:129
    zt create-card-element.ts:52
    _createCardElement hui-stack-card.ts:77
    _cards hui-stack-card.ts:39
    setConfig hui-stack-card.ts:38
    s create-element-base.ts:39

Thanks for the heads up, I’ll take a look at it!

2 Likes

I just came to notify the same :slight_smile:
In addition, in home-assistant.log file I found this:

2020-02-19 18:02:38 ERROR (MainThread) [frontend.js.latest.202002190] https://SOME-HIDDEN-HOST/community_plugin/mini-graph-card/mini-graph-card-bundle.js:1:75151 Uncaught TypeError: Cannot add property index, object is not extensible

The View doesn’t load and it loops on requests for historical data forever

Hi Folks,

I’m trying to get tap_action to toggle a switch for my AC zones when I click on a sensor graph, but for the life of me can’t work out the syntax.

here’s my graph, and the ULTIMATE would be having a state sensor for the zone embedded in it, but I’m happy to be able to click on and off to turn the zone on and off :slight_smile:

image

My lovelace YAML currently looks like this, but I just can’t get the tap_action working… any help appreciated !

   - type: custom:mini-graph-card
    show:
      icon: true
    name: Kitchen
    height: 35
    entities:
      - sensor.kitchen
    color_thresholds:
      - value: 0
        color: "#CCE5FF"
      - value: 10    
        color: "#66B2FF"
      - value: 18
        color: "#0080FF"
      - value: 20
        color: "#87c087"
      - value: 21
        color: "#389638"
      - value: 22
        color: "#FF9932"
      - value: 23
        color: "#FF8000"
      - value: 24
        color: "#ff0000"

It should be something like this:

  - type: custom:mini-graph-card
    show:
      icon: true
    name: Kitchen
    height: 35
    entities:
      - sensor.kitchen
    color_thresholds:
      - value: 0
        color: "#CCE5FF"
      - value: 10    
        color: "#66B2FF"
      - value: 18
        color: "#0080FF"
      - value: 20
        color: "#87c087"
      - value: 21
        color: "#389638"
      - value: 22
        color: "#FF9932"
      - value: 23
        color: "#FF8000"
      - value: 24
        color: "#ff0000"
    tap_action:
      action: call-service
      service: switch.toggle
      service_data:
        entity_id: switch.ac_switch