Struggling with the File Integration (notify.send_message)

I’m struggling big time with File Integration :frowning:

I have a few scripts set up that use this kind of code to log certain items to a csv file:

actions:
  - action: notify.send_message
    data:
      message: >
        {{ now().strftime('%d/%m/%Y') }}, {{
        states('sensor.s_w_fan_on_since_midnight_in_h') }}, {{
        states('sensor.l_e_fan_on_since_midnight_in_h') }}, {{
        states('sensor.sum_s_w_runtime') }}, {{ states('sensor.sum_l_e_runtime')
        }}
    target:
      entity_id: notify.daily_fan_run_time
    enabled: true 

In the integration, I have an entry that looks like this:
image

I now would like to move the existing csv to a different folder and add the new lines there.

With using ‘Rename’ being the only option that seems to be available, I tried to rename the integration entry above from
daily_fan_run_time [/config/daily_fan_run_time.csv]
to
daily_fan_run_time [/share/csv_logs/daily_fan_run_time.csv]
in order to update the file in the new folder (which has been added to ‘allowlist_external_dirs:’).

But that doesn’t seem to do the trick, the action still updates the file in the original folder.

I even restarted HA to ensure that the change is recognized - same issue.

Any hints?

Do you want to move the file once, and then write to it at the new location from now on?
Take a step back. Why do you need a csv file? Isn’t HomeAssistant recording your values in the database correctly, and can’t you extract your fan runtimes since midnight from there?
Just wondering what the bigger picture here is?

Correct!

Because
a) I have data in these CSVs from before LTS was available that I would still like to use for comparison today (e.g. min/max daily outdoor temperature from 2021)
and
b) I have data that isn’t held in LTS at that level, e.g. I store my solar production per panel every 5min as long as the sun’s up.

Today, I’d probably set it up in a separate database, but that ship has sailed :frowning:

There was an excellent writeup posted here in the last few days for import and export to the databases that you may wish to read for ideas.

Update: here it is Loading, Manipulating, Recovering and Moving Long Term Statistics in Home Assistant

Want to move the csv file once? Install the Samba addon temporarily and do it graphically from your desktop may be an easier path than delving into Linux and yaml commands.

Watch your file/folder permissions are correct for read and write operations at the new location.

Consider if your integrations could be altered to write to a database rather than extending a csv text file. Do you have backup contingencies in place for your valuable historic data?

Thanks for the link, appreciate it.

The other items, I’m well aware of.

My question was about manipulating the file configuration/integration entry so that is appends the latest values to the existing files in the NEW location.

I know I can set up a new entry in the file integration and point it to the new location, but then I have to manipulate a lot of entity ids, etc. in automations and scripts.