Command line Switch: Command failed (with return code 255)

Hi!

I have another raspberri pi running a Magic Mirror, which I want to control the display (on/off) from my home assistant with a command line. I have added a switch for it, but it does not work. The switch itself does not change state, and I get an error in the logs. I know I can add command_state later, but that shouldn’t be required for the command to at least run

  • I have ssh keys
  • The command line works perfectly when I run it from the terminal & ssh addon
  • A thought, could it be some read rights problems? That home assistant process does not have access to read /config/ssh/id_rsa?

Thanks in advance for any help!

Config.yaml:

command_line:
  - switch:
      name: mmdisplay
      unique_id: switch_mmdisplay
      command_on: ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 1'
      command_off: ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 0'

Log errors:

Log details (ERROR)
Logger: homeassistant.components.command_line.utils
Source: components/command_line/utils.py:36
integration: Command Line (documentation, issues)
First occurred: 08:41:03 (11 occurrences)
Last logged: 08:41:05

Command failed (with return code 255): ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 1'
Command failed (with return code 255): ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 0'



Log details (ERROR)
Logger: homeassistant.components.command_line
Source: components/command_line/switch.py:121
integration: Command Line (documentation, issues)
First occurred: 08:41:03 (11 occurrences)
Last logged: 08:41:05

Command failed: ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 1'
Command failed: ssh -i /config/ssh/id_rsa [email protected] 'vcgencmd display_power 0'

Your keys are installed in the SSH addon container, but HA run the command in the HA container with no keys installed.

1 Like

Thanks a ton! That did the trick