Shell Integration Issues

Hello all! I am relatively new to HA and I have been trying to automate my collection of various raspberry pi devices through ssh in HA. When run in terminal, the commands will proceed as expected, but I can’t figure out how to get them into automations. I used this article to create my current configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

shell_command:
  restart_audiopi: ssh -o 'StrictHostKeyChecking=no' -i /config/ssh/id_rsa [email protected] 'sudo shutdown -r now'

and this automations.yaml file:

- id: '1634347672402'
  alias: Restart Pi
  description: 'Restarts raspberry pi.'
  trigger:
  - platform: tag
    tag_id: 95cb08e2-be75-444a-bf5e-a95fbc8db468
  condition: []
  action:
  - service: shell_command.restart_audiopi
  mode: single

However, when I manually run the automation, the automation doesn’t seem to work. I’m not sure how to see the output logs for the automation, either. I would appreciate any advice!

UPDATE: The automation and shell integration is working well, it turns out my command doesn’t work; I keep getting error 255. However, I’m still lost because none of the suggestions here worked for me.