[Deprecated] Interactive history explorer custom card

OK, some progress… it works with vertical-stack, but does not with custom:vertical-stack-in-card. I’m using the later as it hides individual cards borders within stack, so card looks uniform. So issue is more complex as involves 3 different cards :slight_smile:

Usually I try to test a release with all builtin cards (vertical stack, conditional, etc) and some popular custom ones. But it’s difficult to guarantee compatibility with every other custom card there is, considering the shear amount. The history explorer card behaves a little differently to other cards due to its dynamic nature. It generates and changes its HTML on the fly and not all custom layout cards might be able to deal with this.

I’m going to try yours, no guarantees but I’ll see what I find.

Thanks a lot HeyImAlex! Hope something easy to diagnose and fix! If not… will survive!

Are long-term statistics supported? Couldnt find any information on this in the docs.

The problem i am having is that i only have 10 days worth of data in the recorder, but over a year in the long-term statistics. Would be cool to be able to use that data instead!

There’s no long term statistics support yet.

It’s on my list, because I can definitely see the value in supporting that (including for my own use). I started integrating access to the HA long term statistics API, which works, but I haven’t found the time to properly add that to the cards UI yet. Ideally I’d want a way to seamlessly switch to long term stats if you scroll back far enough and your actual history ends. So instead of showing a blank space as it does now, it would start pulling data from the long term stats instead. That may take more dev time than I currently have though, so I might start with a simple switch where you could toggle between normal and long term history.

4 Likes

Awesome, looking forward to it.
Thanks for letting me know!

This is a fantastic project! I hate that I am just now finding it…
One question. I am using the card to monitor my energy sensors and was wondering if there is a way to specify the min, max, or mean attributes for the individual sensors?

Edit: Also just realized something else. The card is different across devices even when logged in with same user. When I setup the card on my pc, the card is present in the app but the entities are no longer selected. Can that be fixed?

min/max/mean are part of the long term statistics, so see answer above.

Just add the same entities on the PC I guess ? Dynamically added entities are stored in the browser. If you strictly want the same entities accross all devices, then you need to specify them manually in the yaml.

Thanks, that worked out perfectly.

Thanks for the great card. I’m looking to augment the graphs with key events. The concept I’m playing with is somethings like this, where event icons (from HASSIO history) and camera images (I use Blue Iris and the AI function which highlights cars/people/etc, then a python app to crop the images and add json and turn into thumbnails):

Is there a good way to add icons or images at a specific time? I can custom build a JSON payload of these to pass in. Bonus points if:

  1. Multiple clustered icons are shown in different “rows” or areas if they would overlap
  2. Can pass in priorities of events/icons, then as you zoom in more show (for example, if there are 20 events all in the same 15 minutes as someone walks through the house, but front_door_open and car_left has priority 10, show those and hide the others)
  3. Can do a tap_action on any icon/image to get a popup to show more data based on the json variables
  4. Can pull all of this from the current history log, and just show automagically (this seems pretty complex, might need to build a query for each time to show an icon… not quite sure how yet)

Any thoughts on how best to achieve something like this?

For context, I’d like to have it on a floorplan that shows small then takes over the fullscreen when clicked:

Hello, can anyone please tell me wher E to get the data from exported CSV files? Thank you :slight_smile:

In your browser download folder.

Interesting idea. Doing this would require considerable changes / additions to the code of the card. It’s not something you can just easily slap on top of it. You could probably hack something together and it would sorta work. But to do this well in terms of resource management, rendering performance, multi device support (mobile), UI/UX, etc, would be quite involved.

It would also need an entire thumbnail generation infrastructure around it, running on the server backend, to generate the thumbnails and the meta data that goes with them. And then you need to configure the card to pull this all in from the server, using the HA REST or WS APIs (which would have to be modified to allow this) or over a separate webserver running on your HA system. Keep in mind that client code like the one used by frontend cards cannot access anything on your HA backend directly. It’s not something that would just work out of the box on a new HA install.

There are multiple ways you could add this. You could render the images into the existing graph canvases, you could add additional overlay canvases or you could treat the images as floating html components. All have their pros and cons. The card has existing methods to place an element on a specific time code as the user scrolls or zooms, so that part is easy. The harder part is the entire resource management from generating the data, pulling it from server to client and keeping it in sync.

Let me know if you want to try implementing this.

Thanks. I’ve implemented something similar using timeline.js (8 years ago!), and am thinking I finally plunge into the world of HA card making if so. Would love any pointers of where to start.

I was thinking of not going the whole level of generating thumbnails on the server (but a PIL service in AppDaemon could do that, which I’ve got working reliably), instead just have the card pull icons of events by default and graph those. If the user provides their own time-based JSON of images, graph those as well.

I’m working on a few other scripts with AppDaemon to pull imagery from cameras to generate those icons and corresponding JSON. I have it working for my setup but it’s not easily extensible with any setup (need to build config files and whatnot). I’m also testing path detection so it’ll give alerts like “two people are walking towards your front door.”

Let me know if you’re interested in collaborating. I still haven’t decided if I want to go this far… was hoping I could just post the idea and have a random internet stranger elf do all the work for me like it was Christmas in June.

Thank,you, in fact I just realise that with iPad was not possible :slight_smile:

Is it possible to change/customize the unit on measurement of the graph? Or rather to put own text there… I have several chart showing different aspects of rooms climate, all of them showing the same data sets names. Only looking at unit of measurement i can differentiate what specific graph show. So would be nice to able to change unit to something more descriptive, like change % to Humidity (%).
I hope graph below should explain, why this would make sense:

Just add a unit key in your predefined graph entities list, under the entity you want. If you have multiple entities in a single graph, the custom unit of the first entity in the graph will be used.

Overridding the unit only works for yaml defined entities.

1 Like

Thanks alot Alex! This did the trick exactly the way I wanted it!

Great card really useful. Love that you can export to CSV a great feature.

Would it be possible to display one or more statistical attributes on the card?

For example if I am displaying temperature I would like to see the min and max for the period but if I am looking at rainfall I would like to see the cumulative total so being able to configure the attributes to display (if any) would be a great benefit.

Hey Alex,

your card has just become more relevant than before, with the new changes in the core History panel…

being able to select only from recorded entities, and those being persistent between view changes and even restarts is a huge plus indeed.

as I suggested in improving the HA panel, I figured it might be a nice touch for you card too:

being able to select entities by type/integration. Would that be something you’d consider adding?

usecase: check the person entities, and instead of having to select all persons individually, simply select Person from a dropdown. etc etc

Glad to write a FR if you’d consider ofc.
thanks!

1 Like