Hi All,
I’ve been struggling with this issue for around a week now and am hoping the community can help. I would like to have a switch or script that sends an SSH command to a remote raspberry pi that can open a window. I used the guide here to set it up: https://siytek.com/home-assistant-shell/
I have successfully created a key and can run my command via terminal in Home Assistant OS. The command is very simple as it triggers a bash script on the remote raspberry pi to do the hard work. The command that executes without issue in home assistant terminal is the following:
ssh [email protected] '~/open_window_increment'
I copied the keys into my config ssh folder using the following in home assistant terminal:
cp ~/.ssh/id_rsa ~/config/ssh
I confirmed that this created an ssh file in my config folder. I have then configured a switch according to the guide. This means that I added the following to my configuration.yaml file:
shell_command:
open_window_increment:
ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] '~/open_window_increment'
My script then reads as follows:
script:
alias: Open Window Increment
sequence:
- service: shell_command.open_window_increment
mode: single
icon: mdi:window-closed-variant
However when I run my script, I get the following error in my logs:
Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/__init__.py:115
Integration: Shell Command ([documentation](https://www.home-assistant.io/integrations/shell_command), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+shell_command%22))
First occurred: 10:08:22 AM (1 occurrences)
Last logged: 10:08:22 AM
Error running command: `ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] '~/open_window_increment'`, return code: 255
NoneType: None
As far as I can tell I’ve done everything right. The script triggers without issue (according to the home assistant UI) and I don’t think I have any syntax errors or have missed any steps. Based on prior reading in this forum it could be related to permissions but I don’t know how to start diagnosing any of that.
Any help would be greatly appreciated.