Integration: file (documentation, issues)
First occurred: 14:21:23 (1 occurrences)
Last logged: 14:21:23
'/config/test/data.txt' is not an allowed directory
The file sensor platform reads the entries from a plain-text file and shows the found value. Only the last line of the file is used. This is similar to do $ tail -n 1 sensor.txt on the command-line. Note that file paths must be added to allow_external_dirs.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.
To my knowledge, there is no standard integration in Home Assistant that lets you read a specific line from a file.
However, it’s possible to create a python_script to read a file and return whatever information you want.
Here’s an example created by VDRainer that gets all lines from a file and returns them as attributes of a sensor. Once that’s done, the information within the attributes is easily accessible to any template for further processing.
If you want to discuss that way of retrieving data, you should start a new topic.