How do I create a CSV file and append values to it?

UPDATE for version 2024.6

As per the new notify entity platform the action configuration has changed. Here is a revised version of the previous example:

action:
  - service: notify.send_message
    target:
      entity_id: notify.write_to_csv
    data:
      message: "some,csv,data,to,write,here"
  • service is always notify.send_message
  • entity_id is whatever you have defined in configuration.yml

UPDATE: If the data is still not written into the file check for errors under Integrations → File. Apparently there have been some breaking changes and I needed to add allowlist_external_dirs config and reconfigure the file entity.

Blog post about the new feature:

2 Likes