Modifying input_text with folder_watcher

Hi

I am trying to modify a input_text variable with folder_watcher. Folder_watcher is setup as follows:

folder_watcher:
  - folder: /media
    patterns:
      - '*.dav'

I know that this part works as there is output when I listen to the event under developer tools. I am trying to modify the input_text variable with the following code:

- id: '1603013325103'
  alias: CCTV convert video
  description: ''
  trigger:
  - platform: event
    event_type: folder_watcher
    event_data:
      event_type: created
  condition: []
  action:
  - service: input_text.set_value
    data:
      entity_id: input_text.cctv_latest_filename
      value: '{{ states(''trigger.event.data.file'') }}'
  mode: single

The input_variable simply returns “unknown”. Any ideas how I can get this working?

Solved the issue. Should have used ‘{{ trigger.event.data.file}}’ instead of ‘{{ states(’‘trigger.event.data.file’’) }}’.

1 Like