Unable to run command_line on switch

I’m trying to execute:

platform: command_line switches: server_icecast: command_on: 'sshpass -p "xxxxxxxxxx" ssh -o StrictHostKeyChecking=no [email protected] sudo reboot 2> /config/command.log' command_off: '' .....

Time ago was working without problems. Not now. I don’t know why?

Log:
2020-01-20 15:20:10 ERROR (SyncWorker_6) [homeassistant.components.command_line.switch] Command failed: sshpass -p "xxxxxxxx" ssh -o StrictHostKeyChecking=no [email protected] sudo reboot 2> /config/command.log

Command.log:
/bin/sh: sshpass: not found

Obvously on the docker shell the command works perfectly

Any idea?

Hello, did you ever find out why, I am having the same issue. I can run it from the terminal but it errors via yaml file.

I switched to ssh with openssh keys. Give a look here:

https://serverpilot.io/docs/how-to-use-ssh-public-key-authentication/

After creating openssh keys (i.e. in /config/ssh/ path - Use hass terminal to configure), your command on hass will be like:

ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] systemctl restart icecast2

I use this command on a swicth entity with command_line platform to restart my icecast server