I have a script, which fires two shell commands. The first shell command (these are ssh commands) that the script calls fires correctly. There is then a short delay (2 seconds, but I've also tried 5 and 10) and then a second shell command fires to turn off what the first one turned on. I have tried a few different commands that do the same thing, and none of them work.
HOWEVER all lines of the script work when fired manually, by selecting the "three-dot menu" and selecting "run" on the lines in question.
I have tested the ssh command from the homeassistant docker container using the advanced ssh and terminal plugin, as per this extensive post: https://community.home-assistant.io/t/sshing-from-a-command-line-sensor-or-shell-command/258731
shell_command:
cleanup_alert: ssh sparkyvison@192.168.1.11 -i /config/.ssh/id_rsa 'mpv -loop-file /media/alerts/alert13.mp3 &'
cleanup_alert_off: ssh sparkyvision@192.168.1.11 -i /config/.ssh/id_rsa 'pkill -f mpv'
And here is the script
sequence:
- action: shell_command.cleanup_alert
continue_on_error: true
data: {}
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
enabled: true
- action: shell_command.cleanup_alert_off
continue_on_error: true
data: {}
alias: Cleanup done alert sound
description: ""
mode: restart
At first I thought perhaps I had error codes which might be interfering, but I enabled continue_on_error to get around that.
I’ve noticed there’s a significant number of posts looking for help on this topic and the posters all seem to struggle with a few common issues. I realized I’ve been almost copying and pasting my responses on these topics so it seemed like a good case for a community guide. What will this cover This guide will walk through the process of getti...