How to display LOG file/text in HaDashboard

Hello
I want to display history log in HAdashboard --> example is my alarm history. I want to show when it was armed/disarmed/ motion detectors, etc…

I have made my history in a list through AppDeamon , but i am struggling to display it.

  • I tried a Sensor in HA: AppDeamon writes the state to the sensor, then i display the sensor in HADashboard. The issue with that is that the sensors only supports 255 characters. It crashes after that

  • I used an iframe to display an html file. I use AppDeamon to write the HTML file. The issue is that the iframe does not update somehow. I tried different browsers (iexplorer, chrome,) but does not work. I need to right - click and “Refresh/Reload frame” to get the updated info

Any suggestion? Any other way to achieve this?
Can i write the text into the widget directly from AppDemon? Which widget to use?
Can i force iframe refresh from AppDeamon or some other way?

K

status_frame:
widget_type: iframe
title: Alarm Status
refresh: 20
url_list:
- http://192.168.1.3:8123/local/status.html
- http://192.168.1.3:8123/local/status.html

you could try if 2 different urls will work for you like
http://192.168.1.3:8123/local/status.html?anything=something
http://192.168.1.3:8123/local/status.html?nothing=something_else

but it all has to do with cashe problems.
i got it working with firefox that way, but i disabled cashe in firefox completely. so nothing is cashed.

Some hacky thoughts :slight_smile:

Put some JS in the html page executed with setTimeOut that changes the url of the page and reloads after an interval in a way similar to @ReneTode mentioned.

I’ve used some simple GUID generation in javascript to avoid cache issues, to create a random id and append to the URL as a parameter

e.g.

function s4() {
  return Math.floor((1 + Math.random()) * 0x10000)
             .toString(16)
             .substring(1);
};

function guid() {
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
         s4() + '-' + s4() + s4() + s4();
} 

then just append the guid to the end of the url like @ReneTode mentioned, e.g.

url = "http://url?"uuid=" + uuid;

You could even avoid an entire reload by linking to a static HTML page that uses an ajax approach to load in the actual log you generate (which then doesn’t have to be in HTML format), and simply keep using this to rewrite the DOM in the page through JS.

1 Like

@ReneTode Thank you for the suggestions…

  • I tried Firefox but had the same issue with not updating.

Actually i found the following workaround based on some other post of yours (and @aimc - https://community.home-assistant.io/t/display-attribute-of-a-sensor/41979 )

I found that the sensor attributes do not have any limitations of 255 characters.
So now I am updating the status string to a sensor attribute “status”, rather than the state.
Then displaying the status as below
It seems to be working

status_sensor:
    widget_type: sensor
    title: "Alarm Status"
    sub_entity: sensor.alarm_label
    sub_entity_to_entity_attribute: status
    widget_style: "text-align: left; vertical-align: top;margin-top: 30px; font-size: 12px;"
1 Like

me too, untill i searched on google how to disable cashe completely.
is a setting which you can change by editing something.
and because cashe is in general bad for a dashboard i did that.

but i am glad you found a way.