Lovelace: mini graph card


But still would looks way better (as overall) than the history graph :smiley:

Not sure about the bar char problem, shouldn’t be possible to have the value “now” to generate the graph?
That would “fix” also the current usage issue when that is 0 in a graph (or the reported problem above).

Don’t get me wrong, I don’t need those things, I am just suggesting an improvment when I think I see one, and I still can be wrong :smiley:

But, truth is, even if it will have drops as the history-graph, you will still look much better and will still be more customizable (color, font, size, extrema, etc…) :wink:



Thanks, you’re so kind :smile:

What do you mean by having the value “now” generating the graph?

We can’t render one bar for each history entry, as there can be 100s every hour, we also don’t have a consistent interval between the entries, it could be 1 second or 10+ hours.
We need to combine all the entries from each timeframe (one bar) and come up with a number for the bar (in this case the average).

The same principle basically applies to the line graph, one point equals one timeframe (points_per_hour * hours_to_show) and could sometimes consist of 100s of history entries and other times just one or even zero.


Oh that clarify A LOT why some of my graph takes ages to show up :smiley:
What I mean, is that maybe some sensors gives you a “total up to now” value, as for example (I think) the consumed electricity.

In that case, you might want to take the last value from each day in the past (ex. 23:59:59) and the “current” value for today.

That way you will have the previous day with the total consumed electricity untill the day end, and for today the total consumed electricity up to the moment the graph is loaded (or maybe better say, up to the last reading on the sensor).

Not sure it clarify, I hope so :slight_smile:


For my watermeter it would be perfect if it started with 0 at midnight and just additions during the day. No averages, just running sum.


The graph calculations are actually pretty quick, what takes time is fetching the history from the backend/database at least from my experience.

First row is from fetching 24h of data from the backend, second row 168h (1 week)

Yes, that’s not a bad idea and would work for those use cases, assuming the sensor resets correctly before the next day.


Yes I guess I have troubles with my history data for some reason.

Tried local sqlite DB and MariaDB.

I am storing 1 week of data, I didn’t think it was going to be that slow to fetch it ^^


Yep, Switched to MariaDB, keeping 7 days as well, still slow :frowning_face:

But it’s faster than the default SQLite db at least (I think?) :laughing:


Yes, slightly faster but it should be way faster.
Not sure about your setup, but I am using my hosting servers to host the mysql database, and those are fast…
I also checked connectivity, but 20Mbps even if are not that much, are quite enough for MySQL queries…
So, for now, I think my bottleneck is the raspberry itself, I will have to test other HW soon to make it a little more performant :smiley:


I’m running HA and the database on the same server, and it’s pretty beefy, so should be fast imo :slight_smile:


So not a Raspberry but a server, and it is still slow?
If so, there is some serious design problem there :open_mouth:


Yes, database is located on a regular hdd though and not an ssd, not sure if that could make any difference.


No, not on an application that should work on a raspberry tho :slight_smile:
Got hundreds of hosted websites and everything works smoothly, this is just too slow, not sure what’s wrong tho… it might be db design or queries or even completely something different.

It might also be that the query response is fast but the “lookup” process is slow.

Bar Chart-Daily output - From InfluxDB

You should have a look at the tables in there… kinda a mess :frowning:


Just did, my states table have 191700 lines in it and I’ve been using MariaDB not even for a week now :open_mouth:


there’s not any issue with mariadb and many lines as log as you don’t need sql with joined tables…
I have mysql dbs with tables with more than 100 million lines running on low end machines

in HA on raspberry there are other problems:

  • a small amount of ram
  • micro sd
  • probably a bad design with tables or queries


I don’t run MariaDB on my Pi so 1 and 2 are off the list :stuck_out_tongue:


I never said MariaDB was the problem.

What I said is that probably there was a design issue or a data management (post-query results) that wasn’t tweaked enough.

I do run MariaDB aswell on separated dedicated harware.

The HA issue might be by design or because of the raspberry, but those problems also appears on powerfull VMs, so it is probably somewhere in the design/implementations.


Can someone help me using this on a docker installation?
Where do I have to paste the “mini-graph-card-bundle.js”?



The www folder… just follow the instructions. It’s no different to any other custom-card


This is my first attempt to install a custom-card.
I can’t find any www folder. I just found a config folder with a daemon.json file, but I can’t paste anything there, it’s read-only folder and can’t change to write.