history-explorer-card icon indicating copy to clipboard operation
history-explorer-card copied to clipboard

Fix history in more-info dialogs

Open elchininet opened this issue 6 months ago • 26 comments

This pull request fixes the history in more-info dialogs replacing the properties of the more-info dialogs that were replaced in Home Assistant 2025.5.0.

elchininet avatar May 20 '25 18:05 elchininet

Incredible. Genius. It is working again. Can cry for joy.

image

For all, who don't want to wait for merging the PR, etc. I have just replaced the relevant parts in the JS. See attached the file, which is working here.

history-explorer-card.zip

  1. Unzip attrached zip
  2. Replace the history-explorer-card.js in www\community\history-explorer-card folder
  3. Either gz that in the gz file or just rename the history-explorer-card.js.gz to history-explorer-card.js.gz.old
  4. Reload js in browser via hard reload or developer tools without cache or ...

emufan avatar May 21 '25 05:05 emufan

For all, who don't want to wait for merging the PR, etc. I have just replaced the relevant parts in the JS

That file is already included in the pull request. It is the second file in the list of changes (history-explorer-card.js). 🙂

elchininet avatar May 21 '25 07:05 elchininet

So it seems that this is a confirmation that the fix is working, I'll open the PR.

elchininet avatar May 21 '25 07:05 elchininet

Hm... am i the only one where it doesn't work? Tried everything: replacing "__", tried above zipped file, hard reloaded (via F12), restarted HA... i still have only built-in history when i click on any card...

Protoncek avatar May 21 '25 08:05 Protoncek

Hm... am i the only one where it doesn't work? Tried everything: replacing "__", tried above zipped file, hard reloaded (via F12), restarted HA... i still have only built-in history when i click on any card...

Did you rename/delete the gz file as well? See point 3? And really replace the js with my file?

And try to reload e.g. via image +Reload?

emufan avatar May 21 '25 08:05 emufan

Yes, i renamed original file, copied your version and hard reloaded (F12, then right-click and "empty cache and hard reload".) We are talking about the same thing? I'm testing history when i click on entity, before that i chose "enable history info panel": (pic shows panel already enabled): image

Protoncek avatar May 21 '25 08:05 Protoncek

hard reload

It is not the same loading a browser bypassing the cache than clearing the cache. If you want to be sure, open your Home Assistant instance in an incognito window, if you don't get errors there then you are being hit by cache issues and you know that you need to clean it. (you can try to disable cache in Network tab and reload several times)

elchininet avatar May 21 '25 09:05 elchininet

i still have only built-in history when i click on any card...

By the way, this PR is to solve errors when you open dialogs after selecting the option to replace the history panel (the history is replaced completely but there are errors in the console so you get an empty history). If your history is not replaced at all then that is a separate issue not related to this one.

elchininet avatar May 21 '25 09:05 elchininet

By the way, this PR is to solve errors when you open dialogs after selecting the option to replace the history panel (the history is replaced completely but there are errors in the console so you get an empty history).

Yes, that's what it's happening. I owe you an apology about that - i didn't even look if history graph shows or not, i just looked at top line (i looked if + - and day will be shown or not) and when it was old interface i didn't even look forward... but now that you mentioned - yes, graph is still not shown. As said, i did clear cache with F12 --> hard reload and clear cache. I also tried on 3 devices, edge, chrome... I also tried on android app, nothing...

So, for whatever reason this solution doesn't work for me... (BTW...your file still has 19 "__" hits .. is that ok? First solution was to replace those...)

Protoncek avatar May 21 '25 10:05 Protoncek

Is the fix working for the mobile view too? I did the fix and it´s working fine in the desktop version (after clean the cache). But in the mobile version, after enable history explorer for all, i don´t see the nothing. I removed the cache for the site in the chrome app. Is there any step I missed?

songochain avatar May 21 '25 10:05 songochain

This error shows in my developer tools when i load page with history panel enabled and click for more-info: image

Protoncek avatar May 21 '25 11:05 Protoncek

As said, i did clear cache with F12 --> hard reload and clear cache. I also tried on 3 devices, edge, chrome... I also tried on android app, nothing...

Make a simple test. Go to the network tab in developer tools, refresh your browser, search for history, right click on the first entry and open it in a new tab. Search for __ you should only get 2 instances.

So, for whatever reason this solution doesn't work for me... (BTW...your file still has 19 "__" hits .. is that ok? First solution was to replace those...)

I am not sure which file you are checking. This is the raw file in this pull request, if you search for __ you should get only two instances.

