Help Convert Old Automation

Could anyone help me convert this older automation of mine to work wit the latest revision of HASS?

- id: commseq
  alias: Command Sequence Received
  trigger:
  - entity_id: sensor.command
    platform: state
  action:
  - data_template:
      sequence: '{{states.sensor.command.state}}'
    service: shell_command.processsequence

I get the following error in the log when the automation is executed:

Error running command: python3 /home/homeassistant/.homeassistant/process_sequence.py {{sequence}}, return code: 1

NoneType: None

EDIT: I am not sure how to include the tab indents…

EDIT: Yay for formatting!

To get the code formatted correctly for the forum paste the code in
the edit box, leaving a blank line at the start and end, then select
the code and click the </> button in the small menu bar at the top of
the edit box.

Now to your question :slight_smile: I could be wrong but I don’t think sequence: is valid outside of a script, so the action should be to call a script I would think.

I think the issue might be because I was using “sequence” to represent a variable to pass to my shell command in my older release and it sounds like that word is now reserved for scripts. I will try updating the variable name and see if that works.

Just to close the loop for others, this worked for me:

- id: commSeq
  alias: Command Sequence
  trigger:
    - entity_id: sensor.command
      platform: state
  action:
  - service: shell_command.processsequence
    data_template:
      cmdsequence: '{{ states.sensor.command.state }}'