Switch command_line SSH to Host

Hello everybody,

I would like to ask for help, because I have no ideas where to go and I know that this is the ideal place to solve these problems :slight_smile:

I use hassbian installed in a docker container on an Ubuntu machine and I am trying to create a command_line switch to send a command by ssh to the host machine.

If I run the command from the terminal on the host machine, it works, if I run the command from the docker container (HA) terminal it works … The problem is that I can’t get it to work via the command_line Switch.

switch:
- platform: command_line
  switches:
    record_uvc_sala:
      command_on: "ssh [email protected] 'python /usr/share/hassio/homeassistant/python_scripts/REC.py'"
      command_off: "ssh [email protected] 'python /usr/share/hassio/homeassistant/python_scripts/NOTREC.py'"
      friendly_name: Gravação

And yes, I added the ssh keys to be able to access without entering a password.

Try to manually tell the ssh command where your ssh key is saved, else it’ll probably won’t work
Also remember the save the ssh key in a place that won’t be deleted the next time the container is down (I saved mine in my config folder which is mounted as a volume)
"ssh -i /path/to/id_rsa [email protected] 'python /usr/share/hassio/homeassistant/python_scripts/REC.py'"