elchininet avatar May 21 '25 14:05 elchininet

Is the fix working for the mobile view too? I did the fix and it´s working fine in the desktop version (after clean the cache). But in the mobile version, after enable history explorer for all, i don´t see the nothing. I removed the cache for the site in the chrome app. Is there any step I missed?

You need to clean cache also in the App, if not you will get a cached version of the plugin.

Follow the reccomendations given here.

elchininet avatar May 21 '25 14:05 elchininet

Is the fix working for the mobile view too? I did the fix and it´s working fine in the desktop version (after clean the cache). But in the mobile version, after enable history explorer for all, i don´t see the nothing. I removed the cache for the site in the chrome app. Is there any step I missed?

You need to clean cache also in the App, if not you will get a cached version of the plugin.

Follow the reccomendations given here.

I´m not using the companion-app, it´s a chrome web app (shortcut from the web).

songochain avatar May 21 '25 14:05 songochain

I´m not using the companion-app, it´s a chrome web app (shortcut from the web).

Then open the Home Assistant instance in an incognito window and check if it works there.

elchininet avatar May 21 '25 14:05 elchininet

I managed it to work. What i did was:

  • delete BOTH files in history's folder (js and js.gz)
  • zipped new "history-explorer.js" file into "history-explorer.js-gz" with 7zip program
  • copied BOTH files (new js and new js.gz) in history's folder
  • hard refresh.... only NOW it works. So, is it imperative also to replace gz file, too, not only js one? I didn't quite understand your point 3 in instructions - i thought that i only need to rename OLD gz file. I did rename it into ...js.gz.old as suggested, but that wasn't enough.

oh, well... noob goodies... thank you very much for bothering with me!

regarding companion app: it works on iPad, since it has clear cache button. God only knows how to clear cache on Android, though.... i can't manage to work...

Protoncek avatar May 21 '25 15:05 Protoncek

only NOW it works. So, is it imperative also to replace gz file, too, not only js one? I didn't quite understand your point 3 in instructions - i thought that i only need to rename OLD gz file. I did rename it into ...js.gz.old as suggested, but that wasn't enough.

That is weird, renaming should be enough. Normally I use backup.name.extension but that should not make a big difference. Anyway, good that you get it working 👍

elchininet avatar May 21 '25 15:05 elchininet

regarding companion app: it works on iPad, since it has clear cache button. God only knows how to clear cache on Android, though.... i can't manage to work...

Check this link. I need to change it though because the changes to clear Android cache are already published.

elchininet avatar May 21 '25 15:05 elchininet

It appears that companion works if i delete all browsing history in chrome (android). I opened HA from Chrome, then clicked on three dots in upper right corner, selected "clearing browsing data" (or similar, i'm translating from slovenian) and deleted all data. After that i've had to login again in chrome, of course. But from this point new history also work in companion app.

Protoncek avatar May 21 '25 15:05 Protoncek

It appears that companion works if i delete all browsing history in chrome (android). I opened HA from Chrome, then clicked on three dots in upper right corner, selected "clearing browsing data" (or similar, i'm translating from slovenian) and deleted all data. After that i've had to login again in chrome, of course. But from this point new history also work in companion app.

This has been released already. The path in English is Sidebar settings > Companion app > Troubleshooting.

elchininet avatar May 21 '25 16:05 elchininet

Jesus...i think it couldn't be more hidden as it is... Thanks a lot! Now that i know i hope i'll remember... And, of course, thanks A LOT for history-card repair!

Protoncek avatar May 21 '25 16:05 Protoncek

@elchininet Thank you It's working in chrome and campanion app

cmgestevao avatar May 21 '25 19:05 cmgestevao

thank you so much elchininet for this fix!!!

everyone looking for a quick and broad way to force all clients/platforms to update cache

edit dashboard and go into manage resource image

find and edit the history-explorer-card line image

just change the number after hacstag= to anything else.

This will mime the file has been changed and all the clients will automatically reload the file. You can do this from any client you are more convenient with and it will work.

stepir avatar Jun 27 '25 07:06 stepir

@SpangleLabs Can you merge this PR pleas?

ngocjohn avatar Jul 11 '25 19:07 ngocjohn

+1

Ivanszky avatar Oct 27 '25 11:10 Ivanszky

Note to regenerate the .gz file on linux/unix: gzip -fk history-explorer-car.js

-f to force overwrite of already existing .gz file -k to keep original uncompressed version

zen2 avatar Oct 31 '25 15:10 zen2