Based on the Home Assistant Core Integration File, I created a custom version that reads and writes multi-line content.
Use case examples:
- Store and read data larger than 255 characters
- Load email HTML templates
- Store large AI/ChatGPT responses
- ... and much more!
Features:
- Use the
notifyservice to write multi-line content to a local file. If a file already exists, its content will be erased and the new content will be stored - Use the
sensorservice to read multi-line content from a local file. The content is available in thecontentattribute of the sensor.
Removed:
- State of the
sensorno longer holds the content of the file. Shows 'Ok' (for now :) ). - No header is written to empty/new files
Notes:
- ⚠︎ I have not limited the size of the filesize for the
sensorservice. On a dev setup I successfully read the 10M (Studenten Net Twente FTP) file. The 1000M ended up in a crash-reboot loop from HA.
- Download the latest release of the File++ from this repository;
- In Home Assistant, create a folder
config/custom_components; - Add the File++ files to the
custom_componentsfolder (you should end up it with aconfig/custom_components/file_plusplusfolder); - Restart Home Assistant;
- Add a File++ entity as an Integration in Home Assistant
(menu: settings -> devices & services -> add integration);
For updates, repeat step 1 to 4. Home Assistant will not delete any configuration.
Configuration is done the same as the Home Assistant Core Integration File
