Home Assistant Community

Lovelace: mini graph card

#303

Sure, no problem at all :slight_smile:
Here it is:

              - type: entities
                show_header_toggle: false
                entities:
                  - type: custom:mini-graph-card
                    name: Speed Test
                    more_info: false
                    group: true
                    height: 0
                    hour24: true
                    hours_to_show: 24
                    points_per_hour: 4
                    animate: true
                    decimals: 0
                    show:
                      name: true
                      icon: true
                      state: true
                      graph: line
                      fill: false
                      points: false
                      legend: true
                      extrema: false
                      labels: false
                    entities:
                      - entity: sensor.speedtest_download
                        name: Download
                        color: "#3399ff"
                        show_state: true
                      - entity: sensor.speedtest_upload
                        name: Upload
                        color: "#ff6600"
                        show_state: true
                      - entity: sensor.speedtest_ping
                        name: Ping
                        color: "#33cc33"
                        show_state: true
                  - type: custom:mini-graph-card
                    more_info: false
                    height: 150
                    group: true
                    hour24: true
                    hours_to_show: 24
                    points_per_hour: 4
                    animate: true
                    decimals: 1
                    show:
                      name: false
                      icon: false
                      state: false
                      graph: line
                      fill: false
                      points: false
                      legend: false
                      extrema: false
                      labels: false
                    entities:
                      - entity: sensor.speedtest_download
                        color: "#3399ff"
                      - entity: sensor.speedtest_upload
                        color: "#ff6600"
                  - type: custom:mini-graph-card
                    more_info: false
                    group: true
                    height: 25
                    hour24: true
                    hours_to_show: 24
                    points_per_hour: 4
                    animate: true
                    decimals: 0
                    show:
                      name: false
                      icon: false
                      state: false
                      graph: line
                      fill: false
                      points: false
                      legend: false
                      extrema: false
                      labels: false
                    entities:
                      - entity: sensor.speedtest_ping
                        color: "#33cc33"
                  - type: custom:mini-graph-card
                    more_info: false
                    group: true
                    height: 0
                    hour24: true
                    hours_to_show: 24
                    points_per_hour: 4
                    animate: true
                    decimals: 0
                    show:
                      name: false
                      icon: false
                      state: false
                      graph: line
                      fill: false
                      points: false
                      legend: false
                      extrema: true
                      labels: false
                    entities:
                      - entity: sensor.speedtest_download
                        color: "#3399ff"
                      - entity: sensor.speedtest_upload
                        color: "#ff6600"
                      - entity: sensor.speedtest_ping
                        color: "#33cc33"

I am looking forward for the additional info in the “extrema” part :slight_smile:

2 Likes

#304

I was trying to get my solar output sensor to show as a bar chart. This sensor reports once a day and I wanted the chart to show 12 days output, one bar per day.
I have

- type: custom:mini-graph-card
            entities:
              - entity: sensor.power_gen_cum_prior
                name: ENERGY GENERATION
            show:
                graph: bar  
            hours_to_show: 288
            points_per_hour: 0.041666667
            lower_bound: 0
          - type: history-graph
            title: Power use Vs Gen
            entities:
               - sensor.energy_generation
            hours_to_show: 288
            refresh: 3600 

and I get


The bar chart is accurate for the first 4 and the last 4 days, but the middle portion is somehow averaged?
(History-graph is shown for comparison).
Anybody tried to do a monthly graph?

0 Likes

#305

Is it possible that you don’t have correct data for those days?

0 Likes

#306

I do have correct data, which is rendered correctly by the history graph.

0 Likes

#307

I see, sorry I toiught they were two different graph because of the title, my bad :slight_smile:
I guess that this might somehow be a bug,

But technically also the 4th bar is wrong, because in the history graph the 4th should be almost half of the previous barm how many “reads” are done each day?
Cause maybe that’s the issue there, maybe a good FR should be havving “points_per_day” rather than per hour.

0 Likes

#308

Are you sure it only reports once a day? Judging by the graph it looks to be updating regularly and then reset once a day. (especially noticeable when looking at the last day).

This won’t work well with this card, since the graph is based on a moving average calculated on the history data from each data point (24 hours in this case).
Also, if you would open the UI with the graph in the middle of the day (12:00) for example, each bar will consist of history data from 12:00 a clock - 12:00 a clock previous day, while you are probably expecting it to calculate each day from 00:00-24:00.

Anyway, I think you could make it work, but it would require some work.
Kind of hard to explain but if you could make the sensor only report once at the end of the day (at the exact same time every day), maybe just before 00:00 and then also reset itself, I think it could work. The sensor would need to be updated at the exact same time every day though, if not, two updates could end up in the same 24 hour timespan. An easy workaround would be to set hours to show slight lower (286) but still have it display 12 bars, that way each day would be 23h50min and you have a 10 minute margin for the sensor to update.

Also, there’s a bug with the bar chart atm, there’s an additional bar, the last (right) bar shouldn’t be there.

0 Likes

#309

@kalkih
Is it possible to use the bar chart card for each bar to show watts consumption day?

0 Likes

#310

It’s possible, depending on how the sensor data looks. The graph is calculated by moving average, so not really suitable for such use cases but it’s possible. Read the post above for more details.

1 Like

#311

Thank you for the wonderful cards! I love the updates in 0.3.0! :heart_eyes:

1 Like

#312

Can u show an example?

0 Likes

#313

Sorry, I don’t have any sensors like that.

0 Likes

#314
 - entity: sensor.power_gen_cum_prior

used for the graph card is indeed reported once at midnight derived from

 - sensor.energy_generation

using a template sensor.

0 Likes

#315

I am having problem with this card.

This is what i get using the sensor.living_room_heating.

50

Problem is that at night (from 00:00 to 07:30) the sensor in /states shows always 0% as value, while in the card it shows always 16,5%. The thermostat is off between those hours. Why i don’t get 0% as the sensor says?

0 Likes

#316

Sounds like the sensor might be reporting something that’s not considered a number when it’s “off/0”, the graph would then ignore those history entries.

But I would need access to the history to give you a definite answer.

Here’s a quick post on how you can access the history

0 Likes

#317

Hmmm i’m not so familiar in such things… I can wait if you can find some fix for this… sorry to not help you.

If can this helps you:

26

This is what i get if i choose more infos about the sensor.

0 Likes

#318

I’m not able to recreate this issue, and I can’t fix it without having access to the history data.

0 Likes

#319

It does look it is doing ana verage…
But… @maurizio53 also my question is… why/how would you measure heating in %?

Is that the % of power the heater is providing?

Thanks :slight_smile:
Andrea

0 Likes

#320

I hate to be picky (take it as a sign that everything else is so great that this is all I can come up with :slight_smile: ) but using a theme with rounded corners gives this

image

To be honest, I don’t care if you don’t but that is only because I refuse to let my OCD take over…

0 Likes

#321

Yes, that’s the power of heating… Using Tado as smart thermostat

0 Likes

#322

lol, that does indeed look bad, makes me :nauseated_face:

Was a quick fix, will be available in the next version, not sure why I allowed overflow from the beginning :thinking:

If you can’t wait, you can use card modder in the meantime and set

style:
  overflow: hidden

hyperion_8123_lovelace_4%20(29)%20copy%204

1 Like