List from File - HA caring for elderly and infirm

I would like a way to show door entry or motions from a list stored in a file presented on the frontend. I am aware “file” exists but this only lists the last entry. I want to show all entries. I currently use a system in Node Red to ensure that an elderly relative is being cared for properly and I want to offer this in HA, but I do not believe it is currently possible. Node Red UI looks like this;


This element forms an important part of my project to show carers of individuals living on their own how to set up Home Assistant to care for their relatives when they are away from home. I have opted for HA due to the excellent “stream” function, but I am unable to emulate all that I have in place with Node Red on HA’s Frontend. Assistance would be greatly appreciated to assist the thousands of people worldwide how are caring for relatives who live alone.

Hoping somebody can help. Thanks in advance


I think this should already be possible.

You can create a sensor which will show the content of your file like this:

  platform: command_line
  command: python3 -c "print(open('<FILENAME>').readlines())"
  name: Frond Door Events

After this you can take a look at this thread How to show text-only in Lovelace? in order to show the sensor value in Lovelace. It lools like this guy did something similar to what you want to achieve.

Thanks for coming back so swiftly it is greatly appreciated.

I’m a little confused, due to my lack of knowledge of Home Assistant. That aside I believe the creating a sensor is already being undertaken by node red (as long as HASSIO is capable of allowing Node Red to create a file, in this case Door/Dataflush on my rpi) as follows;

To explain the flow - the MQTT node picks the door sensor code, sets the msg.payload, gets rid of the text not required and saves the output to Door/Dataflush

If this is the case then am I just to review a way to create a custom card in Lovelace that pulls the information contained in the Door/Dataflush file?

Thanks in advance

I’m sorry but I don’t understand what you are trying to say.

Could you please explain what your end goal ? What do you want to achieve? Why do you need a list of all front door events?

I need a list of front door events for everyday. Currently under Node Red each event is sent to the Dataflush file and then cleared at midnight.

The reason I need it is because a number of paid carers enter the house each day to look after my Mother-in-Law. They are required to care for her between certain agreed times for a minimum of 30 minutes each session. We therefore need a method to record the times so we can compare to the monthly billing and challenge the care company when the 30 minutes are not met or indeed when they fail to turn up at all.

I also have a file which is not cleared and has past records. This is emailable but doesn’t need to be available to view on the frontend.

Hope that’s clear

Ok, I understand now. I still don’t get why you need the events for the day to be shown in lovelace, if you already have the file for the whole month to compare to your bill.

Because you’re able to quickly review the day rather than sending a file to yourself that you’ll need to scroll through

Ok, let’s try to get there.

First, where are the files stored, which you create with node red? Can you store them in the “www” directory of homeassistant?

Second, try to create a sensor which will show the content of the file like this:

  platform: command_line
  command: python3 -c "print(open('/home/homeassistant/.homeassistant/www/YOUR_FILENAME.TXT').readlines())"
  name: Frond Door Events

That’s great, thanks again,

Files are currently stored in /Home/pi/Door/Dataflush

I have moved to www

I have created the sensor as set out above

How does the sensor look like? Do you see the information from the file in the sensor?

Not there yet.

I need to move the MQTT Server to the tinkerboard I presently have HASSIO on and see if the door events are stored via (Hassio) Node Red as expected. I currently have a RPI running the Node Red Only solution and I have unsuccessfully captured the door events from its MQTT server on the Hassio. I shall confirm once done and indicate if there’s still issues.

Also, I note that the path as per your configuration.yaml is /home/homeassistant/.homeassistant/www/Dataflush.TXT. Having broased through the HASSIO file structure my www directory is found in /var/www. I have no directory structure /home/homeassistant/.homeassistant/www from what I can see? Can you advise on this bit please?


I just found out that my way will probably not work, due to the fact that the state of a sensor can have max. 255 characters.

The only way I can think of solving your issue is, if you add the door sensor to Home Assistant and then when you click on the door sensor you’ll see the history for the last 24 hours.

Maybe someone here on the forum knows any other solution.

Thanks for your help.

I shall ask a different way and see what comes from that.