[Under New Management] Interactive history explorer custom card

I’m not very good with templates (pretty much all my entity mapping and math is done outside of HA). It looks like it’s trying to treat the ‘unavailable’ part as a string rather than the actual unavailable state. Not sure how to fix this, maybe someone better in templating can help.

However there is a workaround. Instead of forcing the template to unavailable when the binary sensor is off, you could make it go to an impossible value, for example -100 °C. You could then use a custom process function in the card to map this value to the unavailable state, for example:

- entity: sensor.xyz
  color: rgba(0,0,0,0)
  fill: rgba(225, 179,133,0.4)
  process: "( state > -99.0 ) ? state : 'unavailable'"

Also make sure showUnavailable is actually set to true, so the card won’t interpolate over it.

1 Like

sorry, for coming back so late.
I checked with Edge, Chrome Portable 118, Firefox portable 118. Basically its working in Edge & Chrome but not Firefox. So, something is odd in Firefox :frowning: No Idea what. But you can try by yourself. Just add two or more signals (with 1-3 data points per minute) to the standard history graph.

type: custom:history-explorer-card
infoPanel:
  uimode: dark
uimode: dark
stateTextMode: auto
combineSameUnits: true

How can i make the new history explorer the default explorer?

When touching the name of a entity automatically the history browser is shown… but the old version; where the time frame selection is less comfortable.

It is to say that this was the behavior after the installation. After a few days the old version is shown again.
Of course it works within a card. But the width of cards is not ideal to show history graphs and one has to select the entity. By just tipping the entity on any card makes the use much easier!

In this example the old explorer is shown. I ask how to make it the new will pop up!

Ha, I found the problem! I switched in troubleshooting mode…and followed the recommendations.
Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems | Firefox Help (mozilla.org)

Switching off “Use hardware accelaration when availble” solved the problem! Very stupid performance recommendation from Firefox!

Click this option here:
image

Does Firefox disable HW acceleration by default ? This card uses a lot of rendering commands, so using the GPU (aka HW acceleration) to do the rendering is highly recommended for good performance.

That changed the behaviour: enabled history info panel. Now the new history explorer is shown automatically.
Thank you.

Keep in mind that this is a per browser setting. You have to enable it in every browser, app, etc. Advice only to prevent the follow up question. :wink:

Hi, I have another (maybe simpler) question
The defaultTimeOffset is shifting the chart to the left. Is it possible to set there a value depending on the day of the month (e.g. a template value)? So that I see the entire new month also on the first of the month.
The value should be:

first of month: defaultTimeOffset: 30d
mid of month: defaultTimeOffset: 15d
end of month: defaultTimeOffset: 0d

or easier: defaultTimeOffset: numdaysmonth - currentdaymonth

cards:
  - type: custom:history-explorer-card
    labelsVisible: true
    defaultTimeRange: 1y
    defaultTimeOffset: 1d <- dynamic value

something like this maybe?

    defaultTimeOffset: >
        '{{ (now().replace(month=now().month % 12 + 1, day=1) - timedelta(days=1)).day
        - (now().strftime(''%d'') | int) }}d'

This one is not working …

Thanks for any hints!

Templates are not supported, sorry.

What exactly are you trying to achieve there ? If it’s only about showing the entire current month, any reason defaultTimeOffset: 1O (upper case O) doesn’t work ?

Thanks for the answer.
Is there a difference if I use 30d, 1o (lower case o) or 1O (upper case O) as offset (same question for lower case and uppercase D)?
Because I think that yesterday (end of October), with the offset off 30d, the (almost) complete November was shown, even I’m only interested in October. Today now (first of November), without offset, the November is not shown (it is but only a very minimum). Is the offset a general shift? Or is there a way to show the current month completely? The same question is for the day. In the morning, I see only a quarter or so of the day, in the evening, I see almost all day. But I want to see the complete day also in the morning (otherwise a bar may also be almost invisible when it is very small)

Here a picture from today with no offset: November is not visible at all:

If I add a one month offset, then it looks OK for today:

But I think it is a sliding window, so as further as the month goes on, as more we see from December then, correct?

Is this understandable?

Yes. Lower case denotes a sliding window, upper case snaps on the hour/day/month start boundary.

Thanks for this hint, this should then do what I want.

I need to add that to the readme (and several other undocumented updates too).

1 Like

Hi Alex,
First of all, thank you for the great history explorer card that you gave us. I just started using it, and it looks beautiful, both in what it can do, and in how it looks.

Currently, I’m using the history explorer to look at device consumption in my house.
I have some questions:

  1. My energy meters do have 2 tariffs: F1 and F23 (I live in Italy). So, for each device, I have 2 sensors (created automatically by Home assistant): sensor.device_f1 and sensor.device_f23. I’m adding both to a single graph, but they combine in a non optimal way: they are bars that would like to sit one next to the other. It would be better to have show one on the top of the other, just like the Energy View does in Home Assistant. Could this be done in some way?
    2. Can I specify a default zoom level, different from the default “hour”? I finally found it out: it’s
graphs:
  - type: bar
    options:
      interval: daily
  1. I tried the uppercase time range and time offset options that you were talking about up here (1W, 1O), but nothing happens. With the lowercase ones, all works. Is it a bug? I’m using the latest released card, V1.0.50. Add: the ‘-1y’ offset does not work, but the ‘-12o’ is actually working.
  2. I would like to show a sum of the energy consumed by a device in the specified time range, using a bar chart with horizontal bars (just like how Home Assistant Energy View is doing on the bottom), optionally sorting them from the most consuming one to the least consuming one or optionally using a fixed ordering (the one used in the YAML). Could it be possible?

I understand that the infopanel settings should be defined only once and in one card only. I therefore have a card that I will use for that purpose only.
Sofar I have the following yaml:

header: Global history card settings
graphs: null
infopanel:
  lineMode: stepped
  uiLayout:
    toolbar: bottom

I hoped that the last 2 lines would set the toolbar to the bottom for all Info panels… but alas!

Hi and thank you for this great plugin!
I’m trying to get CSV of history_stats sensor, but export has same issue as HA statics chart - it grabs max value of previous day as HA still has previous max value when clock turns 00:00
image
image
As HA hasn’t fixed this for the long time I’m wondering if would be possible to address it in CSV export as it works as expected in chart.
Thank you in advance!

Keep in mind that this card was not designed to be a replacement for the HA energy view. The energy view will have some features specific to that usage that this card doesn’t have, and vice-versa.

infoPanel, with a capital P. Case matters.

You cannot change the UI layout in the info popup panel, I’m afraid. The toolbar will always be at the top on these special cards. You can hide it if you want though.

Not sure what you mean by that. The CSV export is a direct raw dump of what HA recorded in the database. The graph is a processed aggregation of those values.

infoPanel is with a capital P in my yaml but I modified it here before posting. Sorry for the confusion and thanks for your input.