Command line switch not working

Hello,

I have my hadashboard on another pi which i s conncted to a monitor. To save energy etc. I want to turn on/off my monitor of the pi via the command line.
I’ve set up a public key so I can access the pi over ssh from the hass.io terminal without password. That works perfectly and I can switch the monitor on/off via the terminal in hass.io with the exact same command as in the configuration.yaml. So it should actually work… However I get an error when I try to switch it over the frontend.

Hass.io runs on docker on an ubuntu systme and the pi with the dashbaord runs on raspbian.

  - platform: command_line
    switches:
    dashboard:
       command_on: ssh [email protected] vcgencmd display_power 1
       command_off: ssh [email protected] vcgencmd display_power 0

Here it seems that the guy found a solution however I don’t get how I should install the ssh key through the username homeassistant. My Pi doesn’t have that use.r

Would be great if anybody has an idea.

Thanks
kind regards
Chris

Managed to get it working.

If anybody else has this problem just follow this guide works perfectly now

https://megamorphf.github.io/homeassistant/hyperion/ssh/hassio/2018/01/22/controlling-anything-via-ssh.html

1 Like

Is this necessary when running Home Assistant in a docker?

I have a command_line switch inside a docker container. I already have SSL setup, and the container is in network_mode: host

I find it so hard to believe that there’s no other way to send a command to a program outside of a container, and you have to setup new users, ssl keys and use ssh.

I tried following these steps: https://megamorphf.github.io/homeassistant/hyperion/ssh/hassio/2018/01/22/controlling-anything-via-ssh.html

But it does not work with docker.

How do I setup keys inside docker that’ll allow me to use ssh to run a simple command in the raspbian host outside?

Hello, try to not set up a password for the ssl key. It should be still protected by the key.

I didnt set up a new user so maybe it works then.

Does it work if you send the command in the hassio terminal?

TSM-EVO Did you ever get this working? I’m stuck in a similar position, having tried pretty much all the recommendations from here and other threads.