How do I run a shell command from a script or automation?

I have a shell command in configuration.yaml:

#shell_command:
  run_vlc: 'ssh user@ubuntu_pc "bash /path/to/runvlc.sh &"'

(The Bash script on the ubuntu computer runs VLC Media Player).

But, I can’t figure out how to run the shell_command from a script. The shell_command is not an action but service: has been depreciated.

Ideas would be appreciated.

Does it create an entity?
Perhaps reload the entitiy

It should be in the drop down - just type the name …

Automation :

Script :

Thanks for the tip- I hadn’t thought of that. (I’ve only done one shell command a long time ago).

You would think so, but it is not an action, so it doesn’t drop-down in actions:

When I go into the script UI, the manually entered script in scripts.yaml shows an error.

I meant the shell command

Nope- no entity…

they don’t create entities but they do show up as actions.

here are some of mine:

and they also show up in the action page of the dev tools:

it’s likely there is an issue with the shell command configuration that is preventing it from being created.

here are some of mine:

shell_command:

  ha_shutdown_server_pc: ssh -l me 192.168.1.11 "net rpc shutdown -f -t 60 -C 'Home Assistant has called for shutdown in 60 seconds' -U server%my_server -I 192.168.1.15"
  
  ha_restart_server_pc: ssh -l me 192.168.1.11 "net rpc shutdown -r -f -t 60 -C 'Home Assistant has called for restart in 60 seconds' -U server%my_server -I 192.168.1.15"
  
  ha_quick_reboot: ssh -l me 192.168.1.11 "sudo reboot"
    
  ha_quick_shutdown: ssh -l me 192.168.1.11 "sudo shutdown -h now"

Thanks for the help. I don’t know what I did but the shell command is in Actions now.

1 Like