Templates in shell_command data

I have a shell_command that is renaming a file. One of the variables I’m trying to send it is the formatted time value from an input_datetime. I have tested the template {{ state_attr('input_datetime.lastmotion_driveway', 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }} and verified that it is working.

The problem is when I look at the output from the shell_command, it is interpreting the time variable as a literal, not a template. I’ve tried with quotes and without; same effect. I’m sure there is a glaringly obvious way to fix this… anyone?

    - service: shell_command.motion_video
      data:
        action: "mv"
        camera: "driveway"
        time: "{{ state_attr('input_datetime.lastmotion_driveway', 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }}"

Change data: to data_template:

1 Like

Thank you!