[Under New Management] Interactive history explorer custom card

Ok I’ll look into it. The info panel code defines the default colors a bit differently by design, to match the native info panel a bit better by default.

No.

1 Like

Is it possible to set horizontal time period? For example ‘month’ in some cases I’d like it to show just this month, not a month long time period back from today.

Also, is it possible to adjust display’s right margin? Currently right edge/side of the scale is current value/time but I’d like to have there some (user adjustable) time/space. For example in day view curves’ current value would be shown 1-2 hours before scale’s right side/end.

You mean like a time offset from current time ?

Yes, offset from current time to the chart’s right edge/margin.

And for month/day periods an option to show actual calendar months/days instead of 24h or 30 day period. i.e. today, this week, this month.

The green-in-green things were due to incomplete default colors on the more info panel (which uses somewhat different defaults to make it look more like the original info panel). Should be fixed in the upcoming release. The cover thing however, I think it’s just a coincidence that the two auto selected colors are that close. You can try the undocumented stateColorSeed option with a random numerical value (default is 137). This will reshuffle all auto selected state colors. Or just override the closed or open states globally. What default colors would be good for a cover ?

Will test. Thx a lot.

Fine for me. Though only, this could be the same problem and gave the example as well. Here it is far easier to distinguish.

Don’t know. But 100% not the color, we will see in 2022.12 for covers. :joy:

New V1.0.39 is up ! Some nice highlights:

  • New optional decimation mode for accurate minmax preservation. This one turned out to be really nice :slight_smile: It does additional signal analysis while doing the decimation, so the rendering is a little slower (as such, it’s not the default, which is the previous fast and approximate one). But if you want your line graphs to keep their shape when you zoom out, head to the decimation section here to learn how to turn it on !

  • Long term statistics now have a configurable reporting period (@tkrhiman @ondras12345). Default is per hour (as before) and supported additional modes are day and month. See in the readme under long term statistics and under CSV export. Technically the HA history API also supports a high resolution 5 minute mode, and you could use this for this card. But the HA API to request this seems broken and the results will be weird. So this setting is not officially supported.

  • Better timeline default state colors to fix the weird green on green situation @arganto.

  • You can now independently set state mode (raw or translated) in your tooltips.

And finally a big thanks to roykrikke for contributing a Dutch translation !

2 Likes

Works like a charm! :+1:

Great as well. “But” a lot of other entities have here black off. Random as well or wanted? Didn’t see this before occuring. Both in card and infopoanel

image
climate

image
switch

image
binary

In dark mode it does (on the info panel), mainly because it (subjectively) looks better. On the main card, it was always like that and shouldn’t have changed. However it looks like its using dark mode colors on light mode for you ? Does the card think it’s in dark mode, how does your uimode setting look like ?

Yes, it is with uimode: dark. Only switched to standard theme, so that this behavior is not related to my own own (pseudo dark) theme.

I’m pretty sure, that it was not the case this way until the update. But I will test and go back one version.

On the main card, nothing should have changed.

1 Like

You are most probably right. Tested it with some versions of history and they were always black now. Whyever my gut feeling was, that it was different in the past.

Wasn’t sure what you meant by that (I didn’t try the beta)… Now I understand haha :grin:

Ok, could you open a feature request for that on github ?

Hmm, I have to think about this. I’m not yet convinced that this is where this card should be going. Some more opinions on this would be good.

Exact day/week/month periods would be useful for energy bar charts (with temperatures etc. lined up). HA’s energy dashboard has buttons for this but only for total energy.

Is it possible to refresh charts automatically or with a mouse click? I haven’t found a way. Currently I have to use F5 for refresh. It would be nice if the charts could update automatically (with user selectable interval).

Also, is it possible to zoom vertically or temporary limit vertical auto scale or autoscale time range? I know I can put ymin/max values but sometimes I’d like to take a more closer look for certain time period and still keep the full display after that.

edit: looks like Apexcharts already does all this and much more, I’ll have to take a look.

Very n00b question:
I cannot get the long term statistics to show up.

I tried the basic setup from readme:

type: custom:history-explorer-card
statistics:
  enabled: true
  mode: mean
  period: hour     # reporting period. hour, day or month. Default is hour.

I tried adding multiple different sensors - temps / aqi / battery / power / energy, ect…
Nothing shows up, before standard history data.

HA’s statistics card perfectly displays charts so data is there. I can even see it being fetched over WS as I scroll the history card but nothing shows up.

HA v2022.12.1

Hard to say without more indepth info. Try to switch to a time range of 1 year directly after a page refresh, without scrolling. Does that work ? Keep in mind that fetching the statistics data can take a while (the HA recorder and statistics backends are very inefficient), during that time nothing will show. Give it a while to fill up the cache.

If not, check if there are any errors on the console.

Oh and what is the retention period of your history (the normal one, not statistics) ?

Side by side after page reload:

There is nothing sus in the console:

Are these cards all loading the statistics at the same time ? The HA statistics API has a tendency to randomly fail if multiple accesses are made at the same time. If you create a history explorer card alone on its tab (or on a tab without other cards accessing the stats), does that work ?

What’s the retention period of your history recorder ? To rule out a problem with the auto detection of data range for the merging, you can try to specify it manually:

statistics:
  retention: 9   # or whatever your retention time is, minus one.

I already tried putting various single statistics card on a view.
I only did them all for screenshot comparison.

Anyway I tested again a single history card on single view with PM25 air sensor
and last 6 months range:

card yaml data
type: custom:history-explorer-card
cardName: historycard-34543343
defaultTimeRange: 6o
statistics:
  retention: 9
  enabled: true
  mode: mean
  period: week
  • the earliest point displayed on the graph is 2022-12-01T23:27:15.000Z
    this kinda corresponds to my recorder retention settings (default) of 10 days

At the same time I can see WS fetching batch of LST data that corresponds with entity_id and selected period:

  • for hour period initial request returned 4104 records were fetched
    from (start) 2022-06-11T22:00:00.000Z to (end) 2022-12-01T23:00:00.000Z

  • for week period 26 records were fetched
    from 2022-06-05T22:00:00.000Z to 2022-12-04T23:00:00.000Z

I tried setting retention: param in the card with different values (including 9):
I can’t see anything visual difference, while it does affect periods and data returned from WS as expected.