How to display a graph in a card

Hi guys, I’m Vincenzo from Italy…
and I’m a newbie of this wonderful platform. This is my first post …
I was wondering if it is possible to display a graph of a single sensor in a card outside the history.

1 Like

I would also look for this. For example to display grafana. Shall it be done via generic camera component?

Out of curiosity I tried pointing the generic cam at one of the full screen demo graphs at the grafana site but it doesn’t work. I didn’t think it would but I wanted to try anyway. That’s not to say it wouldn’t work on another graphing platform.

Do you use grafana with HA? Any pointers as to how to set it up? I tried Jupyter Notebooks and logentries but had no success with either.

Hi actually, I’m running HA una a raspberry2 and a MariaDB on a synology NAS with means faster graphs compared to the default SQLlite database.
The I’m building a php file to query the database and graph sensors… I can help you with this … I’ll give also a try to grafana but I’ll need more time

1 Like

https://home-assistant.io/blog/2015/12/07/influxdb-and-grafana/

1 Like

Thanks again,
my question was how to display the graph with is usually displayed in the history in card outside the history page!

Hi there, I am upping this thread as I have the exact same question : is it possible to show a graph directly in a card in the frontend ?

I am currently assembling a multisensor directly inspired by BRUH’s video, and I wanted to know if it was possible to add for instance the evolution of temperature during the last few days directly in the card for this sensor. If it is not possible, do you thing it could be implemented ‘easily’ ?

1 Like

Also looking at that. I need to know how to do this before going on using home assistant.
Is that even possible ?

@raxpa Hi! Sorry to reply in this old post but I have a similar setup. First I installed HA, Grafana and Influxdb on one Raspberry PI. Now I replaced it with the HASP image and will setup Grafana again but considered using my Synology as database. How did you connect the HA to use Maria DB. In Grafana do you use MySQL as datasource?

I just use maria DB my nas is to slow for grafana

Too slow for Grafana? I run Grafana on a rpi3 and it runs just fine.

Anything new on this front? Id love to have some graphs displayed in HASS. Grafana is too much as there are already graphs in home assistant. I like to reinvent the wheel, but not this time :wink:

1 Like

How to display grafana in the home assistance cards UI?

Sorry, the question was unclear. As OT asked: How to display the home assistant default graphs (those that display the entity history when you click on it) as a card? Cheers!

1 Like

yep just something simple like when you click on a sensor it shows this:

image

I’m looking also for this, anyone as an idea ? thx

See: https://home-assistant.io/components/history_graph/

Should do what you want (and even more).

2 Likes

Tanks a Lot

Thank you for suggesting the history_graph
While I’m able to use the history_graph element, it doesn’t really behave like I wanted it to.

For instance, this is my entity:

Entity: switch.pc_power_24
State: on
Attributes:
current_power_w: 61.3
current_energy_kwh: 0.04
Vera Device Id: 24
friendly_name: PC Power

The problem is, after creating the history graph like this:

history_graph:
graph1:
entities:
- switch.pc_power_24

The card is actually graphing the state of the switch (on, off) and not the attributes. I’m actually only interested in the current_power_w attribute, since this is really meant to be a power meter and not a switch. The examples in the history_graph component don’t give away whenever it is possible to filter out a specific attribute.

Ideas?

1 Like

If you want to graph (access) data from a sensor entity’s attributes, checkout the template sensor This component allows you to get at the attributes of a sensor to be able to use them as you would states for graphing, triggering, conditions, etc.

However, this is only for sensors and I see that you are using your card as a switch entity. Would it be possible for you to edit your configuration to setup your switch as a sensor instead? Then you would be able to use the template sensor component to solve your issue.

At this time, I don’t know of a way to expose switch attributes directly as you are requesting. Perhaps someone else knows of another way.