Problems writing data to file

Hi, I’m trying to write one simple sensor value on regular basis to a file. Based on other examples in the forum (Export sensor data to text file) this looks simple, but I am not able to get this working. It seems it is never started nor the file created. Running Hassio 0.79.3.

Any ideas of what I do wrong would be highly appreciated.

configuration.yaml as follows:

notify:
  - name: filenotify
    platform: file
    filename: hybelpower.csv
    timestamp: true

automation:
  - alias: sensor_values_to_file
    initial_state: 'on'
    trigger:
      platform: time
      minutes: '/5'
      seconds: 00
    action:
      service: notify.filenotify
      data_template: 
        message: "{{ sensor.qubino_zmnhxdx_3phase_smart_meter_energy_2 }}"

Well for one, your message is wrong but that shouldn’t cause issues with file creation.

message: "{{ states.sensor.qubino_zmnhxdx_3phase_smart_meter_energy_2.state }}"

second you should verify that the file is being created in the config directory.

Thanks, message is now corrected to “states.sensor.qubino_zmnhxdx_3phase_smart_meter_energy_2.state”. I also tried to manually make the file in the config folder, but it is not populated with values.

FIXED: After a reboot it was working. Thanks for pointing out the message issue.

1 Like

have the same problem .all is ok but no written data in file ??? i manually make a file file.csv

notify:

  • platform: file
    name: filenotify
    filename: file.csv
    #timestamp: true
    automation:
    • alias: sensor_values_to_file
      initial_state: ‘on’
      trigger:
      • platform: time
        minutes: ‘/1’
        seconds: 00
        action:
      • service: notify.filenotify
        data_template:
        message: “{{states.sensor.faza_1_a_power.state}}”

i setup all .now is ok