Data_template: writing to file is failing

Hi,

I’ve got this error message in my logfile, thet automation does not work:

Error while executing automation automation.sensor_value_to_file: extra keys not allowed @ data['mode']

This is the automation code:

  alias: Sensor value to file
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /5
  condition: []
  action:
  - service: notify.writefile1
    data_template:
      message: '{{now().strftime("%d.%m.%Y;%H:%M:%S")}};{{ states.sensor.wohnzimmer.state }};
        {{ states.sensor.wohnzimmer_2.state }};{{ states.sensor.aussensensor.state}};
        {{ states.sensor.aussensensor_2.state }}'
      mode: single

I have no idea, what’s wrong here. Can someone help?

Many thanks!
Stefan

Your mode last line is incorrectly indented. Should align with action, or be removed altogether.

I’ve never seen that notify.writefile1 service before, though — where’s that from?

Thanks for the hint! Problem solved!

notify.writefile1 is a notification declared inside my configuration.yaml. :wink:

1 Like