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: SSH'ing from a command line sensor or shell command
shell_command:
cleanup_alert: ssh [email protected] -i /config/.ssh/id_rsa 'mpv -loop-file /media/alerts/alert13.mp3 &'
cleanup_alert_off: ssh [email protected] -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.
Again, I’ve confirmed the both ssh commands work, both via “real” ssh and from the homeassistant docker container that I can switch into via the Advanced SSH and Web Terminal plugin. The command does throw an error code of 1 into the HA console, but again, it works via the Advanced SSH and Web Terminal plugin CLI, AND it works when I manually fire that line in the script.
What could I be doing wrong?